Commit 46cc61a9 authored by kevin's avatar kevin

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents 4682980b 40a16a73
......@@ -15,6 +15,7 @@ import pwc.taxtech.atms.entity.OperationLogFileType;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 查询
......@@ -99,7 +100,7 @@ public class FileTypesServiceImpl {
criteria.andFileTypeEqualTo(fileTypes.getFileType());
}
List<FileTypes> results = fileTypesMapper.selectByExample(example);
if (results.size() > 0) {
if (results.size() > 0 && !results.stream().map(e->e.getId()).collect(Collectors.toList()).contains(fileTypes.getId())) {
throw new RuntimeException("filetype已存在: " + fileTypes.getFileType());
}
}
......@@ -129,30 +130,25 @@ public class FileTypesServiceImpl {
@Transactional
public boolean editFilesType(FileTypes fileTypes) {
try {
//检测添加类型是否已存在,存在则返回false先(后期改进为多异常)
checkFileType(fileTypes);
//对必填字段进行转换成json对象
requiredFieldFormatToJson(fileTypes);
fileTypes.setUpdateTime(new Date());
int num = fileTypesMapper.updateByPrimaryKey(fileTypes);
if (num > 0) {
OperationLogFileType actionEntity = buildOperationLogFileType();
actionEntity.setOperationAction("更新");
actionEntity.setId(fileTypes.getId().toString());
//设置更新值
actionEntity.setUpdateState(fileTypes.toString());
boolean result = operationLogFileTypeService.addFileTypesList(actionEntity);
if (result) {
return true;
} else {
throw new RuntimeException("FileTypesServiceImpl editFilesType log error");
}
//检测添加类型是否已存在,存在则返回false先(后期改进为多异常)
checkFileType(fileTypes);
//对必填字段进行转换成json对象
requiredFieldFormatToJson(fileTypes);
fileTypes.setUpdateTime(new Date());
int num = fileTypesMapper.updateByPrimaryKey(fileTypes);
if (num > 0) {
OperationLogFileType actionEntity = buildOperationLogFileType();
actionEntity.setOperationAction("更新");
actionEntity.setId(fileTypes.getId().toString());
//设置更新值
actionEntity.setUpdateState(fileTypes.toString());
boolean result = operationLogFileTypeService.addFileTypesList(actionEntity);
if (result) {
return true;
} else {
return false;
throw new RuntimeException("FileTypesServiceImpl editFilesType log error");
}
} catch (Exception e) {
log.error("FileTypesServiceImpl editFilesType error : " + e.getMessage());
} else {
return false;
}
}
......
......@@ -129,6 +129,10 @@ public class TaxDocumentServiceImpl {
criteria.andBusinessLineEqualTo(taxDocumentDto.getBusinessLine());
}
//公司名称 companyName
if (StringUtils.isNotBlank(taxDocumentDto.getCompanyId())) {
criteria.andCompanyIdEqualTo(taxDocumentDto.getCompanyId());
}
//公司名称 companyName
if (StringUtils.isNotBlank(taxDocumentDto.getCompanyName())) {
criteria.andCompanyNameEqualTo(taxDocumentDto.getCompanyName());
}
......@@ -741,13 +745,6 @@ public class TaxDocumentServiceImpl {
*/
//档案类型分组:公司簡稱_档案类型_文件生效日期
private final static Map<String, String> groupOfCompanyFileTypeFIleTime = Maps.newHashMap();
//档案类型分组:公司簡稱_档案类型_到期日
private final static Map<String, String> groupOfCompanyFileTypeEffectiveTime = Maps.newHashMap();
//档案类型分组:公司簡稱_档案属性_档案类型(国际档案类型,因为此处英文有重复键,所以多个分组)
private final static Map<String, String> internationalGroupOfCompanyFileAttrFileType1 = Maps.newHashMap();
private final static Map<String, String> internationalGroupOfCompanyFileAttrFileType2 = Maps.newHashMap();
private final static Map<String, String> internationalGroupOfCompanyFileAttrFileType3 = Maps.newHashMap();
private final static Map<String, String> internationalGroupOfCompanyFileAttrFileType4 = Maps.newHashMap();
/**
* 分组 长度为4
*/
......@@ -755,6 +752,8 @@ public class TaxDocumentServiceImpl {
private final static Map<String, String> groupOfCompanyFileTypeOwnTimeFileTime = Maps.newHashMap();
//档案类型分组:公司簡稱_档案类型_所属期间_到期日
private final static Map<String, String> groupOfCompanyFileTypeOwnTimeEffectiveTime = Maps.newHashMap();
//档案类型分组:公司簡稱_档案属性_档案类型_文件生效日期
private final static Map<String, String> internationalGroupOfCompanyFileAttrFileTypeFileTime = Maps.newHashMap();
//档案类型分组:公司簡稱_档案属性_档案类型_所属期间(国际档案类型)
private final static Map<String, String> internationalGroupOfCompanyFileAttrFileTypeOwnTime = Maps.newHashMap();
/**
......@@ -773,12 +772,10 @@ public class TaxDocumentServiceImpl {
//初始化档案类型-档案属性map列表(后续可做成从数据库中拿)
static {
//添加分组
//公司簡稱_档案类型_文件生效日期
//公司簡稱_档案类型_文件生效日期
setGroupOfCompanyFileTypeFIleTime();
//公司簡稱_档案类型_到期日
setGroupOfCompanyFileTypeEffectiveTime();
//公司簡稱_档案属性_档案类型
setInternationalGroupOfCompanyFileAttrFileType();
//公司簡稱_档案属性_档案类型_文件生效日期
setInternationalGroupOfCompanyFileAttrFileTypeFileTime();
//公司簡稱_档案类型_所属期间_文件生效日期
setGroupOfCompanyFileTypeOwnTimeFileTime();
//公司簡稱_档案类型_所属期间_到期日
......@@ -811,48 +808,38 @@ public class TaxDocumentServiceImpl {
groupOfCompanyFileTypeFIleTime.put("发票核销资料", "06 发票管理类");
groupOfCompanyFileTypeFIleTime.put("开具红字发票资料", "06 发票管理类");
groupOfCompanyFileTypeFIleTime.put("非居民享受税收协定待遇认定", "02 税务认定类");
groupOfCompanyFileTypeFIleTime.put("汇总(合并)纳税企业信息备案资料", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("发票票种核定资料", "06 发票管理类");
groupOfCompanyFileTypeFIleTime.put("发票用票量调整资料", "06 发票管理类");
groupOfCompanyFileTypeFIleTime.put("增值税税收优惠资料", "03 税收优惠类");
groupOfCompanyFileTypeFIleTime.put("车辆购置税税收优惠资料", "03 税收优惠类");
groupOfCompanyFileTypeFIleTime.put("企业所得税税收优惠资料", "03 税收优惠类");
groupOfCompanyFileTypeFIleTime.put("税收减免审批资料", "03 税收优惠类");
groupOfCompanyFileTypeFIleTime.put("税收减免备案资料", "03 税收优惠类");
groupOfCompanyFileTypeFIleTime.put("纳税申报方式认定", "02 税务认定类");
groupOfCompanyFileTypeFIleTime.put("一般纳税人认定", "02 税务认定类");
groupOfCompanyFileTypeFIleTime.put("征收方式认定", "02 税务认定类");
groupOfCompanyFileTypeFIleTime.put("税种核定资料", "04 申报征收类");
}
/**
* 公司簡稱_档案类型_到期日
*/
private static void setGroupOfCompanyFileTypeEffectiveTime() {
groupOfCompanyFileTypeEffectiveTime.put("汇总(合并)纳税企业信息备案资料", "01 税务登记类");
groupOfCompanyFileTypeEffectiveTime.put("发票票种核定资料", "06 发票管理类");
groupOfCompanyFileTypeEffectiveTime.put("发票用票量调整资料", "06 发票管理类");
groupOfCompanyFileTypeEffectiveTime.put("增值税税收优惠资料", "03 税收优惠类");
groupOfCompanyFileTypeEffectiveTime.put("车辆购置税税收优惠资料", "03 税收优惠类");
groupOfCompanyFileTypeEffectiveTime.put("企业所得税税收优惠资料", "03 税收优惠类");
groupOfCompanyFileTypeEffectiveTime.put("税收减免审批资料", "03 税收优惠类");
groupOfCompanyFileTypeEffectiveTime.put("税收减免备案资料", "03 税收优惠类");
groupOfCompanyFileTypeEffectiveTime.put("纳税申报方式认定", "02 税务认定类");
groupOfCompanyFileTypeEffectiveTime.put("一般纳税人认定", "02 税务认定类");
groupOfCompanyFileTypeEffectiveTime.put("征收方式认定", "02 税务认定类");
groupOfCompanyFileTypeEffectiveTime.put("税种核定资料", "04 申报征收类");
}
/**
* 公司簡稱_档案属性_档案类型(因为此处英文有重复键,所以多个分组)
* 公司簡稱_档案属性_档案类型_文件生效日期
*/
private static void setInternationalGroupOfCompanyFileAttrFileType() {
//因为此处英文有重复键,所以多个分组区分开
internationalGroupOfCompanyFileAttrFileType1.put("Other", "International Tax - Legal Document");
internationalGroupOfCompanyFileAttrFileType1.put("Application documents", "International tax - Tax Rulings");
internationalGroupOfCompanyFileAttrFileType1.put("Approval documents", "International tax - Tax Incentives");
internationalGroupOfCompanyFileAttrFileType1.put("Article of incorporation", "International Tax - Legal Document");
internationalGroupOfCompanyFileAttrFileType1.put("Business registration", "International Tax - Legal Document");
internationalGroupOfCompanyFileAttrFileType1.put("CIT", "International Tax - Tax Registration");
internationalGroupOfCompanyFileAttrFileType1.put("VAT", "International Tax - Tax Registration");
internationalGroupOfCompanyFileAttrFileType1.put("Letter from Tax Authority", "International Tax - Tax Inspection");
internationalGroupOfCompanyFileAttrFileType1.put("Reply letter and supporting", "International Tax - Tax Inspection");
internationalGroupOfCompanyFileAttrFileType2.put("Other", "International Tax - Tax Registration");
internationalGroupOfCompanyFileAttrFileType2.put("Application documents", "International tax - Tax Incentives");
internationalGroupOfCompanyFileAttrFileType2.put("Approval documents", "International tax - Tax Rulings");
internationalGroupOfCompanyFileAttrFileType3.put("Other", "International tax - Tax Incentives");
internationalGroupOfCompanyFileAttrFileType4.put("Other", "International Tax - Tax Inspection");
private static void setInternationalGroupOfCompanyFileAttrFileTypeFileTime() {
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Legal Document - Other", "International Tax - Legal Document");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Ruling Application documents", "International tax - Tax Rulings");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Incentive Approval documents", "International tax - Tax Incentives");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Article of incorporation", "International Tax - Legal Document");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Business registration", "International Tax - Legal Document");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("CIT", "International Tax - Tax Registration");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("VAT", "International Tax - Tax Registration");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Letter from Tax Authority", "International Tax - Tax Inspection");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Reply letter and supporting", "International Tax - Tax Inspection");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Tax Registration - Other", "International Tax - Tax Registration");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Incentive Application documents", "International tax - Tax Incentives");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Ruling Approval documents", "International tax - Tax Rulings");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Tax Incentives - Other", "International tax - Tax Incentives");
internationalGroupOfCompanyFileAttrFileTypeFileTime.put("Tax Inspection - Other", "International Tax - Tax Inspection");
}
/**
......@@ -967,107 +954,87 @@ public class TaxDocumentServiceImpl {
*/
private void matchFileTypeToInitData(ArrayList<String> errorFileNameList, ArrayList<String> successeFileNameList, ArrayList<String> existedFileNameList, Map<String, String> companyNameAndId, File file, List<String> params, String filePath) {
//长度为3(先验证是否国际类型并校验匹配,若是国际类型档案类型索引为2(国际类型第三个为档案类型),否则索引为1为档案类型
if (params.size() == 3
&& (//国际类型 公司簡稱_档案属性_档案类型
(internationalGroupOfCompanyFileAttrFileType1.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileType1.values().contains(params.get(1)))
||
(internationalGroupOfCompanyFileAttrFileType2.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileType2.values().contains(params.get(1)))
||
(internationalGroupOfCompanyFileAttrFileType3.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileType3.values().contains(params.get(1)))
||
(internationalGroupOfCompanyFileAttrFileType4.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileType4.values().contains(params.get(1))))) {
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案属性 档案类型
taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else if (params.size() == 3//公司簡稱_档案类型_文件生效日期
if (params.size() == 3//公司簡稱_档案类型_文件生效日期
&& groupOfCompanyFileTypeFIleTime.keySet().contains(params.get(1))
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(2))) {//文件生效日期校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(2))){//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,file.getName());
//设置档案属性 档案类型 文件生效日期
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeFIleTime.get(params.get(1)));
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(2)));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else if (params.size() == 3//公司簡稱_档案类型_到期日
&& groupOfCompanyFileTypeEffectiveTime.keySet().contains(params.get(1))
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(2))) {//到期日校验
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument,filePath);
}else if (params.size() == 4 //国际类型 公司簡稱_档案属性_档案类型_文件生效日期
&& (internationalGroupOfCompanyFileAttrFileTypeFileTime.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileTypeFileTime.values().contains(params.get(1)))
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案属性 档案类型 到期日
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeEffectiveTime.get(params.get(1)));
taxDocument.setEffectiveTime(DateUtils.stringToDate4yyyyMMdd(params.get(2)));
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,file.getName());
//设置档案属性 档案类型
taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else if (params.size() == 4 //国际类型 公司簡稱_档案属性_档案类型_所属期间
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument,filePath);
}else if (params.size() == 4 //国际类型 公司簡稱_档案属性_档案类型_所属期间
&& (internationalGroupOfCompanyFileAttrFileTypeOwnTime.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileTypeOwnTime.values().contains(params.get(1)))
&& checkOwnTime(params.get(3))) {//所属期间校验
&& checkOwnTime(params.get(3))){//所属期间校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,file.getName());
//设置档案属性 档案类型 所属期间
taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2));
taxDocument.setOwnTime(Integer.valueOf(params.get(3)));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else if (params.size() == 4 //公司簡稱_档案类型_所属期间_文件生效日期
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument,filePath);
}else if (params.size() == 4 //公司簡稱_档案类型_所属期间_文件生效日期
&& groupOfCompanyFileTypeOwnTimeFileTime.keySet().contains(params.get(1))
&& checkOwnTime(params.get(2))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))) {//文件生效日期校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,file.getName());
//设置档案类型 档案属性 所属期间 文件生效日期
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeFileTime.get(params.get(1)));
taxDocument.setOwnTime(Integer.valueOf(params.get(2)));
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(3)));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else if (params.size() == 4 //公司簡稱_档案类型_所属期间_到期日
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument,filePath);
}else if (params.size() == 4 //公司簡稱_档案类型_所属期间_到期日
&& groupOfCompanyFileTypeOwnTimeEffectiveTime.keySet().contains(params.get(1))
&& checkOwnTime(params.get(2))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))) {//到期日校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//到期日校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,file.getName());
//设置档案类型 档案属性 所属期间 到期日
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeEffectiveTime.get(params.get(1)));
taxDocument.setOwnTime(Integer.valueOf(params.get(2)));
taxDocument.setEffectiveTime(DateUtils.stringToDate4yyyyMMdd(params.get(3)));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else if (params.size() == 5 //国际类型 公司簡稱_档案属性_档案类型_税种_所属期间
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument,filePath);
}else if (params.size() == 5 //国际类型 公司簡稱_档案属性_档案类型_税种_所属期间
&& (internationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime.values().contains(params.get(1)))
&& taxsList.contains(params.get(3))//税种校验
&& checkOwnTime(params.get(4))) {//所属期间校验
&& checkOwnTime(params.get(4))){//所属期间校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,file.getName());
//设置档案属性 档案类型 税种 所属期间
taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2));
taxDocument.setTaxType(params.get(3));
taxDocument.setOwnTime(Integer.valueOf(params.get(4)));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else if (params.size() == 5 //公司簡稱_档案类型_税种_所属期间_文件生效日期
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument,filePath);
}else if (params.size() == 5 //公司簡稱_档案类型_税种_所属期间_文件生效日期
&& groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.keySet().contains(params.get(1))
&& taxsList.contains(params.get(2))//税种校验
&& checkOwnTime(params.get(3))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(4))) {//文件生效日期校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(4))){//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,file.getName());
//设置档案类型 档案属性 税种 所属期间 文件生效日期
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.get(params.get(1)));
......@@ -1075,13 +1042,13 @@ public class TaxDocumentServiceImpl {
taxDocument.setOwnTime(Integer.valueOf(params.get(3)));
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(4)));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else if (params.size() == 6 //公司簡稱_档案类型_所属期间_文件生效日期_实物存放地点_实物保管人
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument,filePath);
}else if (params.size() == 6 //公司簡稱_档案类型_所属期间_文件生效日期_实物存放地点_实物保管人
&& groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper.keySet().contains(params.get(1))
&& checkOwnTime(params.get(2))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))) {//文件生效日期校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,file.getName());
//设置档案类型 档案属性 所属期间 文件生效日期 实物存放地点 实物保管人
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper.get(params.get(1)));
......@@ -1090,8 +1057,8 @@ public class TaxDocumentServiceImpl {
taxDocument.setStorageArea(params.get(4));
taxDocument.setKeeper(params.get(5));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else {
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument,filePath);
}else {
errorFileNameList.add(filePath);
}
}
......
......@@ -237,7 +237,8 @@ grunt.initConfig({
"Scripts/viewer/viewer.js",
"Scripts/xlsx/shim.min.js",
"Scripts/xlsx/xlsx.full.min.js",
"Scripts/position-calculator/position-calculator.min.js"
"Scripts/position-calculator/position-calculator.min.js",
"Scripts/bootstrp-confirm/bootstrap-confirm.js"
],
dest: '<%= pkg.bundleTemp %>/util.js'
},
......
(function ($) {
window.Ewin = function () {
var html = '<div id="[Id]" class="modal fade" role="dialog" aria-labelledby="modalLabel">' +
'<div class="modal-dialog modal-sm">' +
'<div class="modal-content">' +
'<div class="modal-header">' +
'<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>' +
'<h4 class="modal-title" id="modalLabel">[Title]</h4>' +
'</div>' +
'<div class="modal-body">' +
'<p>[Message]</p>' +
'</div>' +
'<div class="modal-footer">' +
'<button type="button" class="btn btn-default cancel" data-dismiss="modal">[BtnCancel]</button>' +
'<button type="button" class="btn btn-primary ok" data-dismiss="modal">[BtnOk]</button>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
var dialogdHtml = '<div id="[Id]" class="modal fade" role="dialog" aria-labelledby="modalLabel">' +
'<div class="modal-dialog">' +
'<div class="modal-content">' +
'<div class="modal-header">' +
'<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>' +
'<h4 class="modal-title" id="modalLabel">[Title]</h4>' +
'</div>' +
'<div class="modal-body">' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
var reg = new RegExp("\\[([^\\[\\]]*?)\\]", 'igm');
var generateId = function () {
var date = new Date();
return 'mdl' + date.valueOf();
}
var init = function (options) {
options = $.extend({}, {
title: "操作提示",
message: "提示内容",
btnok: "确定",
btncl: "取消",
width: 200,
auto: false
}, options || {});
var modalId = generateId();
var content = html.replace(reg, function (node, key) {
return {
Id: modalId,
Title: options.title,
Message: options.message,
BtnOk: options.btnok,
BtnCancel: options.btncl
}[key];
});
$('body').append(content);
$('#' + modalId).modal({
width: options.width,
backdrop: 'static'
});
$('#' + modalId).on('hide.bs.modal', function (e) {
$('body').find('#' + modalId).remove();
});
return modalId;
}
return {
alert: function (options) {
if (typeof options == 'string') {
options = {
message: options
};
}
var id = init(options);
var modal = $('#' + id);
modal.find('.ok').removeClass('btn-success').addClass('btn-primary');
modal.find('.cancel').hide();
return {
id: id,
on: function (callback) {
if (callback && callback instanceof Function) {
modal.find('.ok').click(function () { callback(true); });
}
},
hide: function (callback) {
if (callback && callback instanceof Function) {
modal.on('hide.bs.modal', function (e) {
callback(e);
});
}
}
};
},
confirm: function (options) {
var id = init(options);
var modal = $('#' + id);
modal.find('.ok').removeClass('btn-primary').addClass('btn-success');
modal.find('.cancel').show();
return {
id: id,
on: function (callback) {
if (callback && callback instanceof Function) {
modal.find('.ok').click(function () { callback(true); });
modal.find('.cancel').click(function () { callback(false); });
}
},
hide: function (callback) {
if (callback && callback instanceof Function) {
modal.on('hide.bs.modal', function (e) {
callback(e);
});
}
}
};
},
dialog: function (options) {
options = $.extend({}, {
title: 'title',
url: '',
width: 800,
height: 550,
onReady: function () { },
onShown: function (e) { }
}, options || {});
var modalId = generateId();
var content = dialogdHtml.replace(reg, function (node, key) {
return {
Id: modalId,
Title: options.title
}[key];
});
$('body').append(content);
var target = $('#' + modalId);
target.find('.modal-body').load(options.url);
if (options.onReady())
options.onReady.call(target);
target.modal();
target.on('shown.bs.modal', function (e) {
if (options.onReady(e))
options.onReady.call(target, e);
});
target.on('hide.bs.modal', function (e) {
$('body').find(target).remove();
});
}
}
}();
})(jQuery);
\ No newline at end of file
......@@ -23,7 +23,6 @@
};
$scope.dataGridUpdate = function (_data) {
$scope.localData = _data.items;
$scope.queryStatusType($scope.localData);
$scope.pagingOptions = {
totalItems: $scope.localData.length, //总数据
......@@ -328,6 +327,9 @@
} else {
SweetAlert.warning($translate.instant('SaveFail'));
}
if(data.code==-1){
SweetAlert.warning($translate.instant(data.message));
}
});
$('#editPopDialog').modal('hide');
};
......
......@@ -2159,6 +2159,7 @@
};
// 取消编辑机构其他信息
// TODO 将这个方法添加到切换功能里
$scope.updateOrgExtraCancel = function () {
$scope.selectCompanyExtra = $scope.comExtraOldData;
$scope.editOrgExtraModel = $scope.editOldData;
......@@ -2397,6 +2398,8 @@
// 选中机构
$scope.selectOrganization = function (branch) {
var org = branch.data;
$scope.output = "You selected: " + org.id;
......@@ -2446,6 +2449,8 @@
loadUserRoleList(org.id);
generalSelectCompanyText();
cancelWebChange();
$scope.updateOrgExtraCancel()
});
......
......@@ -19,7 +19,7 @@ frameworkModule.controller('appUsrOperateLogController',
}
});
}
if($scope.thisModuleId.length===0){
if($("body[ng-controller='AppController']").length==1 && $scope.thisModuleId.length===0){
SweetAlert.warning($translate.instant("NeedChecked"));
return;
}
......
......@@ -3,9 +3,9 @@
*/
taxDocumentManageModule.controller('taxDocumentListController',
['$log', '$http', '$q', '$scope', '$translate', '$timeout',
'SweetAlert', '$compile', 'taxDocumentListService', '$filter','apiInterceptor',
'SweetAlert', '$compile', 'taxDocumentListService', '$filter', 'apiInterceptor',
function ($log, $http, $q, $scope, $translate, $timeout,
SweetAlert, $compile, taxDocumentListService, $filter,apiInterceptor) {
SweetAlert, $compile, taxDocumentListService, $filter, apiInterceptor) {
$scope.queryFieldModel = {};
$scope.editFieldModel = {};
......@@ -23,14 +23,15 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.queryFieldModel.pageSize = $scope.pagingOptions.pageSize;
var params = angular.copy($scope.queryFieldModel);
params.fileBeginTime = getQueryDate(params.fileBeginTime,"-");
params.fileEndTTime = getQueryDate(params.fileEndTTime,"-");
params.fileBeginTime = getQueryDate(params.fileBeginTime, "-");
params.fileEndTTime = getQueryDate(params.fileEndTTime, "-");
// params.ownBeginTime = getQueryDate(params.ownBeginTime,"-");
// params.ownEndTime = getQueryDate(params.ownEndTime,"-");
params.effectiveBeginTime = getQueryDate(params.effectiveBeginTime,"-");
params.effectiveEndTime = getQueryDate(params.effectiveEndTime,"-");
params.uploadBeginTime = getQueryDate(params.uploadBeginTime,"-");
params.uploadEndTime = getQueryDate(params.uploadEndTime,"-");
params.effectiveBeginTime = getQueryDate(params.effectiveBeginTime, "-");
params.effectiveEndTime = getQueryDate(params.effectiveEndTime, "-");
params.uploadBeginTime = getQueryDate(params.uploadBeginTime, "-");
params.uploadEndTime = getQueryDate(params.uploadEndTime, "-");
function getQueryDate(time, mark) {
if (!time) return "";
var theDate = new Date(time);
......@@ -41,6 +42,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
dd = (dd + "").length < 2 ? "0" + dd : dd;
return year + mark + mm + mark + dd;
}
taxDocumentListService.fetchMainList(params).then(function (data, status, headers) {
if (status == 204) {
SweetAlert.warning($translate.instant("NoData"));
......@@ -51,36 +53,34 @@ taxDocumentManageModule.controller('taxDocumentListController',
})
};
function checkReminder(){
var items=$scope.queryFieldModel;
var message="";
function checkReminder() {
var items = $scope.queryFieldModel;
var message = "";
if (!PWC.isNullOrEmpty(items.fileBeginTime) && !PWC.isNullOrEmpty(items.fileEndTTime) &&
items.fileBeginTime > items.fileEndTTime)
{
message+=$translate.instant('AvailabilityDate')+",";
items.fileBeginTime > items.fileEndTTime) {
message += $translate.instant('AvailabilityDate') + ",";
}
if (!PWC.isNullOrEmpty(items.ownBeginTime) && !PWC.isNullOrEmpty(items.ownEndTime) &&
items.ownBeginTime > items.ownEndTime)
{
message+=$translate.instant('Duration')+",";
items.ownBeginTime > items.ownEndTime) {
message += $translate.instant('Duration') + ",";
}
if (!PWC.isNullOrEmpty(items.effectiveBeginTime) && !PWC.isNullOrEmpty(items.effectiveEndTime) &&
items.effectiveBeginTime > items.effectiveEndTime)
{
message+=$translate.instant('DueDate')+",";
items.effectiveBeginTime > items.effectiveEndTime) {
message += $translate.instant('DueDate') + ",";
}
if (!PWC.isNullOrEmpty(items.uploadBeginTime) && !PWC.isNullOrEmpty(items.uploadEndTime) &&
items.uploadBeginTime > items.uploadEndTime)
{
message+=$translate.instant('UploadDate')+",";
items.uploadBeginTime > items.uploadEndTime) {
message += $translate.instant('UploadDate') + ",";
}
if(message){
if (message) {
message = (message.substring(message.length - 1) == ',') ? message.substring(0, message.length - 1) : message;
message+="-"+$translate.instant('DateWarningSearch');
message += "-" + $translate.instant('DateWarningSearch');
window.swal(message);
return;
}
}
$scope.dataGridUpdate = function (_data) {
$scope.localData = _data.list;
$scope.pagingOptions.pageIndex = _data.pageNo;
......@@ -307,74 +307,73 @@ taxDocumentManageModule.controller('taxDocumentListController',
],
onCellClick: function (e) {
//单元格点击— e.columnIndex=0 排除复选框列
if(e.columnIndex>0 && e.data){
if (e.columnIndex > 0 && e.data) {
$("input[name='dataGridCheckBox']").each(function (index, item) {
if((item.dataset) && (item.dataset.id==e.data.id)){
if(item.checked){
item.checked=false;
}else{
item.checked=true;
if ((item.dataset) && (item.dataset.id == e.data.id)) {
if (item.checked) {
item.checked = false;
} else {
item.checked = true;
}
}
});
}
}
};
$scope.getTableHeight=function(){
var row_height=$("table").find("tr").height();
if(row_height){
$scope.getTableHeight = function () {
var row_height = $("table").find("tr").height();
if (row_height) {
return {
height:(row_height*12)+"px"
height: (row_height * 12) + "px"
}
}
};
};
$scope.changeDateRangeError=function(){
var items=$scope.queryFieldModel;
$scope.changeDateRangeError = function () {
var items = $scope.queryFieldModel;
if (!PWC.isNullOrEmpty(items.fileBeginTime) && !PWC.isNullOrEmpty(items.fileEndTTime) &&
items.fileBeginTime > items.fileEndTTime)
{
items.fileBeginTime > items.fileEndTTime) {
SweetAlert.warning($translate.instant('DateWarningSearch'));
}
if (!PWC.isNullOrEmpty(items.ownBeginTime) && !PWC.isNullOrEmpty(items.ownEndTime) &&
items.ownBeginTime > items.ownEndTime)
{
items.ownBeginTime > items.ownEndTime) {
SweetAlert.warning($translate.instant('DateWarningSearch'));
}
if (!PWC.isNullOrEmpty(items.effectiveBeginTime) && !PWC.isNullOrEmpty(items.effectiveEndTime) &&
items.effectiveBeginTime > items.effectiveEndTime)
{
items.effectiveBeginTime > items.effectiveEndTime) {
SweetAlert.warning($translate.instant('DateWarningSearch'));
}
if (!PWC.isNullOrEmpty(items.uploadBeginTime) && !PWC.isNullOrEmpty(items.uploadEndTime) &&
items.uploadBeginTime > items.uploadEndTime)
{
items.uploadBeginTime > items.uploadEndTime) {
SweetAlert.warning($translate.instant('DateWarningSearch'));
}
if (!PWC.isNullOrEmpty(items.fileTime) && !PWC.isNullOrEmpty(items.effectiveTime) &&
items.fileTime > items.effectiveTime)
{
items.fileTime > items.effectiveTime) {
SweetAlert.warning($translate.instant('DateWarningSearch'));
}
};
$scope.changeFieldModel=function(){
//新建记录
items=$scope.editFieldModel;
var items=$scope.editFieldModel;
if (!PWC.isNullOrEmpty(items.fileTime) && !PWC.isNullOrEmpty(items.effectiveTime) &&
items.fileTime > items.effectiveTime)
{
SweetAlert.warning($translate.instant('FileTimeDateRangeError'));
}
};
$scope.changeFieldItem=function(){
$scope.changeFieldItem = function () {
//批量上传
items=$scope.editFieldItem;
if (!PWC.isNullOrEmpty(items.fileTime) && !PWC.isNullOrEmpty(items.effectiveTime) &&
items.fileTime > items.effectiveTime)
{
SweetAlert.warning($translate.instant('FileTimeDateRangeError'));
if($scope.multiUploadErrorItems){
for (var i = 0; i < $scope.multiUploadErrorItems.length; i++) {
var modelItem = $scope.multiUploadErrorItems[i];
if (!PWC.isNullOrEmpty(modelItem.fileTime) && !PWC.isNullOrEmpty(modelItem.effectiveTime) &&
modelItem.fileTime > modelItem.effectiveTime) {
SweetAlert.warning($translate.instant("Document") + (i + 1) + "," +$translate.instant('FileTimeDateRangeError'));
break;
}
}
}
};
//弹出框
......@@ -401,8 +400,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.matchFieldTypeId($scope.editFieldModel);
}
});
}
else {
} else {
$scope.curFileTypeOptions.length = 0;
$scope.isCreatePop = true;
$scope.simpleUploadSubmit = simpleUploadSubmit;
......@@ -415,11 +413,10 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.isCoverOperation = false;
//新建档案
var simpleUploadSubmit = function () {
$scope.matchCompanyId($scope.editFieldModel);
var params = angular.copy($scope.editFieldModel);
if (!PWC.isNullOrEmpty(params.fileTime) && !PWC.isNullOrEmpty(params.effectiveTime) &&
params.fileTime > params.effectiveTime)
{
params.fileTime > params.effectiveTime) {
window.swal($translate.instant('FileTimeDateRangeError'));
return;
}
......@@ -457,7 +454,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
// data == true,代表可以直接上传,否则属于覆盖行为
//data.id===null|| data.id===undefined,代表可以直接上传,否则属于覆盖行为
if (data.id===null|| data.id===undefined) {
if (data.id === null || data.id === undefined) {
$scope.uploader.queue[0].url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
$scope.uploader.uploadItem(0);
$scope.isCoverOperation = false;
......@@ -466,7 +463,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
// addLogicAfterUploadFile($scope.editFieldModel,'simple');
} else {
//覆盖行为-需上传参数
uploadItem.formData.push({id:data.id});
uploadItem.formData.push({id: data.id});
SweetAlert.swal({
title: '提示',
text: $translate.instant("CoverConfirm"),
......@@ -490,7 +487,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
};
var addLogicAfterUploadFile = function (editFieldModel, type) {
$scope.matchCompanyId(editFieldModel);
var params = angular.copy(editFieldModel);
// params.ownTime = params.ownTime ? params.ownTime : "";
// var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/";
......@@ -533,19 +530,19 @@ taxDocumentManageModule.controller('taxDocumentListController',
var params = angular.copy(fieldModel);
delete params.auditStatus;
params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
params.effectiveTime ? params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-") : delete params.effectiveTime;
params.createTime ? params.createTime = $scope.getQueryDate(params.createTime, "-") : delete params.createTime;
params.effectiveTime ? params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-") : delete params.effectiveTime;
params.createTime ? params.createTime = $scope.getQueryDate(params.createTime, "-") : delete params.createTime;
params.updateTime ? params.updateTime = $scope.getQueryDate(params.updateTime, "-") : delete params.updateTime;
params.uploadTime ? params.uploadTime = $scope.getQueryDate(params.uploadTime, "-") : delete params.uploadTime;
params.fileTime ? params.fileTime = $scope.getQueryDate(params.fileTime, "-") : delete params.fileTime;
params.uploadTime ? params.uploadTime = $scope.getQueryDate(params.uploadTime, "-") : delete params.uploadTime;
params.fileTime ? params.fileTime = $scope.getQueryDate(params.fileTime, "-") : delete params.fileTime;
params.filePositionUrl = encodeURIComponent(params.filePositionUrl);
taxDocumentListService.verifyDuplicate(params).then(function (result) {
// 例如 修改1为1 不用弹框 修改1本身就好 但是修改1为2 ,就要去掉1并修改2(保留2的id)
if ((result.id==null|| result.id==undefined)|| (result.id==fieldModel.id)) {
editRecord_Post(fieldModel,type);
}else{
var hisCellId=result.id;
var CellId=fieldModel.id;
if ((result.id == null || result.id == undefined) || (result.id == fieldModel.id)) {
editRecord_Post(fieldModel, type);
} else {
var hisCellId = result.id;
var CellId = fieldModel.id;
SweetAlert.swal({
title: '提示',
text: $translate.instant("CoverConfirm"),
......@@ -559,8 +556,8 @@ taxDocumentManageModule.controller('taxDocumentListController',
},
function (isConfirm) {
if (isConfirm) {
fieldModel.id=hisCellId;
editRecord_Post(fieldModel,type);
fieldModel.id = hisCellId;
editRecord_Post(fieldModel, type);
delHisRecord(CellId);
}
......@@ -570,20 +567,22 @@ taxDocumentManageModule.controller('taxDocumentListController',
$('#simpleUploadPopDialog').modal('hide');
$('#multiUploadPopDialog').modal('hide');
};
function editRecord_Post(fieldModel,type){
function editRecord_Post(fieldModel, type) {
$scope.matchCompanyId(fieldModel);
var params = angular.copy(fieldModel);
// params.ownTime = params.ownTime ? params.ownTime : "";
// var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/";
// params.ownTime = parseInt(params.ownTime.split(splitMark).join(""));
Object.keys(params).forEach(function(key){
if(params[key] === undefined || params[key] === null) params[key] = "";
Object.keys(params).forEach(function (key) {
if (params[key] === undefined || params[key] === null) params[key] = "";
});
params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
params.effectiveTime ? params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "/") : delete params.effectiveTime;
params.fileTime ? params.fileTime = $scope.getQueryDate(params.fileTime, "/") : delete params.fileTime;
params.createTime ? params.createTime = $scope.getQueryDate(params.createTime, "/") : delete params.createTime;
params.effectiveTime ? params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "/") : delete params.effectiveTime;
params.fileTime ? params.fileTime = $scope.getQueryDate(params.fileTime, "/") : delete params.fileTime;
params.createTime ? params.createTime = $scope.getQueryDate(params.createTime, "/") : delete params.createTime;
params.updateTime ? params.updateTime = $scope.getQueryDate(params.updateTime, "/") : delete params.updateTime;
params.uploadTime ? params.uploadTime = $scope.getQueryDate(params.uploadTime, "/") : delete params.uploadTime;
params.uploadTime ? params.uploadTime = $scope.getQueryDate(params.uploadTime, "/") : delete params.uploadTime;
params.filePositionUrl = encodeURIComponent(params.filePositionUrl);
params.auditStatus = $scope.transformAuditStatusToServer(params.auditStatus);
taxDocumentListService.editRecord(params).then(function (data) {
......@@ -617,13 +616,14 @@ taxDocumentManageModule.controller('taxDocumentListController',
});
}
function delHisRecord(cellId){
function delHisRecord(cellId) {
var delIDs = [];
delIDs.push(cellId);
taxDocumentListService.delFileRecordItems({
"ids":delIDs
"ids": delIDs
}).then(function (data) {
if (data) {}
if (data) {
}
});
};
//取消
......@@ -645,9 +645,9 @@ taxDocumentManageModule.controller('taxDocumentListController',
delIDs.push(cellId);
}
});
if(delIDs.length ==0){
if (delIDs.length == 0) {
SweetAlert.warning($translate.instant("NeedChecked"));
}else{
} else {
SweetAlert.swal({
title: '提示',
text: $translate.instant("DeleteConfirm"),
......@@ -662,7 +662,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
function (isConfirm) {
if (isConfirm) {
taxDocumentListService.delFileRecordItems({
"ids":delIDs
"ids": delIDs
}).then(function (data) {
if (data) {
SweetAlert.swal({
......@@ -848,7 +848,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$scope.multiUploadErrorItems = [];
$scope.multiUploadSuccessItems = [];
$scope.multiUploader = {};
$scope.FileItem={isSuccess:false};
$scope.FileItem = {isSuccess: false};
$scope.abandonFileCache = [];
$scope.uploadResultSuccessList = [];
$scope.activeTab = function (activeIndex) {
......@@ -885,7 +885,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
createFieldModel(fileItem);
};
function createFieldModel(fileItem){
function createFieldModel(fileItem) {
var fileNativePath = $("#multiUploadFilePlugin")[0].value || "";
fileNativePath = fileNativePath.replace(/fakepath/img, "******");
fileNativePath = fileNativePath.replace(fileItem.file.name, "");
......@@ -893,13 +893,13 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
fileNativePath: fileNativePath,
fileName: fileItem.file.name,
iShow: false,
abandon:false,
abandon: false,
};
$scope.autoMatchAttrAndType(fileItem.file.name, thisModel);
$scope.isAbandonFileItem(thisModel);
if(thisModel.abandon){
if (thisModel.abandon) {
$scope.multiUploadErrorItems.push(thisModel);
}else{
} else {
$scope.multiUploadSuccessItems.push(thisModel);
}
}
......@@ -907,14 +907,14 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
//验证输入值是否都正确填充
//逻辑为:判断当前表单的必填值是否都已填充
//验证失败就推出到失败队列,首先展示失败窗口,再把失败队列显示到编辑窗口
$scope.isAbandonFileItem = function(fieldModel){
$scope.isAbandonFileItem = function (fieldModel) {
// 验证必填字段的值
if(!fieldModel.companyName && fieldModel.companyName != 0
if (!fieldModel.companyName && fieldModel.companyName != 0
|| !fieldModel.fileType && fieldModel.fileType != 0
|| !fieldModel.taxType && fieldModel.taxType != 0
|| !fieldModel.ownTime && fieldModel.ownTime != 0
|| !fieldModel.fileTime && fieldModel.fileTime != 0
){
) {
fieldModel.abandon = true;
}
};
......@@ -922,7 +922,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$scope.multiUploader.onSuccessItem = function (fileItem, response) {
var fieldModel = {};
fileItem.formData.forEach(function (formItem) {
Object.keys(formItem).forEach(function(key){
Object.keys(formItem).forEach(function (key) {
fieldModel[key] = formItem[key];
})
});
......@@ -935,30 +935,30 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
//todo 重新构造一个editModel
var fieldModel = {};
fileItem.formData.forEach(function (formItem) {
Object.keys(formItem).forEach(function(key){
Object.keys(formItem).forEach(function (key) {
fieldModel[key] = formItem[key];
})
});
// fieldModel.file = fileItem;
if(verifyFieldModelDup(fieldModel,$scope.multiUploadErrorItems) === -1){
if (verifyFieldModelDup(fieldModel, $scope.multiUploadErrorItems) === -1) {
$scope.multiUploadErrorItems.push(fieldModel);
}
var successDupIndex = verifyFieldModelDup(fieldModel,$scope.multiUploadSuccessItems);
if(successDupIndex > -1){
$scope.multiUploadSuccessItems.splice(successDupIndex,1);
var successDupIndex = verifyFieldModelDup(fieldModel, $scope.multiUploadSuccessItems);
if (successDupIndex > -1) {
$scope.multiUploadSuccessItems.splice(successDupIndex, 1);
}
$scope.abandonFileCache.push(fileItem);
};
function verifyFieldModelDup(fieldModel,uploadModelItems){
function verifyFieldModelDup(fieldModel, uploadModelItems) {
var dupIndex = -1;
uploadModelItems.forEach(function (modelItem,modelIndex) {
if(fieldModel.companyName === modelItem.companyName
uploadModelItems.forEach(function (modelItem, modelIndex) {
if (fieldModel.companyName === modelItem.companyName
&& fieldModel.fileType === modelItem.fileType
&& fieldModel.taxType === modelItem.taxType
&& fieldModel.ownTime === modelItem.ownTime
&& fieldModel.fileTime === modelItem.fileTime){
&& fieldModel.fileTime === modelItem.fileTime) {
dupIndex = modelIndex;
}
});
......@@ -970,15 +970,15 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
// console.info('onCancelItem', fileItem, response, status, headers);
// };
$scope.multiUploader.onAfterAddingAll = function(){
$scope.multiUploader.onAfterAddingAll = function () {
if($scope.multiUploadErrorItems.length){
if ($scope.multiUploadErrorItems.length) {
$scope.abandonFileCache.length = 0;
$scope.multiUploadErrorItems.forEach(function (errItem) {
var queueLen = $scope.multiUploader.queue.length;
while(queueLen--){
while (queueLen--) {
var queueItem = $scope.multiUploader.queue[queueLen];
if(errItem.fileName === queueItem._file.name){
if (errItem.fileName === queueItem._file.name) {
$scope.abandonFileCache.push(queueItem);
$scope.multiUploader.removeFromQueue(queueLen);
break;
......@@ -987,9 +987,9 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
});
}
if($scope.multiUploader.queue.length){
if ($scope.multiUploader.queue.length) {
$scope.multiUploadSubmit_auto();
}else{
} else {
$("#uploadResultPop").modal("show");
}
};
......@@ -1002,11 +1002,12 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
fileItem.formData = [{
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
}];
$scope.matchCompanyId($scope.multiUploadSuccessItems[i]);
var editFieldModel = $scope.multiUploadSuccessItems[i];
Object.keys(editFieldModel).forEach(function (key) {
var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
fileItem.formData.push($scope.queryFileUploadData(key,curItemValue));
fileItem.formData.push($scope.queryFileUploadData(key, curItemValue));
});
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
......@@ -1019,13 +1020,13 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-");
_taxDocumentListService.verifyDuplicate(params).then(function (data) {
//data.id===null|| data.id===undefined,代表可以直接上传,否则属于覆盖行为
if (data.id===null|| data.id===undefined) {
if (data.id === null || data.id === undefined) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
_multiUploader.uploadItem(_i);
} else {
//覆盖行为-需上传参数
_fileItem.formData.push({id:data.id});
var Cover_Confirm="'"+data.fileName+"' 记录已经存在,是否进行覆盖?";
_fileItem.formData.push({id: data.id});
var Cover_Confirm = "'" + data.fileName + "' 记录已经存在,是否进行覆盖?";
SweetAlert.swal({
title: '提示',
text: $translate.instant(Cover_Confirm),
......@@ -1053,17 +1054,17 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$scope.multiUploader.onCompleteAll = function () {
if($scope.multiUploadErrorItems.length)
if ($scope.multiUploadErrorItems.length)
$scope.multiUploadErrorItems[0].iShow = true;
if($scope.multiUploadErrorItems.length
if ($scope.multiUploadErrorItems.length
|| $scope.uploadResultSuccessList.length)
$("#uploadResultPop").modal("show");
//是否都上传成功
if($scope.multiUploadErrorItems.length>0){
$scope.FileItem.isSuccess=false;
}else{
$scope.FileItem.isSuccess=true;
if ($scope.multiUploadErrorItems.length > 0) {
$scope.FileItem.isSuccess = false;
} else {
$scope.FileItem.isSuccess = true;
}
$('#busy-indicator-container').hide();
......@@ -1074,17 +1075,17 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$scope.multiUploadSuccessItems.length = 0;
// 默认显示第一个
if($scope.multiUploadErrorItems.length){
if ($scope.multiUploadErrorItems.length) {
$scope.multiUploadErrorItems.forEach(function (errorItem) {
errorItem.iShow = false;
});
$scope.multiUploadErrorItems[0].iShow = true;
}
$('#uploadResultPop').modal('hide');
if($scope.FileItem.isSuccess==false){
if ($scope.FileItem.isSuccess == false) {
$("#multiUploadPopDialog").modal("show");
}else{
$scope.FileItem.isSuccess=false;
} else {
$scope.FileItem.isSuccess = false;
}
};
......@@ -1093,7 +1094,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$("#multiUploadPopDialog").modal("hide");
};
function clearCache(){
function clearCache() {
$scope.uploadResultSuccessList.length = 0;
$scope.multiUploadErrorItems.length = 0;
$scope.multiUploadSuccessItems.length = 0;
......@@ -1103,18 +1104,18 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$scope.multiUploadSubmit_handmade = function () {
var alertContent = verifyRequiredFields($scope.multiUploadErrorItems);
if(!alertContent){
if (!alertContent) {
exchangedFieldModel();
addFileItemToQueueFromCache();
$("#multiUploadPopDialog").modal("hide");
multiUpload_handmade();
}else{
} else {
swal(alertContent);
}
};
function addFileItemToQueueFromCache(){
function addFileItemToQueueFromCache() {
$scope.abandonFileCache.forEach(function (fileItem) {
$scope.multiUploader.queue.push(fileItem);
......@@ -1122,66 +1123,65 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$scope.abandonFileCache.length = 0;
}
function exchangedFieldModel(){
function exchangedFieldModel() {
$scope.multiUploadErrorItems.forEach(function (errItem) {
$scope.multiUploadSuccessItems.push(errItem);
});
$scope.multiUploadErrorItems.length = 0;
}
function verifyRequiredFields(multiUploadErrorItems){
function verifyRequiredFields(multiUploadErrorItems) {
var alertText = "";
if(!$scope.requiredField.length){
if (!$scope.requiredField.length) {
return $translate.instant("PleaseChecksRequired");
}
//todo 先获取必填字段
for(var i = 0; i < multiUploadErrorItems.length; i++){
for (var i = 0; i < multiUploadErrorItems.length; i++) {
var modelItem = multiUploadErrorItems[i];
// $scope.isRequired = function (IT8nField) {
// return $scope.requiredField.indexOf($translate.instant(IT8nField)) > -1;
// };
if (!PWC.isNullOrEmpty(modelItem.fileTime) && !PWC.isNullOrEmpty(modelItem.effectiveTime) &&
modelItem.fileTime > modelItem.effectiveTime)
{
alertText = $translate.instant("Document") + (i + 1) + "," + "【"+$translate.instant('FileTimeDateRangeError')+"】";
modelItem.fileTime > modelItem.effectiveTime) {
alertText = $translate.instant("Document") + (i + 1) + "," + "【" + $translate.instant('FileTimeDateRangeError') + "】";
break;
}
if(!modelItem.companyName && $scope.isRequired($translate.instant("CompanyName"))){
alertText += "【"+$translate.instant("CompanyName")+"】"
if (!modelItem.companyName && $scope.isRequired($translate.instant("CompanyName"))) {
alertText += "【" + $translate.instant("CompanyName") + "】"
}
if(!modelItem.fileType && $scope.isRequired($translate.instant("DocumentType"))){
alertText += "【"+$translate.instant("DocumentType")+"】"
if (!modelItem.fileType && $scope.isRequired($translate.instant("DocumentType"))) {
alertText += "【" + $translate.instant("DocumentType") + "】"
}
if(!modelItem.fileAttr && $scope.isRequired($translate.instant("DocumentAttr"))){
alertText += "【"+$translate.instant("DocumentAttr")+"】"
if (!modelItem.fileAttr && $scope.isRequired($translate.instant("DocumentAttr"))) {
alertText += "【" + $translate.instant("DocumentAttr") + "】"
}
if(!modelItem.taxType && $scope.isRequired($translate.instant("TaxType"))){
alertText += "【"+$translate.instant("TaxType")+"】"
if (!modelItem.taxType && $scope.isRequired($translate.instant("TaxType"))) {
alertText += "【" + $translate.instant("TaxType") + "】"
}
if(!modelItem.ownTime && $scope.isRequired($translate.instant("Duration"))){
alertText += "【"+$translate.instant("Duration")+"】"
if (!modelItem.ownTime && $scope.isRequired($translate.instant("Duration"))) {
alertText += "【" + $translate.instant("Duration") + "】"
}
if(!modelItem.fileTime && $scope.isRequired($translate.instant("AvailabilityDate"))){
alertText += "【"+$translate.instant("AvailabilityDate")+"】"
if (!modelItem.fileTime && $scope.isRequired($translate.instant("AvailabilityDate"))) {
alertText += "【" + $translate.instant("AvailabilityDate") + "】"
}
if(!modelItem.effectiveTime && $scope.isRequired($translate.instant("DueDate"))){
alertText += "【"+$translate.instant("DueDate")+"】"
if (!modelItem.effectiveTime && $scope.isRequired($translate.instant("DueDate"))) {
alertText += "【" + $translate.instant("DueDate") + "】"
}
if(!modelItem.keeper && $scope.isRequired($translate.instant("EntityCustodian"))){
alertText += "【"+$translate.instant("EntityCustodian")+"】"
if (!modelItem.keeper && $scope.isRequired($translate.instant("EntityCustodian"))) {
alertText += "【" + $translate.instant("EntityCustodian") + "】"
}
if(!modelItem.storageArea && $scope.isRequired($translate.instant("EntityStorageLocation"))){
alertText += "【"+$translate.instant("EntityStorageLocation")+"】"
if (!modelItem.storageArea && $scope.isRequired($translate.instant("EntityStorageLocation"))) {
alertText += "【" + $translate.instant("EntityStorageLocation") + "】"
}
if(!modelItem.physicalIndexNumber && $scope.isRequired($translate.instant("EntityIndex"))){
alertText += "【"+$translate.instant("EntityIndex")+"】"
if (!modelItem.physicalIndexNumber && $scope.isRequired($translate.instant("EntityIndex"))) {
alertText += "【" + $translate.instant("EntityIndex") + "】"
}
if(!modelItem.remark && $scope.isRequired($translate.instant("Remarks"))){
alertText += "【"+$translate.instant("Remarks")+"】"
if (!modelItem.remark && $scope.isRequired($translate.instant("Remarks"))) {
alertText += "【" + $translate.instant("Remarks") + "】"
}
if(alertText.length > 0){
if (alertText.length > 0) {
alertText = $translate.instant("Document") + (i + 1) + "," + alertText + $translate.instant("IsRequired");
break;
}
......@@ -1190,7 +1190,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
return alertText;
}
function multiUpload_handmade(){
function multiUpload_handmade() {
for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
// 过滤参数格式,并把参数推进上传队列
......@@ -1200,28 +1200,27 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
fileItem.formData = [{
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
}];
$scope.matchCompanyId($scope.multiUploadSuccessItems[i]);
var editFieldModel = $scope.multiUploadSuccessItems[i];
Object.keys(editFieldModel).forEach(function (key) {
var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
fileItem.formData.push($scope.queryFileUploadData(key,curItemValue));
fileItem.formData.push($scope.queryFileUploadData(key, curItemValue));
});
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
var params = angular.copy(_editFieldModel);
params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
params.fileTime = $scope.getQueryDate(params.fileTime, "-");
params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-");
_taxDocumentListService.verifyDuplicate(params).then(function (data) {
//data.id===null|| data.id===undefined,代表可以直接上传,否则属于覆盖行为
if (data.id===null|| data.id===undefined) {
if (data.id === null || data.id === undefined) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
_multiUploader.uploadItem(_i);
} else {
//覆盖行为-需上传参数
_fileItem.formData.push({id:data.id});
var Cover_Confirm="'"+data.fileName+"' 记录已经存在,是否进行覆盖?";
_fileItem.formData.push({id: data.id});
var Cover_Confirm = "'" + data.fileName + "' 记录已经存在,是否进行覆盖?";
SweetAlert.swal({
title: '提示',
text: $translate.instant(Cover_Confirm),
......@@ -1252,8 +1251,8 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
taxDocumentManageModule.directive('filePreview', function () {
return {
restrict: 'EA',
controller: ['$scope', '$translate', 'SweetAlert', '$compile', 'taxDocumentListService',
function ($scope, $translate, SweetAlert, $compile, taxDocumentListService) {
controller: ['$scope', '$translate', 'SweetAlert', '$compile', 'taxDocumentListService', '$q',
function ($scope, $translate, SweetAlert, $compile, taxDocumentListService, $q) {
$scope.previewData = [];
/**上传时预览的功能取消 2019/3/8*/
......@@ -1312,7 +1311,7 @@ taxDocumentManageModule.directive('filePreview', function () {
return taxDocumentListService.readXLSX({
path:url
path: url
// path: 'http://47.94.233.173:11007/static/erp_tax_system/FE9A6FCC-019E-4B93-A9B2-1DD04CDD7431?expire=1552463739&signiture=H15ovgMR4zXwiYlPe4nZMoeLMSZFhimiHFUZ4-SVVaE='
});
}
......@@ -1345,24 +1344,87 @@ taxDocumentManageModule.directive('filePreview', function () {
var fileType = fileName.split(".").pop();
if (/xlsx|xls/i.test(fileType)) {
if (cacheUrl !== filePositionUrl) {
cacheUrl = filePositionUrl;
sheetPromise = getXLS(filePositionUrl);
}
sheetPromise.then(function (resData) {
renderXLS(resData)
})
taxDocumentListService.viewExcelBySpread(filePositionUrl).then(function (reportSpread) {
var spreadCtrl = new GC.Spread.Sheets.Workbook(document.getElementById("excetlContainer"));
if (spreadCtrl) {
spreadCtrl.destroy();
}
spreadCtrl = null;
if (!_.isEmpty(reportSpread)) {
initSpreadExcel(reportSpread).then(function (spread) {
/* return locateCell(spread, true);*/
});
}
}, function (data) {
$log.info(data);
});
}
// sheetPromise.then(function (resData) {
// renderXLS(resData)
// })
else if (/pdf/i.test(fileType)) {
$scope.openPdfPreviewPop(filePositionUrl);
} else if (/jpg|pig|gif|png|jpeg/i.test(fileType)) {
$scope.openImgPreviewPop(fileName, filePositionUrl);
}else {
} else {
SweetAlert.warning($translate.instant('UnFile'));
}
};
var initSpreadExcel = function (reportSpread) {
$("#filePreviewPop").modal("show");
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("excetlContainer"));
spread.suspendPaint();
spread.fromJSON(reportSpread);
spread.options.showVerticalScrollbar = true;
spread.options.showHorizontalScrollbar = true;
spread.options.scrollbarMaxAlign = true;
spread.options.scrollbarShowMax = true;
spread.options.tabNavigationVisible = true;
if (constant.regesterInformation.active) {
spread.options.tabEditable = false;
spread.options.tabStripVisible = false;
spread.options.newTabVisible = false;
}
spread.options.allowUndo = false;
spread.options.allowUserResize = false;
spread.options.allowUserDragDrop = false;
spread.options.allowUserDragFill = false;
spread.options.allowUserEditFormula = false;
spread.options.allowContextMenu = false;
//todo:注册之后这里去掉注释
//var sheet = spread.getActiveSheet();
var sheet;
if (constant.regesterInformation.active) {
sheet = spread.getActiveSheet();
} else {
sheet = spread.getSheet(1);
}
if (sheet != null) {
sheet.options.rowHeaderVisible = true;
sheet.options.colHeaderVisible = true;
sheet.options.gridline.showVerticalGridline = true;
sheet.options.gridline.showHorizontalGridline = true;
sheet.options.isProtected = true;
sheet.clearSelection();
}
// setColWidth(sheet);
// if(sheet.getRowCount() <= 38)
// scope.relation.addEbitRow(sheet)
// if (scope.templateId && scope.reportSource) {
// setData();
// }
sheet.setRowResizable(0, false, GC.Spread.Sheets.SheetArea.viewport);
spread.resumePaint();
return $q.when(spread);
};
$scope.filePreview_dataGridUpdate = function (_data) {
// console.info("excel:",_data);
$scope.previewData = _data || [{}];
......@@ -1487,6 +1549,7 @@ taxDocumentManageModule.directive('pdfPreview', function () {
renderPdf(pdf)
})
};
function getPdf(url) {
// var url = 'http://47.94.233.173:11007/static/erp_tax_system/61063D1D-8C9E-47C1-B106-AFF696CF5D98?expire=1552466477&signiture=5IaoVIHX_pzmQgyaxdzYC2NsNOz_R0eyRUhQU1BJjiE=';
return window.PDFJS.getDocument(url);
......@@ -1525,7 +1588,7 @@ taxDocumentManageModule.directive('imgPreview', function () {
controller: ['$scope', function ($scope) {
$scope.curImgSrc = "";
$scope.curImgName = "";
$scope.openImgPreviewPop = function (fileName,url) {
$scope.openImgPreviewPop = function (fileName, url) {
if ($scope.curImgSrc !== url) {
$scope.curImgName = fileName;
$scope.curImgSrc = url;
......@@ -1543,8 +1606,8 @@ taxDocumentManageModule.directive('imgPreview', function () {
taxDocumentManageModule.directive('helpPop', function () {
return {
restrict: 'EA',
controller: ['$scope', 'taxDocumentListService', '$translate', '$compile','SweetAlert',
function ($scope, taxDocumentListService, $translate, $compile,SweetAlert) {
controller: ['$scope', 'taxDocumentListService', '$translate', '$compile', 'SweetAlert',
function ($scope, taxDocumentListService, $translate, $compile, SweetAlert) {
$scope.curEditModel = null;
$scope.openHelpPop = function (curEditModel) {
$scope.curEditModel = curEditModel;
......@@ -1562,7 +1625,7 @@ taxDocumentManageModule.directive('helpPop', function () {
})
};
$scope.sniffHelpPopRadio = function(){
$scope.sniffHelpPopRadio = function () {
var checkedItem = $(".TDL-has-checked").children()[0].childNodes[0];
$scope.curEditModel.fileAttr = checkedItem.getAttribute("data-fileAttr");
taxDocumentListService.getDocumentsAttrAndType({params: {}}).then(function (data) {
......@@ -1608,13 +1671,13 @@ taxDocumentManageModule.directive('helpPop', function () {
'data-id="helpPop_' + options.data.id + '" ' +
'data-fileAttr="' + options.data.fileAttr + '" ' +
'data-fileType="' + options.data.fileType +
'">'+ options.data.fileAttr +'</span>');
'">' + options.data.fileAttr + '</span>');
container.append(target);
var trs = $("#helpPopDialog").find("tr");
trs.each(function (index,item) {
$(item).off("click").on("click",function(e){
trs.each(function(_index,_item){
trs.each(function (index, item) {
$(item).off("click").on("click", function (e) {
trs.each(function (_index, _item) {
$(_item).removeClass('TDL-has-checked');
});
$(e.currentTarget).addClass('TDL-has-checked');
......@@ -1647,8 +1710,8 @@ taxDocumentManageModule.directive('helpPop', function () {
taxDocumentManageModule.directive('watchGroup', function () {
return {
restrict: 'EA',
controller: ['$scope','taxDocumentListService','$translate',
function ($scope,taxDocumentListService,$translate) {
controller: ['$scope', 'taxDocumentListService', '$translate',
function ($scope, taxDocumentListService, $translate) {
$scope.requiredField = [];
$scope.FileAttrAndTypeCache = [];
......@@ -1677,11 +1740,11 @@ taxDocumentManageModule.directive('watchGroup', function () {
var fieldsArray = fileName.split("_");
// 嘀嘀无限_增值税纳税申报表_增值税_201811_20181201
// 公司名_文档类型_税种_所属期间_到期日
if(fieldsArray.length){
if (fieldsArray.length) {
//需要验证每个值在对应的下拉菜单里面有没有对应的值
fieldModel.companyName = $scope.verifyRequiredData(fieldsArray[0],"companyName");
fieldModel.fileType = $scope.verifyRequiredData(fieldsArray[1],"fileType");
fieldModel.taxType = $scope.verifyRequiredData(fieldsArray[2],"taxType");
fieldModel.companyName = $scope.verifyRequiredData(fieldsArray[0], "companyName");
fieldModel.fileType = $scope.verifyRequiredData(fieldsArray[1], "fileType");
fieldModel.taxType = $scope.verifyRequiredData(fieldsArray[2], "taxType");
fieldModel.ownTime = $scope.intToDate(fieldsArray[3]);
fieldModel.fileTime = $scope.intToDate(fieldsArray[4]);
}
......@@ -1689,7 +1752,7 @@ taxDocumentManageModule.directive('watchGroup', function () {
// 根据Type来匹配Attr;
Object.keys($scope.typeAndAttrMap).forEach(function (key) {
if (fieldModel.fileType === key) {
fieldModel.fileAttr = $scope.verifyRequiredData($scope.typeAndAttrMap[key],"fileAttr");
fieldModel.fileAttr = $scope.verifyRequiredData($scope.typeAndAttrMap[key], "fileAttr");
}
});
......@@ -1727,17 +1790,23 @@ taxDocumentManageModule.directive('watchGroup', function () {
// 选了公司之后,就自动匹配公司ID
$scope.matchCompanyId = function (fieldModel) {
Object.keys($scope.companyNameOptionsMap).forEach(function (key) {
if ($scope.companyNameOptionsMap[key] === fieldModel.companyName) {
fieldModel.companyId = key;
angular.forEach($scope.companyNameOptionsMap, function (d) {
if (d.key === fieldModel.companyName) {
fieldModel.companyId = d.val;
return;
}
})
// Object.keys($scope.companyNameOptionsMap).forEach(function (key) {
// if ($scope.companyNameOptionsMap[key] === fieldModel.companyName) {
// fieldModel.companyId = key;
// }
// })
};
// 根据当前获取的字段值来匹配下拉菜单,如果匹配不到就返回空字符串,以使得form表单验证功能正常
$scope.verifyRequiredData = function(src,type){
$scope.verifyRequiredData = function (src, type) {
var pass = false;
switch (type){
switch (type) {
case "taxType":
pass = $scope.taxTypeSelects.indexOf(src) > -1;
break;
......@@ -1748,7 +1817,12 @@ taxDocumentManageModule.directive('watchGroup', function () {
pass = $scope.fileTypeOptions.indexOf(src) > -1;
break;
case "companyName":
pass = Object.values($scope.companyNameOptionsMap).indexOf(src) > -1;
angular.forEach($scope.companyNameOptionsMap, function (d) {
if (d.key === src) {
pass = true;
return;
}
})
break;
}
......@@ -1780,18 +1854,63 @@ taxDocumentManageModule.directive('tempModule', function () {
// ];
//审批状态
$scope.auditSelectsMap = {
"0":"待审批",
"1":"已审批",
"-1":"拒绝审批",
"0": "待审批",
"1": "已审批",
"-1": "拒绝审批",
};
//机构下拉设置
$scope.queryOrgOptions = {
displayExpr: 'key',
valueExpr: 'key',
// width: '95%',
bindingOptions: {
value: 'queryFieldModel.companyName',
dataSource: 'companyNameOptionsMap',
readOnly: 'isOrgReadOnly'
},
// height: '30px',
placeholder: '',
showClearButton: true,
searchEnabled: true,
showSelectionControls: true
};
$scope.editOrgOptions = {
displayExpr: 'key',
valueExpr: 'key',
// width: '95%',
bindingOptions: {
value: 'editFieldModel.companyName',
dataSource: 'companyNameOptionsMap',
readOnly: 'isOrgReadOnly'
},
// height: '30px',
placeholder: '',
showClearButton: true,
searchEnabled: true,
showSelectionControls: true
};
$scope.editFieldItemOrgOptions = {
displayExpr: 'key',
valueExpr: 'key',
// width: '95%',
bindingOptions: {
value: 'editFieldItem.companyName',
dataSource: 'companyNameOptionsMap',
readOnly: 'isOrgReadOnly'
},
// height: '30px',
placeholder: '',
showClearButton: true,
searchEnabled: true,
showSelectionControls: true
};
$scope.typeAndAttrMap = {};
$scope.fileTypeOptions = [];
$scope.fileAttrOptions = [];
$scope.fileTypeEnableOptions = [];
$scope.fileAttrEnableOptions = [];
$scope.curFileTypeOptions = [];
$scope.companyNameOptionsMap = {};
$scope.companyNameOptionsMap = [];
$scope.loadSelectMap = function () {
taxDocumentListService.getFileInfoOptions().then(function (data) {
// console.log(data);
......@@ -1806,10 +1925,10 @@ taxDocumentManageModule.directive('tempModule', function () {
// 过滤去重
var temp = $scope.fileTypeOptions;
$scope.fileTypeOptions = (function(){
$scope.fileTypeOptions = (function () {
var result = [];
temp.forEach(function(typeItem){
if(result.indexOf(typeItem) === -1){
temp.forEach(function (typeItem) {
if (result.indexOf(typeItem) === -1) {
result.push(typeItem);
}
});
......@@ -1817,10 +1936,10 @@ taxDocumentManageModule.directive('tempModule', function () {
})();
$scope.fileTypeOptions.sort();
temp = $scope.fileAttrOptions;
$scope.fileAttrOptions = (function(){
$scope.fileAttrOptions = (function () {
var result = [];
temp.forEach(function(attrItem){
if(result.indexOf(attrItem) === -1){
temp.forEach(function (attrItem) {
if (result.indexOf(attrItem) === -1) {
result.push(attrItem);
}
});
......@@ -1830,10 +1949,11 @@ taxDocumentManageModule.directive('tempModule', function () {
}
});
taxDocumentListService.getCompanyNameOptions().then(function(res){
taxDocumentListService.getCompanyNameOptions().then(function (res) {
if (res && 0 === res.code) {
angular.forEach(res.data, function (item) {
$scope.companyNameOptionsMap[item.id]=item.abbreviation;
$scope.companyNameOptionsMap.push({'key': item.abbreviation, 'val': item.id});
// $scope.companyNameOptionsMap[item.id] = item.abbreviation;
});
} else {
SweetAlert.error($translate.instant('RevenueGetOrgError'));
......@@ -1856,10 +1976,10 @@ taxDocumentManageModule.directive('tempModule', function () {
// 过滤去重
var temp = $scope.fileTypeEnableOptions;
$scope.fileTypeEnableOptions = (function(){
$scope.fileTypeEnableOptions = (function () {
var result = [];
temp.forEach(function(typeItem){
if(result.indexOf(typeItem) === -1){
temp.forEach(function (typeItem) {
if (result.indexOf(typeItem) === -1) {
result.push(typeItem);
}
});
......@@ -1867,10 +1987,10 @@ taxDocumentManageModule.directive('tempModule', function () {
})();
$scope.fileTypeEnableOptions.sort();
temp = $scope.fileAttrEnableOptions;
$scope.fileAttrEnableOptions = (function(){
$scope.fileAttrEnableOptions = (function () {
var result = [];
temp.forEach(function(attrItem){
if(result.indexOf(attrItem) === -1){
temp.forEach(function (attrItem) {
if (result.indexOf(attrItem) === -1) {
result.push(attrItem);
}
});
......@@ -1880,10 +2000,11 @@ taxDocumentManageModule.directive('tempModule', function () {
}
});
taxDocumentListService.getCompanyNameOptions().then(function(res){
taxDocumentListService.getCompanyNameOptions().then(function (res) {
if (res && 0 === res.code) {
angular.forEach(res.data, function (item) {
$scope.companyNameOptionsMap[item.id]=item.abbreviation;
$scope.companyNameOptionsMap.push({'key': item.abbreviation, 'val': item.id});
// $scope.companyNameOptionsMap[item.id] = item.abbreviation;
});
} else {
SweetAlert.error($translate.instant('RevenueGetOrgError'));
......@@ -1894,8 +2015,8 @@ taxDocumentManageModule.directive('tempModule', function () {
$scope.loadSelectMap();
$scope.loadSelectEnableMap();
$scope.businessLineOptions = [];
$scope.loadBusinessList = function(){
taxDocumentListService.getBusinessList().then(function(resData){
$scope.loadBusinessList = function () {
taxDocumentListService.getBusinessList().then(function (resData) {
$scope.businessLineOptions = resData;
});
};
......@@ -1986,18 +2107,18 @@ taxDocumentManageModule.directive('tempModule', function () {
$("#period-picker4").val("");
};
$scope.sortByFirstCode = function(src){
$scope.sortByFirstCode = function (src) {
var result = [];
var firstCodesOrigin = [];
var originValuesMapping = [];
src.forEach(function(key,index){
src.forEach(function (key, index) {
// 记录原始的下标,拼在第一个字符后面
var firstCode = (key + "").substr(0,1) + "_" + index;
var firstCode = (key + "").substr(0, 1) + "_" + index;
firstCodesOrigin.push(firstCode);
originValuesMapping.push(key);
});
firstCodesOrigin.sort().forEach(function(firstCodeSortedItem,sortedIndex){
firstCodesOrigin.sort().forEach(function (firstCodeSortedItem, sortedIndex) {
// 循环已排序的首字符数组,根据记录的原始下标,对换originValuesMapping的位置
var originIndex = firstCodeSortedItem.split("_").pop();
result[sortedIndex] = originValuesMapping[originIndex];
......@@ -2006,46 +2127,46 @@ taxDocumentManageModule.directive('tempModule', function () {
return result;
};
$scope.intToDate = function(src,type){
if(!src) return "";
$scope.intToDate = function (src, type) {
if (!src) return "";
src = src + "";
type = type ? type : "/";
var year = src.substr(0,4);
var mon = src.substr(4,2);
var day = src.substr(6,2);
if(!day) return year + type + mon;
var year = src.substr(0, 4);
var mon = src.substr(4, 2);
var day = src.substr(6, 2);
if (!day) return year + type + mon;
return year + type + mon + type + day;
};
$scope.transformAuditStatusToServer = function(src){
$scope.transformAuditStatusToServer = function (src) {
var result = 0;
if(src === $translate.instant('ApprovalStandby')){
if (src === $translate.instant('ApprovalStandby')) {
result = 0;
}else if(src === $translate.instant('ApprovalPass')){
} else if (src === $translate.instant('ApprovalPass')) {
result = 1;
}else if(src === $translate.instant('ApprovalReject')){
} else if (src === $translate.instant('ApprovalReject')) {
result = -1;
}else{
result="";
} else {
result = "";
}
return result;
};
$scope.transformAuditStatusToView = function(src){
$scope.transformAuditStatusToView = function (src) {
var result = $translate.instant('ApprovalStandby');
if(src == 0){
if (src == 0) {
result = $translate.instant('ApprovalStandby');
}else if(src == 1){
} else if (src == 1) {
result = $translate.instant('ApprovalPass');
}else if(src == -1){
} else if (src == -1) {
result = $translate.instant('ApprovalReject');
}else{
result="";
} else {
result = "";
}
return result;
};
$scope.queryFileUploadData = function(key,curItemValue){
$scope.queryFileUploadData = function (key, curItemValue) {
var fields = {};
if (/ownTime/.test(key)) {
fields[key] = $scope.queryOwnTime(curItemValue, "int");
......@@ -2062,8 +2183,8 @@ taxDocumentManageModule.directive('tempModule', function () {
taxDocumentManageModule.directive('downLoadModule', function () {
return {
restrict: 'EA',
controller: ['$scope', 'taxDocumentListService', '$translate','SweetAlert',
function ($scope, taxDocumentListService, $translate,SweetAlert) {
controller: ['$scope', 'taxDocumentListService', '$translate', 'SweetAlert',
function ($scope, taxDocumentListService, $translate, SweetAlert) {
$scope.downloadAttachment = function () {
var checkedIDs = [];
......@@ -2082,20 +2203,21 @@ taxDocumentManageModule.directive('downLoadModule', function () {
}
});
//是否勾选
if(checkedIDs.length==0){
if (checkedIDs.length == 0) {
return SweetAlert.warning($translate.instant("NeedChecked"));
}
//是否含附件
if((checkedUrls.length==0) || (!checkedUrls[0])){
if ((checkedUrls.length == 0) || (!checkedUrls[0])) {
return SweetAlert.warning($translate.instant('UnRecord'));
}
if(checkedIDs.length === 1 && checkedUrls.length === 1){
if (checkedIDs.length === 1 && checkedUrls.length === 1) {
simpDownload(checkedUrls[0]);
}else{
} else {
multiDownToZip(checkedIDs);
}
};
function simpDownload(url){
function simpDownload(url) {
// if (!url) return SweetAlert.warning($translate.instant("NeedChecked"));
// setTimeout(function () {
var frame = $('<iframe style="display: none;" class="multi-download"></iframe>');
......@@ -2107,13 +2229,13 @@ taxDocumentManageModule.directive('downLoadModule', function () {
// }, 100);
}
function multiDownToZip(ids){
function multiDownToZip(ids) {
if (!ids.length) return SweetAlert.warning($translate.instant("NeedChecked"));
setTimeout(function(){
setTimeout(function () {
taxDocumentListService.downloadAllFile({
"ids":ids
"ids": ids
});
},500);
}, 500);
}
/*$scope.downloadAttachment = function () {
......@@ -2149,13 +2271,12 @@ taxDocumentManageModule.directive('downLoadModule', function () {
}]
}
});
taxDocumentManageModule.directive('exportPlugin',function(){
return{
restrict:"EA",
controller:['$scope','SweetAlert','$translate','taxDocumentListService','$q','$log',
function($scope,SweetAlert,$translate,taxDocumentListService,$q,$log){
$scope.exportTableData = function ()
{
taxDocumentManageModule.directive('exportPlugin', function () {
return {
restrict: "EA",
controller: ['$scope', 'SweetAlert', '$translate', 'taxDocumentListService', '$q', '$log',
function ($scope, SweetAlert, $translate, taxDocumentListService, $q, $log) {
$scope.exportTableData = function () {
$scope.queryFieldModel.currentPage = $scope.pagingOptions.pageIndex;
$scope.queryFieldModel.pageSize = $scope.pagingOptions.pageSize;
......@@ -2167,15 +2288,16 @@ taxDocumentManageModule.directive('exportPlugin',function(){
}
});
var params = angular.copy($scope.queryFieldModel);
params.ids=delIDs;
params.fileBeginTime = getQueryDate(params.fileBeginTime,"-");
params.fileEndTTime = getQueryDate(params.fileEndTTime,"-");
params.ownBeginTime = getQueryDate(params.ownBeginTime,"-");
params.ownEndTime = getQueryDate(params.ownEndTime,"-");
params.effectiveBeginTime = getQueryDate(params.effectiveBeginTime,"-");
params.effectiveEndTime = getQueryDate(params.effectiveEndTime,"-");
params.uploadBeginTime = getQueryDate(params.uploadBeginTime,"-");
params.uploadEndTime = getQueryDate(params.uploadEndTime,"-");
params.ids = delIDs;
params.fileBeginTime = getQueryDate(params.fileBeginTime, "-");
params.fileEndTTime = getQueryDate(params.fileEndTTime, "-");
params.ownBeginTime = getQueryDate(params.ownBeginTime, "-");
params.ownEndTime = getQueryDate(params.ownEndTime, "-");
params.effectiveBeginTime = getQueryDate(params.effectiveBeginTime, "-");
params.effectiveEndTime = getQueryDate(params.effectiveEndTime, "-");
params.uploadBeginTime = getQueryDate(params.uploadBeginTime, "-");
params.uploadEndTime = getQueryDate(params.uploadEndTime, "-");
function getQueryDate(time, mark) {
if (!time) return "";
var theDate = new Date(time);
......@@ -2186,13 +2308,14 @@ taxDocumentManageModule.directive('exportPlugin',function(){
dd = (dd + "").length < 2 ? "0" + dd : dd;
return year + mark + mm + mark + dd;
}
taxDocumentListService.exportTableData(params).then(function (data, status, headers) {
if(status===204){
if (status === 204) {
SweetAlert.warning("没有数据可以下载");
return;
}
exportToExcel(data, 'taxDocument.xls');
},function () {
}, function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
})/*.error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
......@@ -2220,7 +2343,7 @@ taxDocumentManageModule.directive('exportPlugin',function(){
try {
// Try using msSaveBlob if supported
//console.log("Trying saveBlob method ...");
var blob = new Blob([data], { type: "arraybuffer" });
var blob = new Blob([data], {type: "arraybuffer"});
if (navigator.msSaveBlob)
navigator.msSaveBlob(blob, filename);
else {
......@@ -2247,7 +2370,7 @@ taxDocumentManageModule.directive('exportPlugin',function(){
try {
// Prepare a blob URL
//console.log("Trying download link method with simulated click ...");
var blobdownload = new Blob([data], { type: "arraybuffer" });
var blobdownload = new Blob([data], {type: "arraybuffer"});
var urldownload = urlCreator.createObjectURL(blobdownload);
link.setAttribute('href', urldownload);
......@@ -2274,7 +2397,7 @@ taxDocumentManageModule.directive('exportPlugin',function(){
// Prepare a blob URL
// Use application/octet-stream when using window.location to force download
//console.log("Trying download link method with window.location ...");
var blobsuccess = new Blob([data], { type: "arraybuffer" });
var blobsuccess = new Blob([data], {type: "arraybuffer"});
var urlsuccess = urlCreator.createObjectURL(blobsuccess);
window.location = urlsuccess;
//console.log("Download link method with window.location succeeded");
......
......@@ -478,16 +478,18 @@
<span translate="CorporationName"></span>
</div>
<div class="TDL-query-val">
<select ng-model="queryFieldModel.companyName" class="form-control radius3"
title="{{queryFieldModel.companyName}}" required
ng-change="matchCompanyId(queryFieldModel,companyNameOptionsMap)"
placeholder="{{'PleaseSelected' | translate}}">
<option value=""></option>
<option ng-repeat="(key,companyName) in companyNameOptionsMap"
ng-slected="queryFieldModel.companyName == companyName"
value="{{companyName}}">{{companyName}}
</option>
</select>
<div dx-select-box="queryOrgOptions"></div>
<!--<select ng-model="queryFieldModel.companyName" class="form-control radius3"-->
<!--title="{{queryFieldModel.companyName}}" required-->
<!--ng-change="matchCompanyId(queryFieldModel,companyNameOptionsMap)"-->
<!--placeholder="{{'PleaseSelected' | translate}}">-->
<!--<option value=""></option>-->
<!--<option ng-repeat="(key,companyName) in companyNameOptionsMap"-->
<!--ng-slected="queryFieldModel.companyName == companyName"-->
<!--value="{{companyName}}">{{companyName}}-->
<!--</option>-->
<!--</select>-->
</div>
</div>
<div class="TDL-query-block">
......@@ -744,16 +746,18 @@
{{'CorporationName' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%" id="companyNameOptionsMap">
<select ng-model="editFieldModel.companyName" class="form-control"
title="{{editFieldModel.companyName}}" required
ng-change="matchCompanyId(editFieldModel,companyNameOptionsMap)"
placeholder="{{'PleaseSelected' | translate}}">
<option value=""></option>
<option ng-repeat="(key,companyName) in companyNameOptionsMap"
ng-selected="(editFieldModel.companyName == companyName)"
value="{{companyName}}">{{companyName}}
</option>
</select>
<div dx-select-box="editOrgOptions"></div>
<!--<select ng-model="editFieldModel.companyName" class="form-control"-->
<!--title="{{editFieldModel.companyName}}" required-->
<!--ng-change="matchCompanyId(editFieldModel,companyNameOptionsMap)"-->
<!--placeholder="{{'PleaseSelected' | translate}}">-->
<!--<option value=""></option>-->
<!--<option ng-repeat="(key,companyName) in companyNameOptionsMap"-->
<!--ng-selected="(editFieldModel.companyName == companyName)"-->
<!--value="{{companyName}}">{{companyName}}-->
<!--</option>-->
<!--</select>-->
</div>
</div>
<div class="col-sm-6 form-group">
......@@ -986,17 +990,19 @@
{{'CorporationName' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<select ng-model="editFieldItem.companyName" class="form-control"
title="{{editFieldItem.companyName}}"
ng-class="{'upload-fail-mark':!editFieldItem.companyName}"
ng-change="matchCompanyId(editFieldItem,companyNameOptionsMap)"
placeholder="{{'PleaseSelected' | translate}}">
<option value=""></option>
<option ng-repeat="(key,companyName) in companyNameOptionsMap"
ng-selected="(editFieldItem.companyName == companyName)"
value="{{companyName}}">{{companyName}}
</option>
</select>
<div dx-select-box="editFieldItemOrgOptions"></div>
<!--<select ng-model="editFieldItem.companyName" class="form-control"-->
<!--title="{{editFieldItem.companyName}}"-->
<!--ng-class="{'upload-fail-mark':!editFieldItem.companyName}"-->
<!--ng-change="matchCompanyId(editFieldItem,companyNameOptionsMap)"-->
<!--placeholder="{{'PleaseSelected' | translate}}">-->
<!--<option value=""></option>-->
<!--<option ng-repeat="(key,companyName) in companyNameOptionsMap"-->
<!--ng-selected="(editFieldItem.companyName == companyName)"-->
<!--value="{{companyName}}">{{companyName}}-->
<!--</option>-->
<!--</select>-->
</div>
</div>
<div class="col-sm-6 form-group">
......@@ -1398,28 +1404,13 @@
</div>
</div>-->
<div class="modal fade" id="filePreviewPop" file-preview tabindex="-1" role="dialog" aria-labelledby="myModal"
data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width:80%;" role="document">
<div class="modal-content">
<div class="modal-header">
<span class="close" data-dismiss="modal" aria-hidden="true" ng-click="hideFilePreviewPop()">×</span>
<div class="modal-title">{{currentSheetName}}</div>
</div>
<div class="modal-body">
<div class="dx-viewport demo-container" id="preview_dataGrid">
</div>
</div>
</div>
<button class="TDL-pdf-paging-btn TDL-pdf-paging-btn-prev" ng-click="prevPaging_xls()" title="上一页">&lt;
</button>
<button class="TDL-pdf-paging-btn TDL-pdf-paging-btn-next" ng-click="nextPaging_xls()" title="下一页">&gt;
</button>
<div class="TDL-pdf-layout-dialog" id="filePreviewPop" file-preview >
<div class="wrapper TDL-pdf-preview-pop" id="excetlContainer">
</div>
</div>
<button class="TDL-pdf-preview-pop-close-btn" ng-click="hideFilePreviewPop()">×</button>
</div>
<div class="modal fade" id="uploadResultPop" tabindex="-1" role="dialog" aria-labelledby="myModal"
data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width:60%;max-width:960px" role="document">
......
......@@ -165,6 +165,33 @@ taxDocumentManageModule.factory('taxDocumentListService',
xhr.send(JSON.stringify(params));
return defer.promise;
},
viewExcelBySpread:function (url) {
var deferred = $q.defer();
var promise = deferred.promise;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob
// 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
xhr.onload = function () {
// 请求完成
if (this.status === 200) {
// 返回200
var blob = this.response;
var excelIo = new GC.Spread.Excel.IO();
excelIo.open(blob, function (json) {
deferred.resolve(json);
}, function (e) {
// console.error(e.errorMessage);
//alert(e.errorMessage);
deferred.reject(e.errorMessage);
}, {});
}
};
// 发送ajax请求
xhr.send();
return promise;
}
};
}]);
\ 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