Commit 149d174c authored by chase's avatar chase

merge 档案管理

parent 01764c35
......@@ -109,6 +109,21 @@ public class DateUtils {
return dateString;
}
/**
* 根据yyyyMMdd时间格式字符串,格式化为date类型
*
* @param dateStr
* @return
*/
public static Date stringToDate4yyyyMMdd(String dateStr) {
try {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
Date date = formatter.parse(dateStr);
return date;
} catch (ParseException e) {
return null;
}
}
/**
* 将短时间格式字符串转换为区间格式 yyyyMM
*
......
......@@ -105,6 +105,13 @@ public class TaxDocumentController {
}
return taxDocumentService.editFilesType(taxDocument);
}
@GetMapping("/multipalInitData")
@ResponseBody
public Map<String,Object> multipalInitData(String address){
//地址示例: D://multipaiInitData
return taxDocumentService.multipalInitData(address);
}
@RequestMapping("exportExcel")
@ResponseBody
public void exportExcelFile(HttpServletResponse response, @RequestBody TaxDocumentDto taxDocumentDto) {
......
package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -9,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.FileUploadEnum;
import pwc.taxtech.atms.constant.enums.ReportFileUploadEnum;
import pwc.taxtech.atms.dao.TaxDocumentMapper;
......@@ -16,6 +19,7 @@ import pwc.taxtech.atms.dto.TaxDocumentDto;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.entity.OperationLogTaxDocument;
import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.TaxDocument;
import pwc.taxtech.atms.entity.TaxDocumentExample;
import pwc.taxtech.atms.vat.entity.FileUpload;
......@@ -168,6 +172,8 @@ public class TaxDocumentServiceImpl {
if (StringUtils.isNotBlank(taxDocumentDto.getCreator())) {
criteria.andCreatorLike("%" + taxDocumentDto.getCreator() + "%");
}
//设置查询可用的数据
criteria.andEnableEqualTo("T");
example.setOrderByClause("create_time DESC");
return example;
}
......@@ -207,7 +213,6 @@ public class TaxDocumentServiceImpl {
taxDocument.setCreator(authUserHelper.getCurrentAuditor().get());
taxDocument.setCreatorId(authUserHelper.getCurrentUserId());
taxDocument.setUploadTime(new Date());
taxDocument.setAuditStatus(0);
taxDocument.setYearRedundancy(Calendar.getInstance().get(Calendar.YEAR));
//根据公司Id 设置业务线
String businessLine = organizationService.queryBusinessByCompanyId(taxDocument.getCompanyId());
......@@ -353,7 +358,10 @@ public class TaxDocumentServiceImpl {
criteria.andFileTypeEqualTo(taxDocument.getFileType());
criteria.andFileNameEqualTo(taxDocument.getFileName());
criteria.andCompanyNameEqualTo(taxDocument.getCompanyName());
criteria.andOwnTimeEqualTo(taxDocument.getOwnTime());
criteria.andEnableEqualTo("T");
if (null != taxDocument.getOwnTime()){
criteria.andOwnTimeEqualTo(taxDocument.getOwnTime());
}
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(taxDocumentExample);
if (null != taxDocuments && taxDocuments.size() > 0) {
return taxDocuments.get(0);
......@@ -589,4 +597,500 @@ public class TaxDocumentServiceImpl {
}
}
public Map<String,Object> multipalInitData(String address) {
if (StringUtils.isBlank(address)){
throw new RuntimeException("地址格式错误");
}
Map<String, Object> resultMap = Maps.newHashMap();
//初始化一个错误文件名列表 和 正确文件名列表
ArrayList<String> errorFileNameList = Lists.newArrayList();
ArrayList<String> successFileNameList = Lists.newArrayList();
ArrayList<String> existedFileNameList = Lists.newArrayList();
//读取固定文件目录下的所有文件的文件名
File file = new File(address);
if (!file.isDirectory() || !file.exists()){
throw new RuntimeException("文件夹地址错误");
}
List<File> files = Arrays.asList(file.listFiles());
if (files.size()<1){
throw new RuntimeException("文件列表为空");
}
List<String> fileNames = files.stream().filter(e -> e.isFile()).map(File::getName).collect(Collectors.toList());
if (fileNames.size()<1){
throw new RuntimeException("文件列表为空");
}
//公司名简称和公司序号Map(name-id)
Map<String, String> companyNameAndId;
try {
companyNameAndId = organizationService.findAllOrganizations().stream().collect(Collectors.toMap(Organization::getAbbreviation, Organization::getId));
} catch (Exception e) {
throw new RuntimeException("公司简称和id获取失败!请联系管理员");
}
if (companyNameAndId.size() < 1) {
throw new RuntimeException("公司名称列表无数据!");
}
fileNames.forEach(fileName -> {
//文件名校验 如果文件名中不包含_则不符合规则,添加到错误列表中
if (!fileName.contains("_")) {
errorFileNameList.add(fileName);
return;//此处相当于continue
}
//根据文件名格式分割,以 "_"来分割
List<String> params = Arrays.asList(fileName.substring(0,fileName.indexOf(".")).split("_"));
//根据分割的长度来进行匹配对比 如果长度<3或者>6或公司简称匹配不上则添加至失败列表(目前最少的是3个,若以后有更改请更改此处参数)
if (params.size() < 3 || params.size() > 6 || !companyNameAndId.containsKey(params.get(0))) {
errorFileNameList.add(fileName);
return;//此处相当于continue
}
//根据档案类型匹配并初始化值
matchFileTypeToInitData(errorFileNameList, successFileNameList, existedFileNameList, companyNameAndId, fileName, params);
});
//返回成功列表和失败列表
resultMap.put("successFileNameList",successFileNameList);
resultMap.put("errorFileNameList",errorFileNameList);
resultMap.put("existedFileNameList",existedFileNameList);
return resultMap;
}
//初始化税种列表(后续可做成从数据库中拿)
private final static List<String> taxsList = Arrays.asList("纳税申报表", "税票", "企业所得税", "印花税", "附加税", "代扣代缴税", "其它税", "增值税");
/**
* 分组 长度为3
*/
//档案类型分组:公司簡稱_档案类型_文件生效日期
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
*/
//档案类型分组:公司簡稱_档案类型_所属期间_文件生效日期
private final static Map<String, String> groupOfCompanyFileTypeOwnTimeFileTime = Maps.newHashMap();
//档案类型分组:公司簡稱_档案类型_所属期间_到期日
private final static Map<String, String> groupOfCompanyFileTypeOwnTimeEffectiveTime = Maps.newHashMap();
//档案类型分组:公司簡稱_档案属性_档案类型_所属期间(国际档案类型)
private final static Map<String, String> internationalGroupOfCompanyFileAttrFileTypeOwnTime = Maps.newHashMap();
/**
* 分组 长度为5
*/
//档案类型分组:公司簡稱_档案类型_税种_所属期间_文件生效日期
private final static Map<String, String> groupOfCompanyFileTypeTaxTypeOwnTimeFileTime = Maps.newHashMap();
//档案类型分组:公司簡稱_档案属性_档案类型_税种_所属期间(国际档案类型)
private final static Map<String, String> internationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime = Maps.newHashMap();
/**
* 分组 长度为6
*/
//档案类型分组:公司簡稱_档案类型_所属期间_文件生效日期_实物存放地点_实物保管人
private final static Map<String, String> groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper = Maps.newHashMap();
//初始化档案类型-档案属性map列表(后续可做成从数据库中拿)
static {
//添加分组
//公司簡稱_档案类型_文件生效日期中
setGroupOfCompanyFileTypeFIleTime();
//公司簡稱_档案类型_到期日
setGroupOfCompanyFileTypeEffectiveTime();
//公司簡稱_档案属性_档案类型
setInternationalGroupOfCompanyFileAttrFileType();
//公司簡稱_档案类型_所属期间_文件生效日期
setGroupOfCompanyFileTypeOwnTimeFileTime();
//公司簡稱_档案类型_所属期间_到期日
setGroupOfCompanyFileTypeOwnTimeEffectiveTime();
//公司簡稱_档案属性_档案类型_所属期间
setInternationalGroupOfCompanyFileAttrFileTypeOwnTime();
//公司簡稱_档案类型_税种_所属期间_文件生效日期
setGroupOfCompanyFileTypeTaxTypeOwnTimeFileTime();
//公司簡稱_档案属性_档案类型_税种_所属期间(国际档案类型)
setInternationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime();
//公司簡稱_档案类型_所属期间_文件生效日期_实物存放地点_实物保管人
setGroupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper();
}
/**
* 公司簡稱_档案类型_文件生效日期
*/
private static void setGroupOfCompanyFileTypeFIleTime() {
groupOfCompanyFileTypeFIleTime.put("设立税务登记资料", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("变更税务登记资料", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("注销税务登记资料", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("扣缴义务人登记资料", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("存款账户账号备案资料", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("财务会计制度备案资料", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("外出经营报验登记", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("税源管理项目资料", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("委托代征登记资料、损毁01 税务登记类", "01 税务登记类");
groupOfCompanyFileTypeFIleTime.put("发票挂失、损毁、丢失资料", "06 发票管理类");
groupOfCompanyFileTypeFIleTime.put("发票领购资料", "06 发票管理类");
groupOfCompanyFileTypeFIleTime.put("发票核销资料", "06 发票管理类");
groupOfCompanyFileTypeFIleTime.put("开具红字发票资料", "06 发票管理类");
groupOfCompanyFileTypeFIleTime.put("非居民享受税收协定待遇认定", "02 税务认定类");
}
/**
* 公司簡稱_档案类型_到期日
*/
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 setGroupOfCompanyFileTypeOwnTimeFileTime() {
groupOfCompanyFileTypeOwnTimeFileTime.put("重点税源申报表", "04 申报征收类");
groupOfCompanyFileTypeOwnTimeFileTime.put("千户集团申报表", "04 申报征收类");
groupOfCompanyFileTypeOwnTimeFileTime.put("年度减免税调查表", "04 申报征收类");
groupOfCompanyFileTypeOwnTimeFileTime.put("全国税收调查表", "04 申报征收类");
groupOfCompanyFileTypeOwnTimeFileTime.put("重点税源计算底稿", "07 内部文件类");
groupOfCompanyFileTypeOwnTimeFileTime.put("千户集团计算底稿", "07 内部文件类");
groupOfCompanyFileTypeOwnTimeFileTime.put("年度减免税调查计算底稿", "07 内部文件类");
groupOfCompanyFileTypeOwnTimeFileTime.put("全国税收调查计算底稿", "07 内部文件类");
groupOfCompanyFileTypeOwnTimeFileTime.put("关联业务往来报告表", "04 申报征收类");
}
/**
* 公司簡稱_档案类型_所属期间_到期日
*/
private static void setGroupOfCompanyFileTypeOwnTimeEffectiveTime() {
groupOfCompanyFileTypeOwnTimeEffectiveTime.put("审计报告", "05 外部鉴证类");
groupOfCompanyFileTypeOwnTimeEffectiveTime.put("税审报告", "05 外部鉴证类");
groupOfCompanyFileTypeOwnTimeEffectiveTime.put("财产损失报告", "05 外部鉴证类");
groupOfCompanyFileTypeOwnTimeEffectiveTime.put("其他鉴证报告", "05 外部鉴证类");
}
/**
* 公司簡稱_档案类型_所属期间_到期日
*/
private static void setInternationalGroupOfCompanyFileAttrFileTypeOwnTime() {
internationalGroupOfCompanyFileAttrFileTypeOwnTime.put("Other tax return and supporting", "International tax - Tax Filling");
internationalGroupOfCompanyFileAttrFileTypeOwnTime.put("FS and GL", "International tax - Financial statements");
internationalGroupOfCompanyFileAttrFileTypeOwnTime.put("Audited report", "International tax - Audited report");
}
/**
* 公司簡稱_档案类型_税种_所属期间_文件生效日期
*/
private static void setGroupOfCompanyFileTypeTaxTypeOwnTimeFileTime() {
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("增值税纳税申报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("企业所得税预缴申报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("企业所得税汇算清缴申报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("财务会计报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("印花税申报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("附加税费申报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("代扣代缴税申报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("其它税(费)申报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("增值税缴税银行回单", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("企业所得税缴税银行回单", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("企业所得税汇算清缴缴税银行回单/退税银行回单", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("印花税缴税银行回单", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("附加税费缴税银行回单", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("代扣代缴缴税银行回单", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("其它税(费)缴税银行回单", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("增值税更正申报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("企业所得税更正申报表", "04 申报征收类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("增值税及附加税费计算底稿", "07 内部文件类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("企业所得税预缴计算底稿", "07 内部文件类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("企业所得税汇算清缴计算底稿", "07 内部文件类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("印花税计算底稿", "07 内部文件类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("代扣代缴税计算底稿", "07 内部文件类");
groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.put("其它税(费)计算底稿", "07 内部文件类");
}
/**
* 公司簡稱_档案属性_档案类型_税种_所属期间(国际档案类型)
*/
private static void setInternationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime() {
internationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime.put("CIT Return and supporting", "International tax - Tax Filling");
internationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime.put("VAT return and supporting", "International tax - Tax Filling");
}
/**
* 公司簡稱_档案类型_所属期间_文件生效日期_实物存放地点_实物保管人
*/
private static void setGroupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper() {
groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper.put("发票代开资料", "06 发票管理类");
}
/**
* 构建基础对象 设置基础值 公司简称 Id 档案属性 档案类型
*
* @return
*/
private TaxDocument buildBaseTaxDocument(Map<String, String> companyNameAndId, List<String> params ,String fileName) {
TaxDocument taxDocument = new TaxDocument();
taxDocument.setFileName(fileName);
taxDocument.setCompanyId(companyNameAndId.get(params.get(0)));
taxDocument.setCompanyName(params.get(0));
taxDocument.setCreateTime(new Date());
taxDocument.setUpdateTime(new Date());
taxDocument.setCreator(authUserHelper.getCurrentAuditor().get());
taxDocument.setCreatorId(authUserHelper.getCurrentUserId());
taxDocument.setUploadTime(new Date());
taxDocument.setYearRedundancy(Calendar.getInstance().get(Calendar.YEAR));
//根据公司Id 设置业务线
String businessLine = organizationService.queryBusinessByCompanyId(taxDocument.getCompanyId());
if (StringUtils.isNotBlank(businessLine)) {
taxDocument.setBusinessLine(businessLine);
}
return taxDocument;
}
/**
* 根据档案类型匹配并初始化值
* @param errorFileNameList
* @param successeFileNameList
* @param companyNameAndId
* @param fileName
* @param params
*/
private void matchFileTypeToInitData(ArrayList<String> errorFileNameList, ArrayList<String> successeFileNameList, ArrayList<String> existedFileNameList, Map<String, String> companyNameAndId, String fileName, List<String> params) {
//长度为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,fileName);
//设置档案属性 档案类型
taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2));
//校验是否已存在
if (null == queryWhetherData(taxDocument).getId()){
//插入数据
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 3//公司簡稱_档案类型_文件生效日期
&& groupOfCompanyFileTypeFIleTime.keySet().contains(params.get(1))
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(2))){//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName);
//设置档案属性 档案类型 文件生效日期
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeFIleTime.get(params.get(1)));
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(2)));
if (null == queryWhetherData(taxDocument).getId()){
//插入数据
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 3//公司簡稱_档案类型_到期日
&& groupOfCompanyFileTypeEffectiveTime.keySet().contains(params.get(1))
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(2))){//到期日校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName);
//设置档案属性 档案类型 到期日
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeEffectiveTime.get(params.get(1)));
taxDocument.setEffectiveTime(DateUtils.stringToDate4yyyyMMdd(params.get(2)));
if (null == queryWhetherData(taxDocument).getId()){
//插入数据
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 4 //国际类型 公司簡稱_档案属性_档案类型_所属期间
&& (internationalGroupOfCompanyFileAttrFileTypeOwnTime.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileTypeOwnTime.values().contains(params.get(1)))
&& checkOwnTime(params.get(3))){//所属期间校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName);
//设置档案属性 档案类型 所属期间
taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2));
taxDocument.setOwnTime(Integer.valueOf(params.get(3)));
if (null == queryWhetherData(taxDocument).getId()){
//插入数据
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 4 //公司簡稱_档案类型_所属期间_文件生效日期
&& groupOfCompanyFileTypeOwnTimeFileTime.keySet().contains(params.get(1))
&& checkOwnTime(params.get(2))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName);
//设置档案类型 档案属性 所属期间 文件生效日期
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)));
if (null == queryWhetherData(taxDocument).getId()){
//插入数据
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 4 //公司簡稱_档案类型_所属期间_到期日
&& groupOfCompanyFileTypeOwnTimeEffectiveTime.keySet().contains(params.get(1))
&& checkOwnTime(params.get(2))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//到期日校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName);
//设置档案类型 档案属性 所属期间 到期日
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)));
if (null == queryWhetherData(taxDocument).getId()){
//插入数据
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}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))){//所属期间校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName);
//设置档案属性 档案类型 税种 所属期间
taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2));
taxDocument.setTaxType(params.get(3));
taxDocument.setOwnTime(Integer.valueOf(params.get(4)));
if (null == queryWhetherData(taxDocument).getId()){
//插入数据
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}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))){//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName);
//设置档案类型 档案属性 税种 所属期间 文件生效日期
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.get(params.get(1)));
taxDocument.setTaxType(params.get(2));
taxDocument.setOwnTime(Integer.valueOf(params.get(3)));
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(4)));
if (null == queryWhetherData(taxDocument).getId()){
//插入数据
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 6 //公司簡稱_档案类型_所属期间_文件生效日期_实物存放地点_实物保管人
&& groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper.keySet().contains(params.get(1))
&& checkOwnTime(params.get(2))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName);
//设置档案类型 档案属性 所属期间 文件生效日期 实物存放地点 实物保管人
taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper.get(params.get(1)));
taxDocument.setOwnTime(Integer.valueOf(params.get(2)));
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(3)));
taxDocument.setStorageArea(params.get(4));
taxDocument.setKeeper(params.get(5));
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
errorFileNameList.add(fileName);
}
}
/**
* 检查所属期间转换是否正常
* @param s
* @return
*/
private boolean checkOwnTime(String s) {
try {
return Integer.valueOf(s) == null ? false : true;
} catch (NumberFormatException e) {
log.error("所属期间转换异常: " + s);
return false;
}
}
}
......@@ -67,7 +67,6 @@
</trim>
</if>
</foreach>
and enable = 'T'
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
......@@ -151,13 +150,16 @@
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="batchDelete">
DELETE FROM tax_document
<update id="batchDelete">
UPDATE tax_document
SET
enable = 'F'
WHERE id IN
<foreach collection="list" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
AND enable = 'T'
</update>
<delete id="deleteByExample" parameterType="pwc.taxtech.atms.entity.TaxDocumentExample">
<!--
......
......@@ -56,5 +56,6 @@
"PreviewFile":"PreviewFile",
"UploadSuccessCount":"UploadSuccessCount",
"UploadFailCount":"UploadFailCount",
"DeleteConfirm":"DeleteConfirm"
"DeleteConfirm":"DeleteConfirm",
"FileTimeDateRangeError":"FileTimeDateRangeError"
}
\ No newline at end of file
......@@ -55,7 +55,8 @@
"Edit":"编辑",
"DocumentPath":"档案路径",
"PreviewFile":"预览文件",
"UploadSuccessCount":"个档案上传成功",
"UploadFailCount":"个档案上传失败",
"DeleteConfirm":"是否确认删除记录?"
"UploadSuccessCount":"个档案上传成功:",
"UploadFailCount":"个档案上传失败:",
"DeleteConfirm":"是否确认删除记录?",
"FileTimeDateRangeError": "'到期日'不能早于'文件生效日期'"
}
\ No newline at end of file
......@@ -11,6 +11,14 @@ frameworkModule.controller('appUsrOperateLogController',
$scope.loadMainData = function () {
$scope.thisModuleId = $scope.thisModuleId ? $scope.thisModuleId : [];
if($scope.thisModuleId.length===0){
$("input[name='dataGridCheckBox']").each(function (index, item) {
if (item.checked) {
var cellId = $(item).attr("data-id");
$scope.thisModuleId.push(cellId);
}
});
}
var config = {
// params: {
"ids":$scope.thisModuleId
......@@ -21,6 +29,7 @@ frameworkModule.controller('appUsrOperateLogController',
SweetAlert.warning("没有数据可以下载");
return;
}
$scope.thisModuleId=[];//清空查询id
$scope.dataGridUpdate(data);
})
};
......
......@@ -340,6 +340,12 @@ taxDocumentManageModule.controller('taxDocumentListController',
var simpleUploadSubmit = function () {
var params = angular.copy($scope.editFieldModel);
if (!PWC.isNullOrEmpty(params.fileTime) && !PWC.isNullOrEmpty(params.fileTime) &&
params.fileTime > params.effectiveTime)
{
window.swal($translate.instant('FileTimeDateRangeError'));
return;
}
// params.ownTime = params.ownTime ? params.ownTime : "";
// var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/";
// params.ownTime = parseInt(params.ownTime.split(splitMark).join(""));
......@@ -383,19 +389,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
// addLogicAfterUploadFile($scope.editFieldModel,'simple');
} else {
//覆盖行为-需上传参数
for (var name in data) {
if((data[name]==null) || (name=='createTime'|| name=='updateTime' || name=='fileName'
|| name=='fileAttr' || name=='fileType'|| name=='fileTypeId' || name=='companyName'|| name=='companyId'
|| name=='taxType' || name=='ownTime' || name=='effectiveTime'|| name=='fileTime')){
continue;
}
if(name=='uploadTime'|| name=='fileTime'|| name=='effectiveTime'){
data[name] = $scope.getQueryDate(data[name], "/")
}
var cover_fields={};
cover_fields[name] = data[name];
uploadItem.formData.push(cover_fields);
}
uploadItem.formData.push({id:data.id});
SweetAlert.swal({
title: '提示',
text: $translate.instant("CoverConfirm"),
......@@ -459,69 +453,102 @@ taxDocumentManageModule.controller('taxDocumentListController',
};
var editDocFileRecord = function (fieldModel, type) {
SweetAlert.swal({
title: '提示',
text: $translate.instant("CoverConfirm"),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
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] = "";
});
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.updateTime ? params.updateTime = $scope.getQueryDate(params.updateTime, "/") : delete params.updateTime;
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) {
if (data == true) {
if (type == 'simple') {
SweetAlert.swal({
title: $translate.instant("Edited"),
type: "success",
confirmButtonText: $translate.instant('Confirm'),
closeOnConfirm: true
},
function (isConfirm) {
if (isConfirm) $scope.loadMainData();
});
} else {
if ($scope.multiUploadSuccessItems.length == 0) {
SweetAlert.swal({
title: $translate.instant("Uploaded"),
type: "success",
confirmButtonText: $translate.instant('Confirm'),
closeOnConfirm: true
},
function (isConfirm) {
if (isConfirm) $scope.loadMainData();
});
}
}
} else {
SweetAlert.warning($translate.instant('SaveFail'));
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.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.filePositionUrl = encodeURIComponent(params.filePositionUrl);
taxDocumentListService.verifyDuplicate(params).then(function (result) {
// 例如 修改1为1 不用弹框 修改1本身就好 但是修改1为2 ,就要去掉1并修改2(保留2的id)
if (result.id==fieldModel.id) {
editRecord_Post(fieldModel,type);
}else{
var hisCellId=result.id;
var CellId=fieldModel.id;
SweetAlert.swal({
title: '提示',
text: $translate.instant("CoverConfirm"),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
fieldModel.id=hisCellId;
editRecord_Post(fieldModel,type);
delHisRecord(CellId);
}
});
}
});
}
});
$('#simpleUploadPopDialog').modal('hide');
$('#multiUploadPopDialog').modal('hide');
};
function editRecord_Post(fieldModel,type){
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] = "";
});
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.updateTime ? params.updateTime = $scope.getQueryDate(params.updateTime, "/") : delete params.updateTime;
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) {
if (data == true) {
if (type == 'simple') {
SweetAlert.swal({
title: $translate.instant("Edited"),
type: "success",
confirmButtonText: $translate.instant('Confirm'),
closeOnConfirm: true
},
function (isConfirm) {
if (isConfirm) $scope.loadMainData();
});
} else {
if ($scope.multiUploadSuccessItems.length == 0) {
SweetAlert.swal({
title: $translate.instant("Uploaded"),
type: "success",
confirmButtonText: $translate.instant('Confirm'),
closeOnConfirm: true
},
function (isConfirm) {
if (isConfirm) $scope.loadMainData();
});
}
}
} else {
SweetAlert.warning($translate.instant('SaveFail'));
}
});
}
function delHisRecord(cellId){
var delIDs = [];
delIDs.push(cellId);
taxDocumentListService.delFileRecordItems({
"ids":delIDs
}).then(function (data) {
if (data) {}
});
};
//取消
var cancelDocFileType = function () {
$scope.multiUploadSuccessItems.length = 0;
......@@ -920,19 +947,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
_multiUploader.uploadItem(_i);
} else {
//覆盖行为-需上传参数
for (var name in data) {
if((data[name]==null) || (name=='createTime'|| name=='updateTime' || name=='fileName'
|| name=='fileAttr' || name=='fileType'|| name=='fileTypeId' || name=='companyName'|| name=='companyId'
|| name=='taxType' || name=='ownTime' || name=='effectiveTime'|| name=='fileTime')){
continue;
}
if(name=='uploadTime'|| name=='fileTime'|| name=='effectiveTime'){
data[name] = $scope.getQueryDate(data[name], "/")
}
var cover_fields={};
cover_fields[name] = data[name];
_fileItem.formData.push(cover_fields);
}
_fileItem.formData.push({id:data.id});
var Cover_Confirm="'"+data.fileName+"' 记录已经存在,是否进行覆盖?";
SweetAlert.swal({
title: '提示',
......@@ -951,6 +966,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
_multiUploader.uploadItem(_i);
}
})
}
});
})(i, fileItem, editFieldModel, taxDocumentListService, $scope.multiUploader);
......@@ -1121,19 +1137,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
_multiUploader.uploadItem(_i);
} else {
//覆盖行为-需上传参数
for (var name in data) {
if((data[name]==null) || (name=='createTime'|| name=='updateTime' || name=='fileName'
|| name=='fileAttr' || name=='fileType'|| name=='fileTypeId' || name=='companyName'|| name=='companyId'
|| name=='taxType' || name=='ownTime' || name=='effectiveTime'|| name=='fileTime')){
continue;
}
if(name=='uploadTime'|| name=='fileTime'|| name=='effectiveTime'){
data[name] = $scope.getQueryDate(data[name], "/")
}
var cover_fields={};
cover_fields[name] = data[name];
_fileItem.formData.push(cover_fields);
}
_fileItem.formData.push({id:data.id});
var Cover_Confirm="'"+data.fileName+"' 记录已经存在,是否进行覆盖?";
SweetAlert.swal({
title: '提示',
......@@ -1152,7 +1156,6 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
_multiUploader.uploadItem(_i);
}
})
}
});
......@@ -1987,6 +1990,14 @@ taxDocumentManageModule.directive('downLoadModule', function () {
checkedUrls.push(cellUrl);
}
});
//是否勾选
if(checkedIDs.length==0){
return SweetAlert.warning($translate.instant("NeedChecked"));
}
//是否含附件
if((checkedUrls.length==0) || (!checkedUrls[0])){
return SweetAlert.warning($translate.instant('UnRecord'));
}
if(checkedIDs.length === 1 && checkedUrls.length === 1){
simpDownload(checkedUrls[0]);
}else{
......@@ -1994,8 +2005,7 @@ taxDocumentManageModule.directive('downLoadModule', function () {
}
};
function simpDownload(url){
if (!url) return SweetAlert.warning($translate.instant("NeedChecked"));
// if (!url) return SweetAlert.warning($translate.instant("NeedChecked"));
// setTimeout(function () {
var frame = $('<iframe style="display: none;" class="multi-download"></iframe>');
frame.attr('src', url);
......
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