Commit 1f403a54 authored by chase's avatar chase

报表文件上传归档功能

parent 506dce2c
...@@ -38,14 +38,15 @@ public class ReportUploadDetailController extends BaseController { ...@@ -38,14 +38,15 @@ public class ReportUploadDetailController extends BaseController {
return reportFileUploadService.queryData(param); return reportFileUploadService.queryData(param);
} }
@ResponseBody
@PostMapping("saveFileUpload") @PostMapping("saveFileUpload")
public OperationResultDto saveFileUpload(@RequestParam MultipartFile file, @RequestParam String reportType,@RequestParam String projectId, @RequestParam Integer period) { public OperationResultDto saveFileUpload(@RequestParam MultipartFile file, @RequestParam String sourceType,@RequestParam String reportType,@RequestParam String projectId, @RequestParam Integer period) {
try { try {
ReportFileUpload data = new ReportFileUpload(); ReportFileUpload data = new ReportFileUpload();
data.setPeriod(period); data.setPeriod(period);
data.setProjectId(projectId); data.setProjectId(projectId);
data.setReportType(reportType); data.setReportType(reportType);
data.setSourceType(sourceType);
reportFileUploadService.saveData(file,data); reportFileUploadService.saveData(file,data);
return OperationResultDto.success(); return OperationResultDto.success();
} catch (ServiceException e) { } catch (ServiceException e) {
......
...@@ -50,41 +50,41 @@ public class ReportFileUploadService extends BaseService { ...@@ -50,41 +50,41 @@ public class ReportFileUploadService extends BaseService {
ReportFileUploadExample example = new ReportFileUploadExample(); ReportFileUploadExample example = new ReportFileUploadExample();
example.createCriteria().andProjectIdEqualTo(param.getProjectId()).andPeriodEqualTo(param.getPeriod()); example.createCriteria().andProjectIdEqualTo(param.getProjectId()).andPeriodEqualTo(param.getPeriod());
List<ReportFileUpload> dataList = reportFileUploadMapper.selectByExample(example); List<ReportFileUpload> dataList = reportFileUploadMapper.selectByExample(example);
List<String> fileUploadUids =dataList.stream() List<String> fileUploadUids = dataList.stream()
.map(o -> o.getFileUploadId()).collect(Collectors.toList()); .map(o -> o.getFileUploadId()).collect(Collectors.toList());
Map<String,String> urlMap = new HashMap<>(); Map<String, String> urlMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(fileUploadUids)){ if (CollectionUtils.isNotEmpty(fileUploadUids)) {
DidiFileIUploadParam fileParam = new DidiFileIUploadParam(); DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(fileUploadUids); fileParam.setUuids(fileUploadUids);
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam); PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
if(CollectionUtils.isNotEmpty(uploadDetail.getList())){ if (CollectionUtils.isNotEmpty(uploadDetail.getList())) {
urlMap = uploadDetail.getList().stream().collect(Collectors.toMap(DidiFileUploadDetailResult::getUid, didiFileUploadDetailResult -> didiFileUploadDetailResult.getViewHttpUrl())); urlMap = uploadDetail.getList().stream().collect(Collectors.toMap(DidiFileUploadDetailResult::getUid, didiFileUploadDetailResult -> didiFileUploadDetailResult.getViewHttpUrl()));
} }
} }
List<String> reportTypeList = dataList.stream() List<String> reportTypeList = dataList.stream()
.map(o -> o.getReportType()).collect(Collectors.toList()); .map(o -> o.getReportType()).collect(Collectors.toList());
if(!reportTypeList.contains(ReportFileUploadEnum.ReportType.NORMAL_DECLARATION)){ if (!reportTypeList.contains(ReportFileUploadEnum.ReportType.NORMAL_DECLARATION.getCode())) {
ReportFileUpload upload = new ReportFileUpload(); ReportFileUpload upload = new ReportFileUpload();
upload.setReportType(ReportFileUploadEnum.ReportType.NORMAL_DECLARATION.getCode()); upload.setReportType(ReportFileUploadEnum.ReportType.NORMAL_DECLARATION.getCode());
dataList.add(upload); dataList.add(upload);
} }
if(!reportTypeList.contains(ReportFileUploadEnum.ReportType.CORR_DECLARATION)){ if (!reportTypeList.contains(ReportFileUploadEnum.ReportType.CORR_DECLARATION.getCode())) {
ReportFileUpload upload = new ReportFileUpload(); ReportFileUpload upload = new ReportFileUpload();
upload.setReportType(ReportFileUploadEnum.ReportType.CORR_DECLARATION.getCode()); upload.setReportType(ReportFileUploadEnum.ReportType.CORR_DECLARATION.getCode());
dataList.add(upload); dataList.add(upload);
} }
if(!reportTypeList.contains(ReportFileUploadEnum.ReportType.NORMAL_TAX_RECEIPT)){ if (!reportTypeList.contains(ReportFileUploadEnum.ReportType.NORMAL_TAX_RECEIPT.getCode())) {
ReportFileUpload upload = new ReportFileUpload(); ReportFileUpload upload = new ReportFileUpload();
upload.setReportType(ReportFileUploadEnum.ReportType.NORMAL_TAX_RECEIPT.getCode()); upload.setReportType(ReportFileUploadEnum.ReportType.NORMAL_TAX_RECEIPT.getCode());
dataList.add(upload); dataList.add(upload);
} }
if(!reportTypeList.contains(ReportFileUploadEnum.ReportType.CORR_TAX_RECEIPT)){ if (!reportTypeList.contains(ReportFileUploadEnum.ReportType.CORR_TAX_RECEIPT.getCode())) {
ReportFileUpload upload = new ReportFileUpload(); ReportFileUpload upload = new ReportFileUpload();
upload.setReportType(ReportFileUploadEnum.ReportType.CORR_TAX_RECEIPT.getCode()); upload.setReportType(ReportFileUploadEnum.ReportType.CORR_TAX_RECEIPT.getCode());
dataList.add(upload); dataList.add(upload);
} }
List<ReportFileUploadResult> resultList = new ArrayList<ReportFileUploadResult>(); List<ReportFileUploadResult> resultList = new ArrayList<ReportFileUploadResult>();
for(ReportFileUpload data:dataList){ for (ReportFileUpload data : dataList) {
ReportFileUploadResult result = beanUtil.copyProperties(data, new ReportFileUploadResult()); ReportFileUploadResult result = beanUtil.copyProperties(data, new ReportFileUploadResult());
result.setFileUrl(urlMap.get(data.getFileUploadId())); result.setFileUrl(urlMap.get(data.getFileUploadId()));
resultList.add(result); resultList.add(result);
...@@ -93,10 +93,10 @@ public class ReportFileUploadService extends BaseService { ...@@ -93,10 +93,10 @@ public class ReportFileUploadService extends BaseService {
} }
public void saveData(MultipartFile file, ReportFileUpload data) { public void saveData(MultipartFile file, ReportFileUpload data) {
if(!ReportFileUploadEnum.ReportType.MAPPING.containsKey(data.getReportType())){ if (!ReportFileUploadEnum.ReportType.MAPPING.containsKey(data.getReportType())) {
throw new ServiceException(ErrorMessage.ParamError); throw new ServiceException(ErrorMessage.ParamError);
} }
if(!ReportFileUploadEnum.SuorceType.MAPPING.containsKey(data.getSourceType())){ if (!ReportFileUploadEnum.SuorceType.MAPPING.containsKey(data.getSourceType())) {
throw new ServiceException(ErrorMessage.ParamError); throw new ServiceException(ErrorMessage.ParamError);
} }
String uid = authUserHelper.getCurrentUserId(); String uid = authUserHelper.getCurrentUserId();
...@@ -111,8 +111,8 @@ public class ReportFileUploadService extends BaseService { ...@@ -111,8 +111,8 @@ public class ReportFileUploadService extends BaseService {
data.setUid(CommonUtils.getUUID()); data.setUid(CommonUtils.getUUID());
data.setCreateTime(new Date()); data.setCreateTime(new Date());
data.setReportFileName(file.getOriginalFilename()); data.setReportFileName(file.getOriginalFilename());
int updateRow = reportFileUploadMapper.updateByExample(data,example); int updateRow = reportFileUploadMapper.updateByExample(data, example);
if(updateRow==0){ if (updateRow == 0) {
reportFileUploadMapper.insert(data); reportFileUploadMapper.insert(data);
} }
} }
......
package pwc.taxtech.atms.vat.entity; package pwc.taxtech.atms.vat.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import pwc.taxtech.atms.entity.BaseEntity;
/** /**
* *
...@@ -87,17 +88,6 @@ public class ReportFileUpload extends BaseEntity implements Serializable { ...@@ -87,17 +88,6 @@ public class ReportFileUpload extends BaseEntity implements Serializable {
*/ */
private String reportFileName; private String reportFileName;
/**
* Database Column Remarks:
* 版本号
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column report_file_upload.version
*
* @mbg.generated
*/
private Integer version;
/** /**
* Database Column Remarks: * Database Column Remarks:
* 文件上传表id * 文件上传表id
...@@ -307,30 +297,6 @@ public class ReportFileUpload extends BaseEntity implements Serializable { ...@@ -307,30 +297,6 @@ public class ReportFileUpload extends BaseEntity implements Serializable {
this.reportFileName = reportFileName == null ? null : reportFileName.trim(); this.reportFileName = reportFileName == null ? null : reportFileName.trim();
} }
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column report_file_upload.version
*
* @return the value of report_file_upload.version
*
* @mbg.generated
*/
public Integer getVersion() {
return version;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column report_file_upload.version
*
* @param version the value for report_file_upload.version
*
* @mbg.generated
*/
public void setVersion(Integer version) {
this.version = version;
}
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column report_file_upload.file_upload_id * This method returns the value of the database column report_file_upload.file_upload_id
...@@ -422,7 +388,6 @@ public class ReportFileUpload extends BaseEntity implements Serializable { ...@@ -422,7 +388,6 @@ public class ReportFileUpload extends BaseEntity implements Serializable {
sb.append(", creator=").append(creator); sb.append(", creator=").append(creator);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", reportFileName=").append(reportFileName); sb.append(", reportFileName=").append(reportFileName);
sb.append(", version=").append(version);
sb.append(", fileUploadId=").append(fileUploadId); sb.append(", fileUploadId=").append(fileUploadId);
sb.append(", reportType=").append(reportType); sb.append(", reportType=").append(reportType);
sb.append(", sourceType=").append(sourceType); sb.append(", sourceType=").append(sourceType);
......
...@@ -665,66 +665,6 @@ public class ReportFileUploadExample { ...@@ -665,66 +665,6 @@ public class ReportFileUploadExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andVersionIsNull() {
addCriterion("version is null");
return (Criteria) this;
}
public Criteria andVersionIsNotNull() {
addCriterion("version is not null");
return (Criteria) this;
}
public Criteria andVersionEqualTo(Integer value) {
addCriterion("version =", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotEqualTo(Integer value) {
addCriterion("version <>", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThan(Integer value) {
addCriterion("version >", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThanOrEqualTo(Integer value) {
addCriterion("version >=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThan(Integer value) {
addCriterion("version <", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThanOrEqualTo(Integer value) {
addCriterion("version <=", value, "version");
return (Criteria) this;
}
public Criteria andVersionIn(List<Integer> values) {
addCriterion("version in", values, "version");
return (Criteria) this;
}
public Criteria andVersionNotIn(List<Integer> values) {
addCriterion("version not in", values, "version");
return (Criteria) this;
}
public Criteria andVersionBetween(Integer value1, Integer value2) {
addCriterion("version between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andVersionNotBetween(Integer value1, Integer value2) {
addCriterion("version not between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andFileUploadIdIsNull() { public Criteria andFileUploadIdIsNull() {
addCriterion("file_upload_id is null"); addCriterion("file_upload_id is null");
return (Criteria) this; return (Criteria) this;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
<result column="creator" jdbcType="VARCHAR" property="creator" /> <result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="report_file_name" jdbcType="VARCHAR" property="reportFileName" /> <result column="report_file_name" jdbcType="VARCHAR" property="reportFileName" />
<result column="version" jdbcType="INTEGER" property="version" />
<result column="file_upload_id" jdbcType="VARCHAR" property="fileUploadId" /> <result column="file_upload_id" jdbcType="VARCHAR" property="fileUploadId" />
<result column="report_type" jdbcType="VARCHAR" property="reportType" /> <result column="report_type" jdbcType="VARCHAR" property="reportType" />
<result column="source_type" jdbcType="VARCHAR" property="sourceType" /> <result column="source_type" jdbcType="VARCHAR" property="sourceType" />
...@@ -89,8 +88,8 @@ ...@@ -89,8 +88,8 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
`uid`, org_id, project_id, period, creator, create_time, report_file_name, version, `uid`, org_id, project_id, period, creator, create_time, report_file_name, file_upload_id,
file_upload_id, report_type, source_type report_type, source_type
</sql> </sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.ReportFileUploadExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.ReportFileUploadExample" resultMap="BaseResultMap">
<!-- <!--
...@@ -127,12 +126,12 @@ ...@@ -127,12 +126,12 @@
--> -->
insert into report_file_upload (`uid`, org_id, project_id, insert into report_file_upload (`uid`, org_id, project_id,
period, creator, create_time, period, creator, create_time,
report_file_name, version, file_upload_id, report_file_name, file_upload_id, report_type,
report_type, source_type) source_type)
values (#{uid,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, values (#{uid,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{period,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{period,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{reportFileName,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{fileUploadId,jdbcType=VARCHAR}, #{reportFileName,jdbcType=VARCHAR}, #{fileUploadId,jdbcType=VARCHAR}, #{reportType,jdbcType=VARCHAR},
#{reportType,jdbcType=VARCHAR}, #{sourceType,jdbcType=VARCHAR}) #{sourceType,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.ReportFileUpload"> <insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.ReportFileUpload">
<!-- <!--
...@@ -162,9 +161,6 @@ ...@@ -162,9 +161,6 @@
<if test="reportFileName != null"> <if test="reportFileName != null">
report_file_name, report_file_name,
</if> </if>
<if test="version != null">
version,
</if>
<if test="fileUploadId != null"> <if test="fileUploadId != null">
file_upload_id, file_upload_id,
</if> </if>
...@@ -197,9 +193,6 @@ ...@@ -197,9 +193,6 @@
<if test="reportFileName != null"> <if test="reportFileName != null">
#{reportFileName,jdbcType=VARCHAR}, #{reportFileName,jdbcType=VARCHAR},
</if> </if>
<if test="version != null">
#{version,jdbcType=INTEGER},
</if>
<if test="fileUploadId != null"> <if test="fileUploadId != null">
#{fileUploadId,jdbcType=VARCHAR}, #{fileUploadId,jdbcType=VARCHAR},
</if> </if>
...@@ -249,9 +242,6 @@ ...@@ -249,9 +242,6 @@
<if test="record.reportFileName != null"> <if test="record.reportFileName != null">
report_file_name = #{record.reportFileName,jdbcType=VARCHAR}, report_file_name = #{record.reportFileName,jdbcType=VARCHAR},
</if> </if>
<if test="record.version != null">
version = #{record.version,jdbcType=INTEGER},
</if>
<if test="record.fileUploadId != null"> <if test="record.fileUploadId != null">
file_upload_id = #{record.fileUploadId,jdbcType=VARCHAR}, file_upload_id = #{record.fileUploadId,jdbcType=VARCHAR},
</if> </if>
...@@ -279,7 +269,6 @@ ...@@ -279,7 +269,6 @@
creator = #{record.creator,jdbcType=VARCHAR}, creator = #{record.creator,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
report_file_name = #{record.reportFileName,jdbcType=VARCHAR}, report_file_name = #{record.reportFileName,jdbcType=VARCHAR},
version = #{record.version,jdbcType=INTEGER},
file_upload_id = #{record.fileUploadId,jdbcType=VARCHAR}, file_upload_id = #{record.fileUploadId,jdbcType=VARCHAR},
report_type = #{record.reportType,jdbcType=VARCHAR}, report_type = #{record.reportType,jdbcType=VARCHAR},
source_type = #{record.sourceType,jdbcType=VARCHAR} source_type = #{record.sourceType,jdbcType=VARCHAR}
......
commonModule.controller('vatReportUploadDetailController', ['$scope', '$log', '$translate', '$timeout', 'SweetAlert', '$q', commonModule.controller('vatReportUploadDetailController', ['$scope', '$log', '$translate', '$timeout', 'SweetAlert', '$q',
'$interval', 'dxDataGridService', '$http', 'apiConfig', 'vatSessionService','Upload','apiInterceptor', '$interval', 'dxDataGridService', '$http', 'apiConfig', 'vatSessionService', 'Upload', 'apiInterceptor',
function ($scope, $log, $translate, $timeout, SweetAlert, $q, $interval, dxDataGridService, $http, apiConfig, vatSessionService,Upload,apiInterceptor) { function ($scope, $log, $translate, $timeout, SweetAlert, $q, $interval, dxDataGridService, $http, apiConfig, vatSessionService, Upload, apiInterceptor) {
'use strict'; 'use strict';
$log.debug('vatReportUploadDetailController.ctor()...'); $log.debug('vatReportUploadDetailController.ctor()...');
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
allowHeaderFiltering: true allowHeaderFiltering: true
}, },
{ {
dataField: 'reportName', dataField: 'reportFileName',
caption: $translate.instant('RepUploadDtlColFileName'), caption: $translate.instant('RepUploadDtlColFileName'),
fixed: true, fixed: true,
allowHeaderFiltering: true allowHeaderFiltering: true
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
}, },
{ {
dataField: 'createTime', dataField: 'createTime',
width: '20%', width: '10%',
caption: $translate.instant('RepUploadDtlColCreateTime'), caption: $translate.instant('RepUploadDtlColCreateTime'),
fixed: true, fixed: true,
allowHeaderFiltering: true, allowHeaderFiltering: true,
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
allowHeaderFiltering: true allowHeaderFiltering: true
}, },
{ {
dataField: 'reportName', dataField: 'reportFileName',
width: '30%', width: '30%',
caption: $translate.instant('RepUploadDtlColFileName'), caption: $translate.instant('RepUploadDtlColFileName'),
fixed: true, fixed: true,
...@@ -111,15 +111,17 @@ ...@@ -111,15 +111,17 @@
{ {
caption: $translate.instant('RepUploadDtlColUpload'), caption: $translate.instant('RepUploadDtlColUpload'),
fixed: true, fixed: true,
width: '5%', width: '8%',
allowHeaderFiltering: true, allowHeaderFiltering: true,
cellTemplate: function (container, options) { cellTemplate: function (container, options) {
try { try {
$("<a href='javascript:void(0)'>上传</a>").on('click', function () { $("<a href='javascript:void(0)'>上传</a>").on('click', function () {
$scope.handleReportType = options.data.reportType;
$('#uploadBut' + options.rowIndex).click(); $('#uploadBut' + options.rowIndex).click();
}).appendTo(container); }).appendTo(container);
$('<input type="file" ng-model="uploadFileName" id="uploadBut' + options.rowIndex + '" style="display:none;"/>').appendTo(container); $('<input type="file" style="display:none;" id="uploadBut' + options.rowIndex + '" />').on('change', function () {
console.log($('#uploadBut' + options.rowIndex)[0].files[0]);
uploadFile($('#uploadBut' + options.rowIndex)[0].files[0], options.data.reportType);
}).appendTo(container);
} catch (e) { } catch (e) {
$log.error(e); $log.error(e);
} }
...@@ -127,12 +129,12 @@ ...@@ -127,12 +129,12 @@
}, },
{ {
dataField: 'fileUrl', dataField: 'fileUrl',
width: '5%', width: '8%',
caption: $translate.instant('RepUploadDtlColDownload'), caption: $translate.instant('RepUploadDtlColDownload'),
fixed: true, fixed: true,
allowHeaderFiltering: true, allowHeaderFiltering: true,
cellTemplate: function (container, options) { cellTemplate: function (container, options) {
if (!options.data.fileUrl && "" != options.data.fileUrl) { if (options.data.fileUrl && "" != options.data.fileUrl) {
try { try {
$("<a href='" + options.data.fileUrl + "'>下载</a>") $("<a href='" + options.data.fileUrl + "'>下载</a>")
.appendTo(container); .appendTo(container);
...@@ -144,7 +146,7 @@ ...@@ -144,7 +146,7 @@
}, },
{ {
dataField: 'sourceTypeStr', dataField: 'sourceTypeStr',
width: '5%', width: '8%',
caption: $translate.instant('RepUploadDtlColSourceType'), caption: $translate.instant('RepUploadDtlColSourceType'),
fixed: true, fixed: true,
allowHeaderFiltering: true allowHeaderFiltering: true
...@@ -181,7 +183,7 @@ ...@@ -181,7 +183,7 @@
}, },
{ {
dataField: 'createTime', dataField: 'createTime',
width: '20%', width: '10%',
caption: $translate.instant('RepUploadDtlColCreateTime'), caption: $translate.instant('RepUploadDtlColCreateTime'),
fixed: true, fixed: true,
allowHeaderFiltering: true, allowHeaderFiltering: true,
...@@ -196,7 +198,7 @@ ...@@ -196,7 +198,7 @@
allowHeaderFiltering: true allowHeaderFiltering: true
}, },
{ {
dataField: 'reportName', dataField: 'reportFileName',
width: '30%', width: '30%',
caption: $translate.instant('RepUploadDtlColFileName'), caption: $translate.instant('RepUploadDtlColFileName'),
fixed: true, fixed: true,
...@@ -205,12 +207,17 @@ ...@@ -205,12 +207,17 @@
{ {
caption: $translate.instant('RepUploadDtlColUpload'), caption: $translate.instant('RepUploadDtlColUpload'),
fixed: true, fixed: true,
width: '5%', width: '8%',
allowHeaderFiltering: true, allowHeaderFiltering: true,
cellTemplate: function (container, options) { cellTemplate: function (container, options) {
try { try {
$("<a href='javascript:void(0)'>上传</a>") $("<a href='javascript:void(0)'>上传</a>").on('click', function () {
.appendTo(container); $('#uploadBut' + options.rowIndex).click();
}).appendTo(container);
$('<input type="file" style="display:none;" id="uploadBut' + options.rowIndex + '" />').on('change', function () {
console.log($('#uploadBut' + options.rowIndex)[0].files[0]);
uploadFile($('#uploadBut' + options.rowIndex)[0].files[0], options.data.reportType);
}).appendTo(container);
} catch (e) { } catch (e) {
$log.error(e); $log.error(e);
} }
...@@ -218,12 +225,12 @@ ...@@ -218,12 +225,12 @@
}, },
{ {
dataField: 'fileUrl', dataField: 'fileUrl',
width: '5%', width: '8%',
caption: $translate.instant('RepUploadDtlColDownload'), caption: $translate.instant('RepUploadDtlColDownload'),
fixed: true, fixed: true,
allowHeaderFiltering: true, allowHeaderFiltering: true,
cellTemplate: function (container, options) { cellTemplate: function (container, options) {
if (!options.data.fileUrl && "" != options.data.fileUrl) { if (options.data.fileUrl && "" != options.data.fileUrl) {
try { try {
$("<a href='" + options.data.fileUrl + "'>下载</a>") $("<a href='" + options.data.fileUrl + "'>下载</a>")
.appendTo(container); .appendTo(container);
...@@ -235,7 +242,7 @@ ...@@ -235,7 +242,7 @@
}, },
{ {
dataField: 'sourceTypeStr', dataField: 'sourceTypeStr',
width: '5%', width: '8%',
caption: $translate.instant('RepUploadDtlColSourceType'), caption: $translate.instant('RepUploadDtlColSourceType'),
fixed: true, fixed: true,
allowHeaderFiltering: true allowHeaderFiltering: true
...@@ -246,24 +253,25 @@ ...@@ -246,24 +253,25 @@
} }
}); });
$scope.uploadFile = function () { var uploadFile = function (file, reportType) {
var month = vatSessionService.month < 10 ? ("0" + vatSessionService.month) : vatSessionService.month; var month = vatSessionService.month < 10 ? ("0" + vatSessionService.month) : vatSessionService.month;
Upload.upload({ Upload.upload({
url: apiInterceptor.webApiHostUrl + '/reportUploadDetail/saveFileUpload', url: apiInterceptor.webApiHostUrl + '/reportUploadDetail/saveFileUpload',
data: { data: {
projectId: vatSessionService.project.id, projectId: vatSessionService.project.id,
period: "" + vatSessionService.year + month period: "" + vatSessionService.year + month,
reportType: reportType,
sourceType: "VAT"
}, },
file: $scope.uploadFileName, file: file,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(), Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
__RequestVerificationToken: token, withCredentials: true
}, },
__RequestVerificationToken: token, withCredentials: true
}).then(function (resp) { }).then(function (resp) {
$scope.getReportFileUpload();
}, function (resp) { }, function (resp) {
}, function (evt) { }, function (evt) {
...@@ -296,8 +304,7 @@ ...@@ -296,8 +304,7 @@
var month = vatSessionService.month < 10 ? ("0" + vatSessionService.month) : vatSessionService.month; var month = vatSessionService.month < 10 ? ("0" + vatSessionService.month) : vatSessionService.month;
$http.post('/reportUploadDetail/queryFileUpload', { $http.post('/reportUploadDetail/queryFileUpload', {
projectId: vatSessionService.project.id, projectId: vatSessionService.project.id,
period: "" + vatSessionService.year + month, period: "" + vatSessionService.year + month
reportType: $scope.handleReportType
}, apiConfig.createVat()) }, apiConfig.createVat())
.success(function (res) { .success(function (res) {
if (res) { if (res) {
...@@ -311,7 +318,6 @@ ...@@ -311,7 +318,6 @@
$scope.reportThreeDataSource.push(data); $scope.reportThreeDataSource.push(data);
} }
}); });
$scope.pagingOptions.totalItems = res.pageInfo.totalCount;
} else { } else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
...@@ -332,12 +338,6 @@ ...@@ -332,12 +338,6 @@
$scope.searchParam = {}; $scope.searchParam = {};
$scope.uploadFileName = "";
$scope.$watch('uploadFileName', function (newValue, oldValue) {
$scope.uploadFile();
});
$scope.handleReportType;
function init() { function init() {
$scope.refreshGrid(); $scope.refreshGrid();
$scope.getReportFileUpload(); $scope.getReportFileUpload();
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
<div style="height: 40%"> <div style="height: 40%">
<div class="content-container-other" style="float:left;width:48%;"> <div class="content-container-other" style="float:left;width:49%;">
<div class="body"> <div class="body">
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</div> </div>
<div class="content-container-other" style="float:right;width:48%;"> <div class="content-container-other" style="float:right;width:49%;">
<div class="body"> <div class="body">
......
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