Commit fc5c7c68 authored by kevin's avatar kevin

#

parent 1c7bd322
package pwc.taxtech.atms.common.util;
import org.jxls.area.Area;
import org.jxls.builder.AreaBuilder;
import org.jxls.builder.xls.XlsCommentAreaBuilder;
import org.jxls.common.CellRef;
import org.jxls.common.Context;
import org.jxls.expression.JexlExpressionEvaluator;
import org.jxls.transform.Transformer;
import org.jxls.transform.poi.WritableCellValue;
import org.jxls.transform.poi.WritableHyperlink;
import org.jxls.util.JxlsHelper;
import org.jxls.util.TransformerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Jxls导出Excel工具
* author kevin
*/
public class JxlsUtils {
private static final Logger log = LoggerFactory.getLogger(JxlsUtils.class);
public static void toPackageOs(HttpServletResponse response , String fileName) {
ResponseUtil.response(response, fileName, null);
}
/**
* 生成模板输入流
* @param temPath
* @return
* @throws Exception
*/
public static InputStream toPackageIn(String temPath){
try {
return new ClassPathResource((temPath)).getInputStream();
} catch (IOException e) {
e.printStackTrace();
}
}
public static <T> void exportExcel(List<T> list, ServletOutputStream os ,
InputStream in, Object relation ){
long exportExcelBegin = System.currentTimeMillis();
log.warn("exportExcel begin: " + exportExcelBegin);
Context context = new Context();
context.putVar("list", list);
if(relation != null)
context.putVar("relation", relation);
Map<String , Object> myFunction = new HashMap<String , Object>();
myFunction.put("util", new JxlsUtils());
Transformer trans = TransformerFactory.createTransformer(in, os);
JexlExpressionEvaluator evaluator = (JexlExpressionEvaluator) trans.getTransformationConfig().getExpressionEvaluator();
evaluator.getJexlEngine().setFunctions(myFunction);
//载入模板、处理导出
AreaBuilder areaBuilder = new XlsCommentAreaBuilder(trans);
List<Area> areaList = areaBuilder.build();
areaList.get(0).applyAt(new CellRef("汇总表!A1"), context);
try {
trans.write();
//释放资源
os.flush();
os.close();
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
//返回大的数
public Integer max(Integer x , Integer y){
return x > y ? x : y;
}
//给金额前面显示个货币符号
public Object formatMoney(Object a){
Object result = null;
if(a != null){
return "¥" + a;
}
return result;
}
//超链接
public WritableCellValue myHyperlink(String address, String title) {
return new WritableHyperlink(address, title);
}
private Map<String,Integer> countMap = new HashMap<>(); //用于jxls的foreach循环计数
//为Excel添加序号
public Integer count(String var){
if (var == null) return null;
if(countMap.containsKey(var)){
Integer t = countMap.get(var);
t += 1;
countMap.replace(var,t);
return t;
}else{
countMap.put(var,1);
}
return 1;
}
}
...@@ -15,7 +15,7 @@ public class ResponseUtil { ...@@ -15,7 +15,7 @@ public class ResponseUtil {
response.addHeader("Access-Control-Expose-Headers", "Content-Type,Content-Disposition,x-file-name"); response.addHeader("Access-Control-Expose-Headers", "Content-Type,Content-Disposition,x-file-name");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.addHeader("Content-Disposition", "attachment;filename=" response.addHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls"); + UUID.randomUUID() + ".xlsx");
response.addHeader("x-file-name", fileName); response.addHeader("x-file-name", fileName);
try { try {
return response.getOutputStream(); return response.getOutputStream();
......
...@@ -34,6 +34,7 @@ public final class Constant { ...@@ -34,6 +34,7 @@ public final class Constant {
public static final String FILE_NAME = "filename"; public static final String FILE_NAME = "filename";
public static final String TEMP_FILE_NAME = "tempFileName"; public static final String TEMP_FILE_NAME = "tempFileName";
public static final String exportTemplateUrl = "vat_excel_template";
public static final boolean DEFAULT_RESULT = true; public static final boolean DEFAULT_RESULT = true;
......
...@@ -46,16 +46,22 @@ public class CitPreviewDataController extends BaseController { ...@@ -46,16 +46,22 @@ public class CitPreviewDataController extends BaseController {
@RequestMapping("getCitPreviewEamDisposalDataList") @RequestMapping("getCitPreviewEamDisposalDataList")
@ResponseBody @ResponseBody
public CamelPagingResultDto<CitEAMAssetsDisposal> getCitPreviewEamDisposalDataList(@RequestBody CitEAMAssetsDisposalDto citSalaryDataDto){ public CamelPagingResultDto<CitEAMAssetsDisposal> getCitPreviewEamDisposalDataList(@RequestBody CitEAMAssetsDisposalDto citSalaryDataDto){
return new CamelPagingResultDto<>(citPreviewDataService.getCitPreviewEamDisposalDataList(citSalaryDataDto)); return new CamelPagingResultDto<>(citPreviewDataService.getCitPreviewEamDisposalDataList(citSalaryDataDto));
} }
//eam资产处置记录表导出
@RequestMapping(value = "exportDataEAM", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "exportDataEAM", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportDataEAM(@RequestBody CitEAMAssetsDisposal citEAMAssetsDisposal, HttpServletResponse response) { public void exportDataEAM(@RequestBody CitEAMAssetsDisposalDto citEAMAssetsDisposalDto, HttpServletResponse response) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd hh:MM:ss"); int count = citPreviewDataService.exportDataEAM(citEAMAssetsDisposalDto, response);
String format = simpleDateFormat.format(new Date()); if (count == 0) {
String fileName = "EAM资产处理金额记录表"+ format; response.setStatus(SC_NO_CONTENT);
int count = citPreviewDataService.exportDataEAM(citEAMAssetsDisposal, ResponseUtil.response(response, fileName)); } else {
response.setStatus(SC_OK);
}
}
//预提重分类数据源
@RequestMapping(value = "exportDataSalaryAdvance", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportDataSalaryAdvance(@RequestBody CitEAMAssetsDisposalDto citEAMAssetsDisposalDto, HttpServletResponse response) {
int count = citPreviewDataService.exportDataSalaryAdvance(citEAMAssetsDisposalDto, response);
if (count == 0) { if (count == 0) {
response.setStatus(SC_NO_CONTENT); response.setStatus(SC_NO_CONTENT);
} else { } else {
......
...@@ -14,4 +14,22 @@ public class CitEAMAssetsDisposalDto extends CitEAMAssetsDisposal { ...@@ -14,4 +14,22 @@ public class CitEAMAssetsDisposalDto extends CitEAMAssetsDisposal {
public void setPageInfo(CamelPagingDto pageInfo) { public void setPageInfo(CamelPagingDto pageInfo) {
this.pageInfo = pageInfo; this.pageInfo = pageInfo;
} }
private String periodStart;
private String periodEnd;
public String getPeriodStart() {
return periodStart;
}
public void setPeriodStart(String periodStart) {
this.periodStart = periodStart;
}
public String getPeriodEnd() {
return periodEnd;
}
public void setPeriodEnd(String periodEnd) {
this.periodEnd = periodEnd;
}
} }
...@@ -5,10 +5,13 @@ import com.github.pagehelper.PageHelper; ...@@ -5,10 +5,13 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.util.JxlsUtils;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.dao.CitEAMAssetsDisposalMapper; import pwc.taxtech.atms.dao.CitEAMAssetsDisposalMapper;
import pwc.taxtech.atms.dao.CitSalaryAdvanceMapper; import pwc.taxtech.atms.dao.CitSalaryAdvanceMapper;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto; import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
import pwc.taxtech.atms.dto.previewData.CitEAMAssetsDisposalDto; import pwc.taxtech.atms.dto.previewData.CitEAMAssetsDisposalDto;
import pwc.taxtech.atms.dto.previewData.CitEAMAssetsDisposalExport;
import pwc.taxtech.atms.dto.previewData.CitSalaryDataDto; import pwc.taxtech.atms.dto.previewData.CitSalaryDataDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam; import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam;
import pwc.taxtech.atms.dto.vatdto.dd.BalanceSheetDto; import pwc.taxtech.atms.dto.vatdto.dd.BalanceSheetDto;
...@@ -22,6 +25,9 @@ import pwc.taxtech.atms.vat.dpo.TrialBalanceCondition; ...@@ -22,6 +25,9 @@ import pwc.taxtech.atms.vat.dpo.TrialBalanceCondition;
import pwc.taxtech.atms.vat.entity.TrialBalance; import pwc.taxtech.atms.vat.entity.TrialBalance;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
...@@ -54,6 +60,40 @@ public class CitPreviewDataServiceImpl extends BaseService { ...@@ -54,6 +60,40 @@ public class CitPreviewDataServiceImpl extends BaseService {
public PageInfo<CitEAMAssetsDisposal> getCitPreviewEamDisposalDataList(CitEAMAssetsDisposalDto citEAMAssetsDisposalDto) { public PageInfo<CitEAMAssetsDisposal> getCitPreviewEamDisposalDataList(CitEAMAssetsDisposalDto citEAMAssetsDisposalDto) {
CitEAMAssetsDisposalExample example = new CitEAMAssetsDisposalExample(); CitEAMAssetsDisposalExample example = new CitEAMAssetsDisposalExample();
CitEAMAssetsDisposalExample.Criteria criteria = example.createCriteria(); CitEAMAssetsDisposalExample.Criteria criteria = example.createCriteria();
Integer periodStart = null;
Integer periodEnd = null;
if(citEAMAssetsDisposalDto.getPeriodStart() != null && !"".equals(citEAMAssetsDisposalDto.getPeriodStart())){
periodStart = Integer.parseInt(citEAMAssetsDisposalDto.getPeriodStart());
}
if(citEAMAssetsDisposalDto.getPeriodEnd() != null &&!"".equals(citEAMAssetsDisposalDto.getPeriodEnd())){
periodEnd = Integer.parseInt(citEAMAssetsDisposalDto.getPeriodEnd());
}
if(citEAMAssetsDisposalDto.getAssetLabelNumber() != null && !"".equals(citEAMAssetsDisposalDto.getAssetLabelNumber())){
criteria.andAssetLabelNumberEqualTo(citEAMAssetsDisposalDto.getAssetLabelNumber());
}
if(citEAMAssetsDisposalDto.getCompensationSaleAmount() != null && !"".equals(citEAMAssetsDisposalDto.getCompensationSaleAmount())){
criteria.andCompensationSaleAmountEqualTo(citEAMAssetsDisposalDto.getCompensationSaleAmount());
}
if(periodEnd != null && periodStart!= null){
criteria.andPeriodBetween(periodStart, periodEnd);
}
if(periodStart == null && periodEnd!= null){
criteria.andPeriodLessThanOrEqualTo(periodEnd);
}
if(periodStart != null && periodEnd == null ){
criteria.andPeriodGreaterThanOrEqualTo(periodStart);
}
/*if(citEAMAssetsDisposalDto.getOrganizationId() != null){
criteria.andOrganizationIdEqualTo(citEAMAssetsDisposalDto.getOrganizationId());
}
*/
if(citEAMAssetsDisposalDto.getPeriod() != null && !"".equals(citEAMAssetsDisposalDto.getPeriod())){
criteria.andPeriodEqualTo(citEAMAssetsDisposalDto.getPeriod());
}
Page page = PageHelper.startPage(citEAMAssetsDisposalDto.getPageInfo().getPageIndex(), citEAMAssetsDisposalDto.getPageInfo().getPageSize()); Page page = PageHelper.startPage(citEAMAssetsDisposalDto.getPageInfo().getPageIndex(), citEAMAssetsDisposalDto.getPageInfo().getPageSize());
List<CitEAMAssetsDisposal> citSalaryAdvances = citEAMAssetsDisposalMapper.selectByExample(example); List<CitEAMAssetsDisposal> citSalaryAdvances = citEAMAssetsDisposalMapper.selectByExample(example);
PageInfo<CitEAMAssetsDisposal> pageInfo =new PageInfo<CitEAMAssetsDisposal>(citSalaryAdvances); PageInfo<CitEAMAssetsDisposal> pageInfo =new PageInfo<CitEAMAssetsDisposal>(citSalaryAdvances);
...@@ -63,39 +103,81 @@ public class CitPreviewDataServiceImpl extends BaseService { ...@@ -63,39 +103,81 @@ public class CitPreviewDataServiceImpl extends BaseService {
private Map<String, String> generalEAMHeader() { private Map<String, String> generalEAMHeader() {
Map<String, String> header = new LinkedHashMap<>(); Map<String, String> header = new LinkedHashMap<>();
header.put("Date","数据日期"); /*header.put("Date","数据日期");*/
header.put("Source","来源"); header.put("Source","来源");
header.put("Period","期间"); header.put("Period","期间");
header.put("LedgerId","账套ID");
header.put("OccurPeriod","发生期间"); header.put("OccurPeriod","发生期间");
header.put("AssetLabelNumber","资产标签号"); header.put("AssetLabelNumber","资产标签号");
header.put("CompensationSaleAmount","赔偿/变卖金额"); header.put("CompensationSaleAmount","赔偿/变卖金额");
header.put("CreatedBy","主体性质"); header.put("CreatedBy","创建人");
return header; return header;
} }
public int exportDataEAM(CitEAMAssetsDisposal citEAMAssetsDisposal, ServletOutputStream response) { public int exportDataEAM(CitEAMAssetsDisposalDto citEAMAssetsDisposalDto, HttpServletResponse response) {
try { /* try {
CitEAMAssetsDisposalExample example = new CitEAMAssetsDisposalExample(); CitEAMAssetsDisposalExample example = new CitEAMAssetsDisposalExample();
List<CitEAMAssetsDisposal> list = citEAMAssetsDisposalMapper.selectByCondition(citEAMAssetsDisposal); List<CitEAMAssetsDisposal> list = citEAMAssetsDisposalMapper.selectByCondition(citEAMAssetsDisposalDto);
Map<String, String> header = generalEAMHeader(); Map<String, String> header = generalEAMHeader();
/*
TrialBalanceCondition condition = new TrialBalanceCondition(); List<CitEAMAssetsDisposalExport> cellList = new ArrayList<>();
beanUtil.copyProperties(param, condition); list.forEach(tb -> {
List<TrialBalance> trialBalances = trialBalanceMapper.selectByCondition(condition);*/ CitEAMAssetsDisposalExport d = new CitEAMAssetsDisposalExport();
/*
Map<String, String> header = generalTBHeader();
List<TrialBalanceExportDto> cellList = new ArrayList<>();
trialBalances.forEach(tb -> {
TrialBalanceExportDto d = new TrialBalanceExportDto();
d = beanUtil.copyProperties(tb, d); d = beanUtil.copyProperties(tb, d);
cellList.add(d); cellList.add(d);
});*/ });
ExcelUtil.exportExcel(header, list, response); ExcelUtil.exportExcel(header, cellList, response);
return list.size(); return list.size();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.error("EAM资产处理金额记录表: %s", e.getMessage()); logger.error("EAM资产处理金额记录表: %s", e.getMessage());
return 0; return 0;
}*/
//第二种导出方式
CitEAMAssetsDisposalExample example = new CitEAMAssetsDisposalExample();
List<CitEAMAssetsDisposal> list = citEAMAssetsDisposalMapper.selectByCondition(citEAMAssetsDisposalDto);
if(list.size()==0){
return 0;
}
String EXPORT_XLSX_CONFIG = Constant.exportTemplateUrl + "/eamDispoal.xlsx";
String EXPORT_XLSX_FILENAME = "资产处置金额";
ServletOutputStream out = null;
InputStream in = null;
try {
out = response.getOutputStream();
} catch (IOException e) {
e.printStackTrace();
}
JxlsUtils.toPackageOs(response, EXPORT_XLSX_FILENAME);
in = JxlsUtils.toPackageIn(EXPORT_XLSX_CONFIG);
JxlsUtils.exportExcel(list, out, in, null);
return 1;
}
public int exportDataSalaryAdvance(CitEAMAssetsDisposalDto citEAMAssetsDisposalDto, HttpServletResponse response) {
//第二种导出方式
CitEAMAssetsDisposalExample example = new CitEAMAssetsDisposalExample();
List<CitEAMAssetsDisposal> list = citEAMAssetsDisposalMapper.selectByCondition(citEAMAssetsDisposalDto);
if(list.size()==0){
return 0;
}
String EXPORT_XLSX_CONFIG = Constant.exportTemplateUrl + "/eamDispoal.xlsx";
String EXPORT_XLSX_FILENAME = "资产处置金额";
ServletOutputStream out = null;
InputStream in = null;
try {
out = response.getOutputStream();
} catch (IOException e) {
e.printStackTrace();
} }
JxlsUtils.toPackageOs(response, EXPORT_XLSX_FILENAME);
in = JxlsUtils.toPackageIn(EXPORT_XLSX_CONFIG);
JxlsUtils.exportExcel(list, out, in, null);
return 1;
} }
} }
...@@ -35,6 +35,7 @@ public class CitEAMAssetsDisposal extends BaseEntity implements Serializable { ...@@ -35,6 +35,7 @@ public class CitEAMAssetsDisposal extends BaseEntity implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
private String organizationId; private String organizationId;
/** /**
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
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.
--> -->
id, organization_id, project_id, period, source, occur_period, asset_label_number, id, organization_id, project_id, period, source, occur_period, asset_label_number,
compensation_sale_amount, created_by, updated_by, create_time, update_time compensation_sale_amount, created_by, updated_by, create_time, update_time
</sql> </sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.entity.CitEAMAssetsDisposalExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="pwc.taxtech.atms.entity.CitEAMAssetsDisposalExample" resultMap="BaseResultMap">
......
...@@ -3,16 +3,26 @@ ...@@ -3,16 +3,26 @@
<mapper namespace="pwc.taxtech.atms.dao.CitEAMAssetsDisposalMapper"> <mapper namespace="pwc.taxtech.atms.dao.CitEAMAssetsDisposalMapper">
<sql id="QueryCondition"> <sql id="QueryCondition">
1 = 1 1 = 1
<if test="@com.github.pagehelper.util.StringUtil@isNotEmpty(citEAMAssetsDisposal.period)"> <!-- <if test="@com.github.pagehelper.util.StringUtil@isNotEmpty(citEAMAssetsDisposal.period)">
AND period= #{citEAMAssetsDisposal.period,jdbcType=VARCHAR} AND period= #{citEAMAssetsDisposal.period,jdbcType=VARCHAR}
</if> </if>-->
<if test="citEAMAssetsDisposal.compensationSaleAmount!=null"> <if test="citEAMAssetsDisposal.compensationSaleAmount!=null and citEAMAssetsDisposal.compensationSaleAmount != '' ">
AND compensation_sale_amount &gt;= #{citEAMAssetsDisposal.compensationSaleAmount,jdbcType=INTEGER} AND compensation_sale_amount &gt;= #{citEAMAssetsDisposal.compensationSaleAmount,jdbcType=INTEGER}
</if> </if>
<if test="citEAMAssetsDisposal.assetLabelNumber!=null"> <if test="citEAMAssetsDisposal.assetLabelNumber!=null and citEAMAssetsDisposal.assetLabelNumber!='' ">
AND asset_label_number &lt;= #{citEAMAssetsDisposal.assetLabelNumber,jdbcType=INTEGER} AND asset_label_number &lt;= #{citEAMAssetsDisposal.assetLabelNumber,jdbcType=INTEGER}
</if> </if>
<if test="citEAMAssetsDisposal.periodStart!=null and citEAMAssetsDisposal.periodStart!= '' and citEAMAssetsDisposal.periodEnd!= null and citEAMAssetsDisposal.periodEnd!= ''">
AND period between ${citEAMAssetsDisposal.periodStart} and ${citEAMAssetsDisposal.periodEnd}
</if>
<if test="citEAMAssetsDisposal.periodStart == null and citEAMAssetsDisposal.periodStart != '' and citEAMAssetsDisposal.periodEnd != null and citEAMAssetsDisposal.periodEnd != ''">
AND period &lt; ${citEAMAssetsDisposal.periodEnd} or period = ${citEAMAssetsDisposal.periodEnd}
</if>
<if test="citEAMAssetsDisposal.periodStart != null and citEAMAssetsDisposal.periodStart != '' and citEAMAssetsDisposal.periodEnd == null and citEAMAssetsDisposal.periodEnd != '' ">
AND period &gt; ${citEAMAssetsDisposal.periodStart} or period = ${citEAMAssetsDisposal.periodStart}
</if>
</sql> </sql>
<insert id="insertBatch" parameterType="java.util.List"> <insert id="insertBatch" parameterType="java.util.List">
insert into cit_eam_assets_disposal insert into cit_eam_assets_disposal
(<include refid="Base_Column_List"/>) (<include refid="Base_Column_List"/>)
...@@ -72,8 +82,11 @@ ...@@ -72,8 +82,11 @@
SELECT 1 FROM DUAL; SELECT 1 FROM DUAL;
</insert> </insert>
<select id ="selectByCondition" parameterType="pwc.taxtech.atms.entity.CitEAMAssetsDisposal"> <select id ="selectByCondition" parameterType="pwc.taxtech.atms.entity.CitEAMAssetsDisposal" resultType="pwc.taxtech.atms.entity.CitEAMAssetsDisposal">
select * from cit_eam_assets_disposal select
id, organization_id as organizationId, project_id as projectId, period, source, occur_period as occurPeriod, asset_label_number as assetLabelNumber,
compensation_sale_amount as compensationSaleAmount, created_by as createBy, updated_by as updateBy, create_time as createTime, update_time as updateTime
from cit_eam_assets_disposal
WHERE WHERE
<include refid="QueryCondition"/> <include refid="QueryCondition"/>
</select> </select>
......
citModule.controller('citPreviewEamDisposalController', ['$scope', '$log', '$translate', '$timeout', '$compile', '$uibModal', 'apiInterceptor', citModule.controller('citPreviewEamDisposalController', ['$scope', '$log', '$translate', '$timeout', '$compile', '$uibModal', 'apiInterceptor',
'SweetAlert', '$q', 'uiGridConstants', '$interval', 'vatSessionService', 'citSessionService', 'vatImportService', 'loginContext', 'SweetAlert', '$q', 'uiGridConstants', '$interval', 'vatSessionService', 'citSessionService', 'vatImportService', 'loginContext',
'browserService', 'enums', 'vatOperationLogService', 'citPreviewDataService', 'vatCommonService', 'ackMessageBox','commonWebService', 'browserService', 'enums', 'vatOperationLogService', 'citPreviewDataService', 'vatCommonService', 'ackMessageBox','commonWebService','vatExportService',
function ($scope, $log, $translate, $timeout, $compile, $uibModal, apiInterceptor, SweetAlert, $q, uiGridConstants, function ($scope, $log, $translate, $timeout, $compile, $uibModal, apiInterceptor, SweetAlert, $q, uiGridConstants,
$interval, vatSessionService, citSessionService, vatImportService, loginContext, browserService, enums, vatOperationLogService, citPreviewDataService, $interval, vatSessionService, citSessionService, vatImportService, loginContext, browserService, enums, vatOperationLogService, citPreviewDataService,
vatCommonService, ackMessageBox, commonWebService) { vatCommonService, ackMessageBox, commonWebService, vatExportService) {
'use strict'; 'use strict';
$scope.listData = []; $scope.listData = [];
var minDate = [1, vatSessionService.project.year]; var minDate = [1, 2010];
// var minDate = moment().startOf('month').subtract(0, 'months'); // var minDate = moment().startOf('month').subtract(0, 'months');
var maxDate = [12, vatSessionService.project.year]; var maxDate = [12, 2019];
var setDate = [ var setDate = [[1, 2010], [12, 2019]];
[vatSessionService.month, vatSessionService.project.year],
[vatSessionService.month, vatSessionService.project.year]];
$scope.monthList = [$translate.instant('Month01'), $scope.monthList = [$translate.instant('Month01'),
$translate.instant('Month02'), $translate.instant('Month02'),
$translate.instant('Month03'), $translate.instant('Month03'),
...@@ -111,12 +108,12 @@ ...@@ -111,12 +108,12 @@
//导出数据 //导出数据
$scope.downloadTB = function () { $scope.downloadTB = function () {
citPreviewDataService.exportData($scope.queryParams).success(function (data, status, headers) { citPreviewDataService.exportData( $scope.queryParams).success(function (data, status, headers) {
if(status===204){ if(status===204){
SweetAlert.warning("没有数据可以下载"); SweetAlert.warning("没有数据可以下载");
return; return;
} }
vatExportService.exportToExcel(data, status, headers, 'EAM资产处置金额记录表.xls'); vatExportService.exportToExcel(data, status, headers, 'EAM资产处置金额记录表.xlsx', true);
}).error(function (error) { }).error(function (error) {
SweetAlert.error($translate.instant('PleaseContactAdministrator')); SweetAlert.error($translate.instant('PleaseContactAdministrator'));
}); });
...@@ -124,9 +121,10 @@ ...@@ -124,9 +121,10 @@
$scope.doDataReset = function () { $scope.doDataReset = function () {
$scope.queryParams.period = ""; $scope.queryParams.period = null;
$scope.queryParams.compensationSaleAmount = ""; $scope.queryParams.compensationSaleAmount = null;
$scope.queryParams.assetLabelNumber = ""; $scope.queryParams.assetLabelNumber = null;
$scope.refreshConfigGrid();
} }
$scope.doSearch = function () { $scope.doSearch = function () {
$scope.refreshConfigGrid(); $scope.refreshConfigGrid();
...@@ -173,7 +171,26 @@ ...@@ -173,7 +171,26 @@
months: $scope.monthList,//['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], months: $scope.monthList,//['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
ConfirmBtnText: $translate.instant('Confirm'), ConfirmBtnText: $translate.instant('Confirm'),
CancelBtnText: $translate.instant('ButtonCancel') CancelBtnText: $translate.instant('ButtonCancel')
}) }) .on('datePicker.done', function (e, result) {
//对日期进行封装
var start = result[0][1].toString() + result[0][0];
var end =result[1][1].toString() + result[1][0];
commonWebService._dateByPicker(start, end);//转换日期
//开始月份
$scope.queryParams.periodStart = commonWebService._dateByPicker(start, end).start;
//结束月份
$scope.queryParams.periodEnd = commonWebService._dateByPicker(start, end).end;
/* $scope.startMonth = startMonth;
$scope.endMonth = endMonth;*/
/*$scope.queryParams.periodStart = vatSessionService.year * 100 + vatSessionService.month;
$scope.queryParams.periodEnd = vatSessionService.year * 100 + vatSessionService.month;*/
// countTotal();
//$scope.queryParams.organizationId = vatSessionService.project.organizationID;
alert($scope.queryParams.periodStart + "---------------"+ $scope.queryParams.periodEnd);
$scope.refreshConfigGrid();
// loadCertifiedInvoicesListDataFromDB(1);
});
$scope.queryParams = {}; $scope.queryParams = {};
//分页的设置 //分页的设置
......
...@@ -11,87 +11,14 @@ ...@@ -11,87 +11,14 @@
<span translate="EAMDisposal" class="text-bold"></span> &nbsp;&nbsp;|&nbsp;&nbsp;<span class="text-bold" translate="InvoiceQJ"></span> <span translate="EAMDisposal" class="text-bold"></span> &nbsp;&nbsp;|&nbsp;&nbsp;<span class="text-bold" translate="InvoiceQJ"></span>
<input type="text" class="form-control input-width-middle periodInput" style="position: relative; top: -30px; left: 180px; width: 200px;" id="input-invoice-period-picker" /> <input type="text" class="form-control input-width-middle periodInput" style="position: relative; top: -30px; left: 180px; width: 200px;" id="input-invoice-period-picker" />
<span ng-click="downloadTB()" style="position: relative; top: -61px; left: 95%;"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'ExportBtn' | translate}}</span> <span ng-click="downloadTB()" style="position: relative; top: -61px; left: 95%;"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'ExportBtn' | translate}}</span>
</div>
<!-- <div class="widget-container">
<div>查询条件:</div>
<div id="form" dx-form="formOptions"></div>
</div>-->
<div class="dt-init-wrapper">
<div id="gridContainer" dx-data-grid="assetsResultGridOptions"></div> <div class="dt-init-wrapper" style=" position: relative; top: -41px;">
<div class="page-footer"> <div id="gridContainer" dx-data-grid="assetsResultGridOptions"></div>
<ack-pagination page-options="queryParams.pagingOptions" <div class="page-footer">
refresh-table="refreshConfigGrid()"></ack-pagination> <ack-pagination page-options="queryParams.pagingOptions"
</div> refresh-table="refreshConfigGrid()"></ack-pagination>
</div>
<!-- <div class="error-list-modal">
<div class="modal fade" id="errorListModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width: 720px; height: 200px;" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">
{{'ImportErrorPopUpTitle' | translate}}
</div>
</div>
<div class="modal-body">
{{'ImportErrorPopUpErrorDetail' | translate}}:
<br/>
<table>
<thead>
<tr>
<th width="10%" style="text-align:center;">{{'ImportErrorPopUpNoCol' | translate}}</th>
<th width="20%">{{'ImportErrorPopUpErrorTypeCol' | translate}}</th>
<th width="10%" style="text-align:center;">{{'ImportErrorPopUpErrorCountCol' |
translate}}
</th>
<th width="60%">{{'ImportErrorPopUpErrorDescCol' | translate}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="error in errorMsgMap track by $index">
<td width="10%" style="text-align:center;">{{$index + 1}}</td>
<td width="20%">{{error.errorType}}</td>
<td width="10%" style="text-align:center;">{{error.errorCount}}</td>
<td width="60%" ng-bind-html="error.errorContent"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" translate="Confirm" data-dismiss="modal"></button>
</div>
</div>
</div> </div>
</div> </div>
</div>--> </div>
<!--资产分类设置界面-->
<!--<script type="text/ng-template" id="set-asset-group-modal.html">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">
{{'SetAssetGroup' | translate}}
</div>
</div>
<div class="modal-body">
<div class="grid-container">
<div id="assetsGroupGrid" dx-data-grid="assetsGridOptions"
style="max-width: 760px; margin-top: -40px;">
</div>
</div>
</div>
<div class="modal-footer">
<button style="margin-left: 22px;" type="button" class="btn btn-primary" ng-click="saveAssetGroupInfo()"
ng-disabled="!hasEditPermission">{{'Confirm' | translate }}
</button>
<button type="button" class="btn btn-third" ng-click="cancelAsset()" ng-if="!isDisabled"
ng-disabled="isDisabled">{{'ButtonCancel' | translate }}
</button>
</div>
</div>
</script>-->
<vat-operate-log period="period" module-type="moduleid" is-show="isShowLog"></vat-operate-log> <vat-operate-log period="period" module-type="moduleid" is-show="isShowLog"></vat-operate-log>
</div> </div>
\ No newline at end of file
...@@ -7,31 +7,6 @@ ...@@ -7,31 +7,6 @@
'use strict'; 'use strict';
$scope.listData = []; $scope.listData = [];
/* $scope.formOptions = {
formData: salaryData,
colCount: 2,
items: [{
dataField: "FirstName",
editorOptions: {
value: ""
}
},
{
itemType: "button",
horizontalAlignment: "left",
buttonOptions: {
text: "查询",
type: "success",
useSubmitBehavior: true
}
}]
};*/
/* $scope.onFormSubmit = function(e) {//执行查询
e.preventDefault();
};*/
//初始化dx控件 //初始化dx控件
function initAssetResultDxGrid() { function initAssetResultDxGrid() {
var dupColumns = [ var dupColumns = [
...@@ -91,6 +66,30 @@ ...@@ -91,6 +66,30 @@
} }
} }
//导出数据
$scope.downloadTB = function () {
citPreviewDataService.exportData( $scope.queryParams).success(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '预提重分类数据源.xlsx', true);
}).error(function (error) {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
}
$scope.doDataReset = function () {
$scope.queryParams.period = null;
$scope.queryParams.compensationSaleAmount = null;
$scope.queryParams.assetLabelNumber = null;
$scope.refreshConfigGrid();
}
$scope.doSearch = function () {
$scope.refreshConfigGrid();
}
var initListData = function(){ var initListData = function(){
citPreviewDataService.getCitPreviewSalaryAdvanceDataList($scope).success(function (res) { citPreviewDataService.getCitPreviewSalaryAdvanceDataList($scope).success(function (res) {
......
<div class="cit-import-asset-list"> <div class="cit-import-asset-list">
<div class="nav-wrapper"> <div class="top-area-wrapper" style="margin-top: 10px">
<div class="nav-header">{{'citSalaryAdvance' | translate}}</div> <button class="filter-button"
</div> atms-popover ng-mouseenter="prepareSummary()" ng-click="showPopover()"
<!-- <div class="widget-container"> popover-container="body" popover-auto-hide="true" data-overwrite="true"
<div>查询条件:</div> use-optimized-placement-algorithm="true"
<div id="form" dx-form="formOptions"></div> data-placement="bottom"
</div>--> data-templateurl="app/cit/preview/cit-preview-salaryAdvance-list/vat-preview-salaryAdvance-search.html">
<i class="fa fa-filter" aria-hidden="true"></i>
</button>
<!--<span translate="EAMDisposal" class="text-bold"></span> &nbsp;&nbsp;|&nbsp;&nbsp;<span class="text-bold" translate="InvoiceQJ"></span>:-->
<!--<input type="text" class="form-control input-width-middle periodInput" style="position: relative; top: -30px; left: 180px; width: 200px;" id="input-invoice-period-picker" />-->
<span ng-click="downloadTB()" style="position: relative; top: -61px; left: 95%;"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'ExportBtn' | translate}}</span>
<div class="dx-viewport grid-container">
<div class="dx-viewport grid-container" style=" position: relative; top: -41px;">
<div id="gridContainer" dx-data-grid="assetsResultGridOptions"></div> <div id="gridContainer" dx-data-grid="assetsResultGridOptions"></div>
<div class="page-footer"> <div class="page-footer">
<ack-pagination page-options="pagingOptions" <ack-pagination page-options="pagingOptions"
refresh-table="refreshConfigGrid()"></ack-pagination> refresh-table="refreshConfigGrid()"></ack-pagination>
</div> </div>
</div> </div>
<!-- <div class="error-list-modal"> </div>
<div class="modal fade" id="errorListModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width: 720px; height: 200px;" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">
{{'ImportErrorPopUpTitle' | translate}}
</div>
</div>
<div class="modal-body">
{{'ImportErrorPopUpErrorDetail' | translate}}:
<br/>
<table>
<thead>
<tr>
<th width="10%" style="text-align:center;">{{'ImportErrorPopUpNoCol' | translate}}</th>
<th width="20%">{{'ImportErrorPopUpErrorTypeCol' | translate}}</th>
<th width="10%" style="text-align:center;">{{'ImportErrorPopUpErrorCountCol' |
translate}}
</th>
<th width="60%">{{'ImportErrorPopUpErrorDescCol' | translate}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="error in errorMsgMap track by $index">
<td width="10%" style="text-align:center;">{{$index + 1}}</td>
<td width="20%">{{error.errorType}}</td>
<td width="10%" style="text-align:center;">{{error.errorCount}}</td>
<td width="60%" ng-bind-html="error.errorContent"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" translate="Confirm" data-dismiss="modal"></button>
</div>
</div>
</div>
</div>
</div>-->
<!--资产分类设置界面-->
<!--<script type="text/ng-template" id="set-asset-group-modal.html">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">
{{'SetAssetGroup' | translate}}
</div>
</div>
<div class="modal-body">
<div class="grid-container">
<div id="assetsGroupGrid" dx-data-grid="assetsGridOptions"
style="max-width: 760px; margin-top: -40px;">
</div>
</div>
</div>
<div class="modal-footer">
<button style="margin-left: 22px;" type="button" class="btn btn-primary" ng-click="saveAssetGroupInfo()"
ng-disabled="!hasEditPermission">{{'Confirm' | translate }}
</button>
<button type="button" class="btn btn-third" ng-click="cancelAsset()" ng-if="!isDisabled"
ng-disabled="isDisabled">{{'ButtonCancel' | translate }}
</button>
</div>
</div>
</script>-->
<vat-operate-log period="period" module-type="moduleid" is-show="isShowLog"></vat-operate-log> <vat-operate-log period="period" module-type="moduleid" is-show="isShowLog"></vat-operate-log>
</div> </div>
\ No newline at end of file
<div class="popover">
<div class="arrow"></div>
<div class="popover-content">
<div>
<table class="table table-responsive">
<tr>
<td>
<span translate="period"></span>
<input class="form-control input-width-middle" placeholder="{{'period' | translate}}" type="text" id="segment3" ng-model="queryParams.period" />
</td>
</tr>
<tr>
<td>
<span translate="compensationSaleAmount"></span>
<input class="form-control input-width-middle" type="text" placeholder="{{'poSubjectName' | translate}}"id="segment3Name" ng-model="queryParams.poSubjectName" />
</td>
</tr>
</table>
</div>
<div class="row">
<div style="float:right;margin-right:10px;">
<button class="btn btn-default btn-primary" ng-click="doSearch()">
<span class="fa fa-chevron-down" aria-hidden="true"> </span> <span translate="Confirm"></span>
</button>
<button class="btn btn-default margin-right10" ng-click="doDataReset()">
<span class="fa fa-times" aria-hidden="true"> </span> <span translate="Reset"></span>
</button>
</div>
</div>
</div>
</div>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
$log.debug('vatExportService.ctor()...'); $log.debug('vatExportService.ctor()...');
//下载服务器上的xls文件 //下载服务器上的xls文件
var exportToExcel = function (data, status, headers, defaultFileName) { var exportToExcel = function (data, status, headers, defaultFileName, noExtendFileName) {
$('#busy-indicator-container').show(); $('#busy-indicator-container').show();
...@@ -15,7 +15,13 @@ ...@@ -15,7 +15,13 @@
headers = headers(); headers = headers();
// Get the filename from the x-filename header or default to "download.bin" // Get the filename from the x-filename header or default to "download.bin"
var filename = decodeURI(headers['x-file-name']) + defaultFileName; var filename = null;
if(noExtendFileName){
filename = defaultFileName
}else{
filename = decodeURI(headers['x-file-name']) + defaultFileName
}
// Determine the content type from the header or default to "application/octet-stream" // Determine the content type from the header or default to "application/octet-stream"
var contentType = headers['content-type'] || octetStreamMime; var contentType = headers['content-type'] || octetStreamMime;
......
...@@ -7,10 +7,13 @@ webservices.factory('citPreviewDataService', ['$http', 'apiConfig', function ($h ...@@ -7,10 +7,13 @@ webservices.factory('citPreviewDataService', ['$http', 'apiConfig', function ($h
return $http.post('/citPreviewDataController/getSalaryAdvaceListData', {pageInfo: params.pagingOptions, poSubjectName : params.poSubjectName }, apiConfig.createVat()); return $http.post('/citPreviewDataController/getSalaryAdvaceListData', {pageInfo: params.pagingOptions, poSubjectName : params.poSubjectName }, apiConfig.createVat());
}, },
getCitPreviewEamDisposalDataList : function (params) { getCitPreviewEamDisposalDataList : function (params) {
return $http.post('/citPreviewDataController/getCitPreviewEamDisposalDataList', {pageInfo: params.pagingOptions}, apiConfig.createVat()); return $http.post('/citPreviewDataController/getCitPreviewEamDisposalDataList', {pageInfo : params.pagingOptions, periodStart : params.periodStart, periodEnd : params.periodEnd, organizationId : params.organizationId, period : params.period, compensationSaleAmount: params.compensationSaleAmount, assetLabelNumber : params.assetLabelNumber}, apiConfig.createVat());
}, },
exportData: function (params) { exportData: function (params) {
return $http.post('/citPreviewDataController/exportDataEAM', params, apiConfig.create({ responseType: 'arraybuffer' })); return $http.post('/citPreviewDataController/exportDataEAM', params, apiConfig.create({ responseType: 'arraybuffer' }));
},
exportDataSalaryAdvance : function (params) {
return $http.post('/citPreviewDataController/exportDataSalaryAdvance', params, apiConfig.create({ responseType: 'arraybuffer' }));
} }
}; };
}]); }]);
\ No newline at end of file
...@@ -359,10 +359,32 @@ webservices.factory('commonWebService', ['$http', 'apiConfig', 'loginContext', ' ...@@ -359,10 +359,32 @@ webservices.factory('commonWebService', ['$http', 'apiConfig', 'loginContext', '
_index :function (data) { _index :function (data) {
var index = 1; var index = 1;
for(var i in data){ for(var i in data){
i.index = index; data[i].index = index;
index++; index++;
} }
return data; return data;
},
_dateByPicker : function (start, end) {
if(end){
var _sp = end.toString().slice(4);
if(_sp.length != 2){
_sp = "0" + _sp;
};
end = end.toString().substring(0, 4) +_sp;
}
if(start){
var _sp = start.toString().slice(4);
if(start.length != 2){
_sp = "0" + _sp;
};
start = start.toString().substring(0, 4) +_sp;
}
return {
start : start,
end : end
}
} }
}; };
}]); }]);
\ No newline at end of file
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