Commit 488b8c42 authored by zhkwei's avatar zhkwei

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

parents d2292a10 ddc6e98b
......@@ -39,6 +39,20 @@ public class FileTypesController {
return returnData;
}
/**
* 查询档案文件类型列表-可用
* @return
*/
@RequestMapping("/selectEnableList")
@ResponseBody
public ReturnData selectEnableFileTypesList(){
List<FileTypes> fileTypes = fileTypesService.selectEnableFileTypesList();
ReturnData returnData = new ReturnData();
returnData.setItems(fileTypes);
returnData.setTotalCount(fileTypes.size());
return returnData;
}
/**
* 查询档案属性和档案类型给前端下拉选择框
* @return
......@@ -93,10 +107,10 @@ public class FileTypesController {
public void exportExcelFile (HttpServletResponse response){
try {
Map<String, String> headers = new LinkedHashMap<>();
headers.put("id", "id");
headers.put("id", "序号");
headers.put("file_attr", "档案属性");
headers.put("file_type", "档案类型");
headers.put("file_type", "必填字段");
headers.put("required_field", "必填字段");
headers.put("description", "说明");
headers.put("creator", "办事人");
headers.put("create_time", "创建时间");
......
......@@ -36,6 +36,13 @@ public class FileTypesServiceImpl {
return fileTypesMapper.selectByExample(example);
}
public List<FileTypes> selectEnableFileTypesList() {
FileTypesExample example = new FileTypesExample();
FileTypesExample.Criteria criteria = example.createCriteria();
criteria.andStatusEqualTo("1");
return fileTypesMapper.selectByExample(example);
}
/**
* 查询档案属性和档案类型给前端下拉选择框
* @return
......@@ -70,7 +77,7 @@ public class FileTypesServiceImpl {
return false;
}
} catch (Exception e) {
log.error("FileTypesServiceImpl addFileTypesList error : " + e.getMessage());
// log.error("FileTypesServiceImpl addFileTypesList error : " + e.getMessage());
return false;
}
}
......@@ -93,7 +100,7 @@ public class FileTypesServiceImpl {
return false;
}
} catch (Exception e) {
log.error("FileTypesServiceImpl deleteFileTypes error : " + e.getMessage());
// log.error("FileTypesServiceImpl deleteFileTypes error : " + e.getMessage());
return false;
}
}
......@@ -121,7 +128,7 @@ public class FileTypesServiceImpl {
return false;
}
} catch (Exception e) {
log.error("FileTypesServiceImpl editFilesType error : " + e.getMessage());
// log.error("FileTypesServiceImpl editFilesType error : " + e.getMessage());
return false;
}
}
......
......@@ -211,7 +211,7 @@ public class TaxDocumentServiceImpl {
return false;
}
} catch (Exception e) {
log.error("TaxDocumentServiceImpl addTaxDocument error : " + e.getMessage());
// log.error("TaxDocumentServiceImpl addTaxDocument error : " + e.getMessage());
return false;
}
}
......@@ -234,7 +234,7 @@ public class TaxDocumentServiceImpl {
return false;
}
} catch (Exception e) {
log.error("TaxDocumentServiceImpl deleteTaxDocument error : " + e.getMessage());
// log.error("TaxDocumentServiceImpl deleteTaxDocument error : " + e.getMessage());
return false;
}
}
......@@ -267,7 +267,7 @@ public class TaxDocumentServiceImpl {
}
return true;
} catch (Exception e) {
log.error("TaxDocumentServiceImpl batchDelete error : " + e.getMessage());
// log.error("TaxDocumentServiceImpl batchDelete error : " + e.getMessage());
return false;
}
}
......@@ -292,7 +292,7 @@ public class TaxDocumentServiceImpl {
return false;
}
} catch (Exception e) {
log.error("TaxDocumentServiceImpl updateTaxDocument error : " + e.getMessage());
// log.error("TaxDocumentServiceImpl updateTaxDocument error : " + e.getMessage());
return false;
}
}
......@@ -341,7 +341,7 @@ public class TaxDocumentServiceImpl {
}
return true;
} catch (Exception e) {
log.error("TaxDocumentServiceImpl queryWhetherData error :" + e.getMessage());
// log.error("TaxDocumentServiceImpl queryWhetherData error :" + e.getMessage());
return false;
}
}
......@@ -360,8 +360,7 @@ public class TaxDocumentServiceImpl {
//文件名称(带后缀) 文件名前+7位uuid截取码以防文件名相同
String fileName = StringUtils.isBlank(taxDocument.getFileName())
? "未知文件(请修改后缀名).xlsx"
: UUID.randomUUID().toString().substring(0, 6) + "_" + taxDocument.getFileOriginalName();
//设置输出流信息
: taxDocument.getFileOriginalName();//设置输出流信息
try {
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(fileName, "UTF-8"));
......@@ -398,27 +397,27 @@ public class TaxDocumentServiceImpl {
out.write(buffer, 0, len);
}
} catch (IOException e) {
log.error("单个附件下载异常:" + e.getMessage());
// log.error("单个附件下载异常:" + e.getMessage());
} finally {
if (null != out) {
try {
out.close();
} catch (IOException e) {
log.error("关闭输出流错误:" + e.getMessage());
// log.error("关闭输出流错误:" + e.getMessage());
}
}
if (null != is) {
try {
is.close();
} catch (IOException e) {
log.error("关闭输入流错误:" + e.getMessage());
// log.error("关闭输入流错误:" + e.getMessage());
}
}
if (null != in) {
try {
in.close();
} catch (IOException e) {
log.error("关闭缓存输入流错误:" + e.getMessage());
// log.error("关闭缓存输入流错误:" + e.getMessage());
}
}
}
......@@ -441,20 +440,20 @@ public class TaxDocumentServiceImpl {
downloadTolocal(zos, ids);
} catch (IOException e) {
log.error("downloadAllFile-xxx下载全部附件失败,ids=[{}],错误信息=[{}]", ids, e);
// log.error("downloadAllFile-xxx下载全部附件失败,ids=[{}],错误信息=[{}]", ids, e);
} finally {
if (zos != null) {
try {
zos.close();
} catch (Exception e2) {
log.info("关闭输入流时出现错误", e2);
// log.info("关闭输入流时出现错误", e2);
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (Exception e2) {
log.info("关闭输入流时出现错误", e2);
// log.info("关闭输入流时出现错误", e2);
}
}
......@@ -487,7 +486,7 @@ public class TaxDocumentServiceImpl {
//文件名称(带后缀) 文件名前+7位uuid截取码以防文件名相同
String fileName = StringUtils.isBlank(item.getFileName())
? "未知文件(请修改后缀名).xlsx"
: UUID.randomUUID().toString().substring(0, 6) + "_" + item.getFileName();
: item.getFileName();
InputStream is = null;
BufferedInputStream in = null;
byte[] buffer = new byte[1024];
......@@ -519,27 +518,27 @@ public class TaxDocumentServiceImpl {
zos.write(buffer, 0, len);
}
} catch (Exception e) {
log.info("xxx--下载全部附件--压缩文件出错", e);
// log.info("xxx--下载全部附件--压缩文件出错", e);
} finally {
if (entry != null) {
try {
zos.closeEntry();
} catch (Exception e2) {
log.info("xxx下载全部附件--zip实体关闭失败", e2);
// log.info("xxx下载全部附件--zip实体关闭失败", e2);
}
}
if (in != null) {
try {
in.close();
} catch (Exception e2) {
log.info("xxx下载全部附件--文件输入流关闭失败", e2);
// log.info("xxx下载全部附件--文件输入流关闭失败", e2);
}
}
if (is != null) {
try {
is.close();
} catch (Exception e) {
log.info("xxx下载全部附件--输入缓冲流关闭失败", e);
// log.info("xxx下载全部附件--输入缓冲流关闭失败", e);
}
}
......
......@@ -48,25 +48,26 @@ file_upload_post_url=${file_upload_post_url}
file_upload_query_url=${file_upload_query_url}
#didi-config
#是否调用滴滴ticket接口
#是否调用滴滴ticket接口
check_ticket=${check_ticket}
#滴滴SSO地址
#滴滴SSO地址
get_user_info_url=${get_user_info_url}
#滴滴备案TMS系统appId
#滴滴备案TMS系统appId
app_id=${app_id}
#滴滴备案TMS系统appKey
#滴滴备案TMS系统appKey
app_key=${app_key}
#cookie最大时长
#cookie最大时长
cookie.maxAgeSeconds=${cookie.maxAgeSeconds}
#机构信息同步地址
#机构信息同步地址
org_sync_url=${org_sync_url}
#机构信息同步token
#机构信息同步token
org_sync_token=${org_sync_token}
#滴滴-与主数据接口调用的生成token所需的公钥
#滴滴-与主数据接口调用的生成token所需的公钥
dd_pubkey=${dd_pubkey}
#滴滴-EBS抽取接口地址
#滴滴-EBS抽取接口地址
ebs_call_url=${ebs_call_url}
#tableau config
tableau_get_ticket=${tableau_get_ticket}
tableau_unreturned_tax=${tableau_unreturned_tax}
......
......@@ -61,12 +61,12 @@ ebs_call_url=http://172.20.201.201:8020/ebs-proxy-test/dts
tableau_get_ticket=http://47.94.233.173:16010/trusted?username=%s
tableau_unreturned_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_tax_comparison=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet14?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_other_countries=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_other_countries=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/Others?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_cost_analysis=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet19?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_profit_and_loss=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet26?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_other_domestic_data=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet32?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_doc_situation=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_global_overview=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_mexican_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_australian_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_brazilian_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_doc_situation=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet40?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_global_overview=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/InternationalOverview?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_mexican_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/Mexico?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_australian_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/Australia?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_brazilian_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/Brazil?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
......@@ -54,18 +54,18 @@ org_sync_token=174af08f
dd_pubkey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKUfMPRKV6I5num1dDWcxTrgTjXf5LctsVj0CpbwHE83mmjUO5CAlvA0Fwy30ajCX5sLmsyi+Eu/4uNmM6GQF3kCAwEAAQ==
ebs_call_url=http://172.20.201.201:8020/ebs-proxy-test/dts
ebs_call_url=http://172.20.3.109:8020/ebs-proxy-test/dts
#tableau config
tableau_get_ticket=http://47.94.233.173:16010/trusted?username=%s
tableau_unreturned_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_tax_comparison=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet14?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_other_countries=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_other_countries=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/Others?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_cost_analysis=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet19?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_profit_and_loss=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet26?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_other_domestic_data=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet32?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_doc_situation=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_global_overview=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_mexican_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_australian_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_brazilian_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet8?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_doc_situation=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/sheet40?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_global_overview=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/InternationalOverview?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_mexican_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/Mexico?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_australian_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/Australia?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
tableau_brazilian_tax=http://10.158.230.16:8890/trusted/%s/views/Didi_Tax_20190307/Brazil?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no&:toolbar=no
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Lists;
import org.junit.Test;
......@@ -26,14 +27,21 @@ import pwc.taxtech.atms.dto.ebsdto.*;
import pwc.taxtech.atms.dto.organization.DDSyncOrgInfo;
import pwc.taxtech.atms.dto.organization.OrgSyncData;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.security.dd.DtsTokenService;
import pwc.taxtech.atms.service.EbsApiService;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.annotation.Resource;
import javax.crypto.Cipher;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.security.KeyFactory;
import java.security.PublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
public class EbsApiServiceImplTest extends CommonIT {
......@@ -52,6 +60,9 @@ public class EbsApiServiceImplTest extends CommonIT {
@Value("${org_sync_token}")
private String token;
@Resource
private DtsTokenService dtsTokenService;
private static String ebsCallUrl = "http://172.20.201.201:8020/ebs-proxy-test/dts";
private static int corePoolSize = 15;
......@@ -698,4 +709,66 @@ public class EbsApiServiceImplTest extends CommonIT {
return new Integer(1);
}
}
public String encryptInput(){
BASE64Encoder base64 = new BASE64Encoder();
BASE64Decoder base64Decoder = new BASE64Decoder();
byte[] encodeData;
try {
byte[] publicKey = base64Decoder.decodeBuffer("MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKUfMPRKV6I5num1dDWcxTrgTjXf5LctsVj0CpbwHE83mmjUO5CAlvA0Fwy30ajCX5sLmsyi+Eu/4uNmM6GQF3kCAwEAAQ==");
String nonce = generateNonce();
String sDate = generateDate();
long rNum = generateRandomNumber();
String inputStr1 = sDate + "@@" + "DTS" + "@@" + nonce+rNum;
byte[] data1 = inputStr1.getBytes();
logger.debug("原文:" + inputStr1);
encodeData = encryptByPublicKey(data1, publicKey);
logger.debug("公钥加密后:" + base64.encode(encodeData));
} catch (Exception ex) {
throw new ServiceException("cus" + ex);
}
return base64.encode(encodeData);
}
private String generateNonce() throws Exception {
String dateTimeString = Long.toString(System.currentTimeMillis());
byte[] nonceByte = dateTimeString.getBytes();
return Base64.encodeBase64String(nonceByte);
}
private String generateDate() throws Exception {
DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
Date today = Calendar.getInstance().getTime();
String created = dateFormatter.format(today);
return created;
}
private long generateRandomNumber() throws Exception {
final double d = Math.random();
final long num = (int)(d*100000000000000L);
return num;
}
private static byte[] encryptByPublicKey(byte[] data, byte[] key) throws Exception {
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(key);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(x509KeySpec);
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
return cipher.doFinal(data);
}
public static void main(String[] args) {
System.out.println("--------------");
System.out.println(new EbsApiServiceImplTest().encryptInput());
}
}
\ No newline at end of file
......@@ -69,7 +69,7 @@ public class FileTypes implements Serializable {
* 必填字段(转换后)
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column file_types.file_type
* This field corresponds to the database column file_types.required_field
*
* @mbg.generated
*/
......
{
"DocumentAttr":"DocumentAttr",
"DocumentType":"DocumentType",
"DocumentName":"DocumentName",
"BusinessLine":"BusinessLine",
"CorporationName":"CorporationName",
"AvailabilityDate":"AvailabilityDate",
"Duration":"Duration",
"DueDate":"DueDate",
"TaxType":"TaxType",
"EntityIndex":"EntityIndex",
"EntityStorageLocation":"EntityStorageLocation",
"EntityCustodian":"EntityCustodian",
"ApprovalStatus":"ApprovalStatus",
"ApprovalPass":"ApprovalPass",
"ApprovalReject":"ApprovalReject",
"ApprovalStandby":"ApprovalStandby",
"UploadDate":"UploadDate",
"Creator":"Creator",
"Remarks":"Remarks",
"MoreFields":"MoreFields",
"LessFields":"LessFields",
"Search":"Search",
"Reset":"Reset",
"Preview":"Preview",
"DelRecord":"DelRecord",
"CreateRecord":"CreateRecord",
"ExportTable":"ExportTable",
"DownloadAttachment":"DownloadAttachment",
"Log":"Log",
"MultiUpload":"MultiUpload",
"MultiUploadFailList":"MultiUploadFailList",
"UnFile":"UnFile",
"UnRecord":"UnRecord",
"UnReadFile":"UnReadFile",
"NeedLoadUp":"NeedLoadUp",
"UploadLimit":"UploadLimit",
"FailUpload":"FailUpload",
"NeedChecked":"NeedChecked",
"Deleted":"Deleted",
"Uploaded":"Uploaded",
"Edited":"Edited",
"Created":"Created",
"CoverConfirm":"CoverConfirm",
"NoData":"NoData",
"PleaseSelected":"PleaseSelected",
"PleaseType":"PleaseType",
"EntityStorageDescription":"EntityStorageDescription",
"multiUpload":"multiUpload",
"UploadAttach":"UploadAttach",
"Edit":"Edit",
"DocumentPath":"DocumentPath",
"PreviewFile":"PreviewFile",
"UploadSuccessCount":"UploadSuccessCount",
"UploadFailCount":"UploadFailCount"
}
\ No newline at end of file
......@@ -12,6 +12,9 @@
"EntityStorageLocation":"实物存放地点",
"EntityCustodian":"保管人",
"ApprovalStatus":"审批状态",
"ApprovalPass":"审批通过",
"ApprovalReject":"拒绝审批",
"ApprovalStandby":"待审批",
"UploadDate":"上传日期",
"Creator":"创建人",
"Remarks":"档案备注",
......@@ -26,6 +29,7 @@
"DownloadAttachment":"下载附件",
"Log":"日志",
"MultiUpload":"批量上传",
"MultiUploadFailList":"批量上传失败列表",
"UnFile":"未支持的文件类型",
"UnRecord":"当前记录没有附件信息",
"UnReadFile":"文件内有不规则内容,无法读取,暂不支持预览",
......@@ -46,5 +50,7 @@
"UploadAttach":"上传附件",
"Edit":"编辑",
"DocumentPath":"档案路径",
"PreviewFile":"预览文件"
"PreviewFile":"预览文件",
"UploadSuccessCount":"个档案上传成功",
"UploadFailCount":"个档案上传失败"
}
\ No newline at end of file
......@@ -296,7 +296,8 @@
// 默认status为1
if(uploadModel.status === undefined
|| uploadModel.status === null) uploadModel.status = 1;
|| uploadModel.status === null
|| uploadModel.status === "") uploadModel.status = 1;
$scope.queryStatusType(uploadModel);
docManageService.addFileType(uploadModel).then(function (data) {
......
......@@ -12,11 +12,13 @@
display: none;
}
.edit-panel-left-part{
padding-left:0;
padding-right:0;
}
.required-tip{
color: red;
position: absolute;
left: 2rem;
top: 0.7rem;
}
</style>
<div class="menu-header">
......@@ -73,7 +75,7 @@
</div>
<!--档案属性-->
<div class="form-group">
<label for="DocumentAttr" class="col-sm-3 control-label">
<label for="DocumentAttr" class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
<span translate="DocumentAttr"></span>
</label>
......@@ -91,7 +93,7 @@
<!--档案类型-->
<div class="form-group">
<label for="DocumentType" class="col-sm-3 control-label">
<label for="DocumentType" class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
<span translate="DocumentType"></span>
</label>
......@@ -121,7 +123,7 @@
<!--必填字段-->
<div class="form-group">
<label class="col-sm-3 control-label">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
<span translate="RequiredFields"></span>
</label>
......@@ -156,7 +158,10 @@
<label class="col-sm-5 DM-state-label">
<input type="radio" name="editModelState"
value=1
ng-checked="editModel.status == 1 || editModel.status == null || editModel.status == undefined"
ng-checked="editModel.status == 1
|| editModel.status == null
|| editModel.status == undefined
|| editModel.status == ''"
ng-model="editModel.status"/>
<span translate="Enable"></span>
</label>
......
......@@ -174,7 +174,16 @@ taxDocumentManageModule.controller('taxDocumentListController',
{
dataField: "auditStatus",
caption: $translate.instant('ApprovalStatus'),
cellTemplate: function (container, options) {
try {
var content = $scope.transformAuditStatusToView(options.data.auditStatus);
$('<span>')
.text(options.data.auditStatus = content)
.appendTo(container);
} catch (e) {
$log.error(e);
}
}
},
{
dataField: "physicalIndexNumber",
......@@ -411,6 +420,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
params.updateTime = $scope.getQueryDate(params.updateTime, "/");
params.uploadTime = $scope.getQueryDate(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') {
......@@ -481,71 +491,10 @@ taxDocumentManageModule.controller('taxDocumentListController',
});
};
$scope.loadSelectMap = function () {
taxDocumentListService.getFileInfoOptions().then(function (data) {
// console.log(data);
if (data) {
$scope.typeAndAttrMap = data;
// 抽取每个元素的头一个字串,用于排序;
$scope.fileTypeOptions = $scope.sortByFirstCode(Object.keys(data));
$scope.fileAttrOptions = $scope.sortByFirstCode(Object.values(data));
// 过滤去重
var temp = $scope.fileTypeOptions;
$scope.fileTypeOptions = (function(){
var result = [];
temp.forEach(function(typeItem){
if(result.indexOf(typeItem) === -1){
result.push(typeItem);
}
});
return result;
})();
temp = $scope.fileAttrOptions;
$scope.fileAttrOptions = (function(){
var result = [];
temp.forEach(function(attrItem){
if(result.indexOf(attrItem) === -1){
result.push(attrItem);
}
});
return result;
})();
}
});
taxDocumentListService.getCompanyNameOptions().then(function(res){
if (res && 0 === res.code) {
angular.forEach(res.data, function (item) {
$scope.companyNameOptionsMap[item.id]=item.name;
});
} else {
SweetAlert.error($translate.instant('RevenueGetOrgError'));
}
});
};
$scope.businessLineOptions = [];
$scope.loadBusinessList = function(){
taxDocumentListService.getBusinessList().then(function(resData){
$scope.businessLineOptions = resData;
});
};
(function initialize() {
$scope.typeAndAttrMap = {};
$scope.fileTypeOptions = {};
$scope.fileAttrOptions = {};
$scope.curFileTypeOptions = [];
$scope.companyNameOptionsMap = {};
$scope.editFieldModel = {};
$scope.editFieldModel_multi = [];
$scope.uploader = {};
$scope.multiUploader = {};
$scope.loadMainData();
$scope.loadSelectMap();
$scope.loadBusinessList();
//注册方法
$scope.openSimpleUploadPop = openSimpleUploadPop;
$scope.delRecord = delRecord;
......@@ -652,25 +601,23 @@ taxDocumentManageModule.directive('fileUploader', function () {
$scope.uploader.filters.push({//xls限制
name: 'fileTypeFilter',
fn: function (item, options) {
// if(item.name.indexOf("_") === -1) {
// SweetAlert.warning("文件名格式不符合规则,请重新选择(正确格式必须包含'公司名称'和'档案类型',并用下划线'_'分隔)");
// return false;
// }
var fileNativePath = $("#uploadFilePlugin")[0].value || "";
fileNativePath = fileNativePath.replace(/fakepath/img, "******");
var splitMark = /\//.test(fileNativePath) ? "/" : "\\";
var prevPath = fileNativePath.split(splitMark);
prevPath.pop();
fileNativePath = prevPath.join(splitMark) + splitMark;
fileNativePath = fileNativePath.replace(item.name, "");
// var splitMark = /\//.test(fileNativePath) ? "/" : "\\";
// var prevPath = fileNativePath.split(splitMark);
// prevPath.pop();
// fileNativePath = prevPath.join(splitMark) + splitMark;
$scope.editFieldModel.fileNativePath = fileNativePath;
$scope.editFieldModel.fileName = item.name;
$scope.autoMatchAttrAndType(item.name, $scope.editFieldModel);
// $scope.autoMatchAttrAndType(item.name, $scope.editFieldModel);
return true;
}
});
$scope.uploader.onAfterAddingFile(function (item) {
$scope.uploader.onAfterAddingFile = function (item) {
console.info("is added!", item);
});
};
$scope.uploader.onErrorItem = function (fileItem, response, status, headers) {
SweetAlert.warning($translate.instant('FailUpload'));
$scope.editFieldModel = {};
......@@ -701,196 +648,392 @@ taxDocumentManageModule.directive('fileUploader', function () {
}]
}
});
// taxDocumentManageModule.directive('multiFileUploader_bak', function () {
// restrict: "EA",
// controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert', '$compile',
// function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert, $compile) {
// var timer = null;
// $scope.activeTab = function (activeIndex) {
// $scope.editFieldModel_multi.forEach(function (item) {
// item.iShow = false;
// });
// $scope.editFieldModel_multi[activeIndex].iShow = true;
// };
//
// $scope.openMultiUploadPop = function () {
// timer = null;
// $("#multiUploadFilePlugin").click();
// $scope.multiUploader.clearQueue();
// $("#multiUploadFilePlugin").val(null);
// $scope.editFieldModel_multi.length = 0;
// // timer = setInterval(function () {
// // if ($scope.multiUploader.queue && $scope.multiUploader.queue.length > 0) {
// // $("#multiUploadPopDialog").modal("show");
// // console.log("is run times");
// // }
// // }, 500);
// };
//
// // 由于$watch无法监听$scope.multiUploader,暂时用循环来做
// // setInterval(function () {
// // if ($("#multiUploadPopDialog").is(":visible")) {
// // clearInterval(timer);
// // }
// // }, 500);
//
// $scope.multiUploader = new FileUploader({
// // url: "http://etms.longi-silicon.com:8180/api/v1/taxDoc/upload",
// // autoUpload: true,//添加后,自动上传
// headers: {"Authorization": apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()},
// // removeAfterUpload: true,
// });
// $scope.multiUploader.filters.push({//xls限制
// name: 'fileTypeFilter',
// fn: function (item, options) {
// if (item.name.indexOf("_") === -1) {
// SweetAlert.warning("文件名格式不符合规则,请重新选择(正确格式必须包含'公司名称'和'档案类型',并用下划线'_'分隔)");
// return false;
// }
// var fileNativePath = $("#multiUploadFilePlugin")[0].value || "";
// fileNativePath = fileNativePath.replace(/fakepath/img, "******");
// fileNativePath = fileNativePath.replace(item.name, "");
// // var splitMark = /\//.test(fileNativePath) ? "/" : "\\";
// // var prevPath = fileNativePath.split(splitMark);
// // prevPath.pop();
// // fileNativePath = prevPath.join(splitMark) + splitMark;
// var thisModel = {
// fileNativePath: fileNativePath,
// fileName: item.name,
// iShow: $scope.editFieldModel_multi.length === 0
// };
// $scope.autoMatchAttrAndType(item.name, thisModel);
// $scope.editFieldModel_multi.push(thisModel);
// // 根据需求,改为不做类型限制
// return true;
// }
// });
//
// $scope.multiUploader.onAfterAddingFile = function (item) {
// console.info("is added!", item);
// if($scope.editFieldModel_multi.length > 0){
// $("#multiUploadPopDialog").modal("show");
// }
// };
//
// $scope.multiUploadErrorItems = [];
// $scope.multiUploader.onErrorItem = function (fileItem) {
// $scope.multiUploadErrorItems.push(fileItem);
// console.info('onErrorItem', fileItem);
// };
// // $scope.multiUploader.onCancelItem = function(fileItem, response, status, headers) {
// // console.info('onCancelItem', fileItem, response, status, headers);
// // };
//
// $scope.multiUploadSuccessItems = [];
// $scope.multiUploader.onCompleteAll = function () {
//
// $("#uploadResultPop").modal("show");
//
// $('#multiUploadPopDialog').modal('hide');
//
// $('#busy-indicator-container').hide();
//
//
// };
//
// $scope.multiUploader.onSuccessItem = function (fileItem, response) {
// // fileItem.filePositionUrl = response;
// $scope.multiUploadSuccessItems.push(fileItem);
//
// $('#busy-indicator-container').show();
// };
//
// $scope.multiUploadSubmit = function () {
// $scope.multiUploadErrorItems = [];
// $scope.multiUploadSuccessItems = [];
//
// var alertContent = verifyRequiredFields($scope.editFieldModel_multi);
//
// if(!alertContent){
// multiUpload();
// }else{
// swal(alertContent);
// }
//
// function verifyRequiredFields(editFieldModel_multi){
//
// var alertText = "";
//
// for(var i = 0; i < editFieldModel_multi.length; i++){
// var modelItem = editFieldModel_multi[i];
// if(!modelItem.companyName){
// alertText += "【"+$translate.instant("CompanyName")+"】"
// }
// if(!modelItem.fileType){
// alertText += "【"+$translate.instant("DocumentType")+"】"
// }
// if(!modelItem.fileAttr){
// alertText += "【"+$translate.instant("DocumentAttr")+"】"
// }
// if(!modelItem.taxType){
// alertText += "【"+$translate.instant("DocumentType")+"】"
// }
// if(!modelItem.ownTime){
// alertText += "【"+$translate.instant("Duration")+"】"
// }
// if(!modelItem.fileTime){
// alertText += "【"+$translate.instant("AvailabilityDate")+"】"
// }
//
// if(alertText.length > 0){
// alertText = "档案" + (i + 1) + "," + alertText + "为必填字段,不能为空,请检查";
// break;
// }
// }
//
// return alertText;
// }
//
// function multiUpload(){
// for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
//
// // 先设置uploader队列里每个文件的请求参数:fileOriginalName
// var fileItem = $scope.multiUploader.queue[i];
// fileItem.formData = [{
// fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
// }];
//
// // 过滤参数格式,并把参数推进上传队列
// var editFieldModel = $scope.editFieldModel_multi[i];
// Object.keys(editFieldModel).forEach(function (key) {
// var fields = {};
// var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
// if (/ownTime/.test(key)) {
// fields[key] = $scope.queryOwnTime(curItemValue, "int");
// } else {
// if (/(createTime|updateTime|uploadTime)/.test(key)) {
// fields[key] = $scope.getQueryDate(curItemValue, "/");
// } else fields[key] = curItemValue;
// }
// fileItem.formData.push(fields);
// });
//
//
// (function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
//
// var params = angular.copy(_editFieldModel);
// // params.ownTime = params.ownTime ? params.ownTime : "";
// // params.ownTime = parseInt(_editFieldModel.ownTime.split("-").join(""));
// 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) {
// if (data == true) {
// _fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/add";
// } else {
// _fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/edit";
// }
// _multiUploader.uploadItem(_i);
// });
// })(i, fileItem, editFieldModel, taxDocumentListService, $scope.multiUploader);
//
// }
// }
// };
//
// $scope.confirmUploadResult = function () {
// $('#uploadResultPop').modal('hide');
// $scope.loadMainData();
// };
// }]
// });
taxDocumentManageModule.directive('multiFileUploader', function () {
return {
restrict: "EA",
controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert', '$compile',
function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert, $compile) {
var timer = null;
$scope.editFieldModel_multi = [];
$scope.multiUploadErrorItems = [];
$scope.multiUploadSuccessItems = [];
$scope.multiUploader = {};
$scope.activeTab = function (activeIndex) {
$scope.editFieldModel_multi.forEach(function (item) {
$scope.multiUploadErrorItems.forEach(function (item) {
item.iShow = false;
});
$scope.editFieldModel_multi[activeIndex].iShow = true;
$scope.multiUploadErrorItems[activeIndex].iShow = true;
};
$scope.openMultiUploadPop = function () {
timer = null;
$("#multiUploadFilePlugin").click();
$scope.multiUploader.clearQueue();
$("#multiUploadFilePlugin").val(null);
$scope.editFieldModel_multi.length = 0;
timer = setInterval(function () {
if ($scope.multiUploader.queue && $scope.multiUploader.queue.length > 0) {
$("#multiUploadPopDialog").modal("show");
console.log("is run times");
}
}, 500);
$("#multiUploadFilePlugin").val(null); //这一步主要防止第二次选择相同文件的时候无响应
};
// 由于$watch无法监听$scope.multiUploader,暂时用循环来做
setInterval(function () {
if ($("#multiUploadPopDialog").is(":visible")) {
clearInterval(timer);
}
}, 500);
$scope.multiUploader = new FileUploader({
// url: "http://etms.longi-silicon.com:8180/api/v1/taxDoc/upload",
// autoUpload: true,//添加后,自动上传
headers: {"Authorization": apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()},
// removeAfterUpload: true,
});
$scope.multiUploader.filters.push({//xls限制
name: 'fileTypeFilter',
fn: function (item, options) {
if (item.name.indexOf("_") === -1) {
SweetAlert.warning("文件名格式不符合规则,请重新选择(正确格式必须包含'公司名称''档案类型',并用下划线'_'分隔)");
return false;
}
var fileNativePath = $("#multiUploadFilePlugin")[0].value || "";
fileNativePath = fileNativePath.replace(/fakepath/img, "******");
var splitMark = /\//.test(fileNativePath) ? "/" : "\\";
var prevPath = fileNativePath.split(splitMark);
prevPath.pop();
fileNativePath = prevPath.join(splitMark) + splitMark;
var thisModel = {
fileNativePath: fileNativePath,
fileName: item.name,
iShow: $scope.editFieldModel_multi.length == 0
};
$scope.editFieldModel_multi.push(thisModel);
$scope.autoMatchAttrAndType(item.name, thisModel);
// 根据需求,改为不做类型限制
return true;
}
});
$scope.multiUploader.onAfterAddingFile(function (item) {
// $scope.multiUploader.filters.push({//xls限制
// name: 'fileTypeFilter',
// fn: function (item, options) {
// var result = true;
// return result;
// }
// });
$scope.multiUploader.onAfterAddingFile = function (item) {
console.info("is added!", item);
});
var fileNativePath = $("#multiUploadFilePlugin")[0].value || "";
fileNativePath = fileNativePath.replace(/fakepath/img, "******");
fileNativePath = fileNativePath.replace(item.file.name, "");
var thisModel = {
fileNativePath: fileNativePath,
fileName: item.file.name,
iShow: false,
abandon:false
};
$scope.autoMatchAttrAndType(item.file.name, thisModel);
$scope.isAbandonFileItem(thisModel);
// if(thisModel.abandon){
// $scope.multiUploadErrorItems.push(thisModel)
// }else{
$scope.editFieldModel_multi.push(thisModel);
// }
};
//验证输入值是否都正确填充
//逻辑为:判断当前表单的必填值是否都已填充
//验证失败就推出到失败队列,首先展示失败窗口,再把失败队列显示到编辑窗口
$scope.isAbandonFileItem = function(fieldModel){
// 验证必填字段的值
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;
}
};
$scope.multiUploadErrorItems = [];
$scope.multiUploader.onErrorItem = function (fileItem) {
$scope.multiUploadErrorItems.push(fileItem);
//todo 重新构造一个editModel
var fieldModel = {};
fileItem.formData.forEach(function (formItem) {
Object.keys(formItem).forEach(function(key){
fieldModel[key] = formItem[key];
})
});
$scope.multiUploadErrorItems.push(fieldModel);
console.info('onErrorItem', fileItem);
};
// $scope.multiUploader.onCancelItem = function(fileItem, response, status, headers) {
// console.info('onCancelItem', fileItem, response, status, headers);
// };
$scope.multiUploadSuccessItems = [];
$scope.multiUploader.onCompleteAll = function () {
$("#uploadResultPop").modal("show");
$('#multiUploadPopDialog').modal('hide');
$('#busy-indicator-container').hide();
};
$scope.multiUploader.onSuccessItem = function (fileItem, response) {
// fileItem.filePositionUrl = response;
$scope.multiUploadSuccessItems.push(fileItem);
$('#busy-indicator-container').show();
$scope.multiUploader.onAfterAddingAll = function(){
$scope.multiUploadSubmit();
};
$scope.multiUploadSubmit = function () {
$scope.multiUploadErrorItems = [];
$scope.multiUploadSuccessItems = [];
var alertContent = verifyRequiredFields($scope.editFieldModel_multi);
if(!alertContent){
multiUpload();
}else{
swal(alertContent);
}
function verifyRequiredFields(editFieldModel_multi){
var alertText = "";
for(var i = 0; i < editFieldModel_multi.length; i++){
var modelItem = editFieldModel_multi[i];
if(!modelItem.companyName){
alertText += ""+$translate.instant("CompanyName")+""
}
if(!modelItem.fileType){
alertText += ""+$translate.instant("DocumentType")+""
for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
// 先设置uploader队列里每个文件的请求参数:fileOriginalName
var fileItem = $scope.multiUploader.queue[i];
fileItem.formData = [{
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
}];
// 过滤参数格式,并把参数推进上传队列
var editFieldModel = $scope.editFieldModel_multi[i];
if(editFieldModel.abandon){
$scope.multiUploadErrorItems.push(editFieldModel);
if($scope.multiUploadErrorItems.length === $scope.editFieldModel_multi.length){
$scope.multiUploadErrorItems[0].iShow = true;
$("#uploadResultPop").modal("show");
}
if(!modelItem.fileAttr){
alertText += ""+$translate.instant("DocumentAttr")+""
}
if(!modelItem.taxType){
alertText += ""+$translate.instant("DocumentType")+""
}
if(!modelItem.ownTime){
alertText += ""+$translate.instant("Duration")+""
}
if(!modelItem.fileTime){
alertText += ""+$translate.instant("AvailabilityDate")+""
continue;
}
Object.keys(editFieldModel).forEach(function (key) {
var fields = {};
var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
if (/ownTime/.test(key)) {
fields[key] = $scope.queryOwnTime(curItemValue, "int");
} else {
if (/(createTime|updateTime|uploadTime)/.test(key)) {
fields[key] = $scope.getQueryDate(curItemValue, "/");
} else fields[key] = curItemValue;
}
fileItem.formData.push(fields);
});
if(alertText.length > 0){
alertText = "档案" + (i + 1) + "," + alertText + "为必填字段,不能为空,请检查";
break;
}
}
return alertText;
}
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
function multiUpload(){
for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
// 先设置uploader队列里每个文件的请求参数:fileOriginalName
var fileItem = $scope.multiUploader.queue[i];
fileItem.formData = [{
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
}];
// 过滤参数格式,并把参数推进上传队列
var editFieldModel = $scope.editFieldModel_multi[i];
Object.keys(editFieldModel).forEach(function (key) {
var fields = {};
var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
if (/ownTime/.test(key)) {
fields[key] = $scope.queryOwnTime(curItemValue, "int");
var params = angular.copy(_editFieldModel);
// params.ownTime = params.ownTime ? params.ownTime : "";
// params.ownTime = parseInt(_editFieldModel.ownTime.split("-").join(""));
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) {
if (data == true) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
} else {
if (/(createTime|updateTime|uploadTime)/.test(key)) {
fields[key] = $scope.getQueryDate(curItemValue, "/");
} else fields[key] = curItemValue;
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/edit";
}
fileItem.formData.push(fields);
_multiUploader.uploadItem(_i);
});
})(i, fileItem, editFieldModel, taxDocumentListService, $scope.multiUploader);
}
};
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
$scope.multiUploader.onCompleteAll = function () {
var params = angular.copy(_editFieldModel);
// params.ownTime = params.ownTime ? params.ownTime : "";
// params.ownTime = parseInt(_editFieldModel.ownTime.split("-").join(""));
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) {
if (data == true) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
} else {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/edit";
}
_multiUploader.uploadItem(_i);
});
})(i, fileItem, editFieldModel, taxDocumentListService, $scope.multiUploader);
if($scope.multiUploadErrorItems.length) $scope.multiUploadErrorItems[0].iShow = true;
}
}
$("#uploadResultPop").modal("show");
$('#busy-indicator-container').hide();
$scope.loadMainData();
};
$scope.multiUploader.onSuccessItem = function (fileItem, response) {
// fileItem.filePositionUrl = response;
// fileItem.fileName = fileItem._file.name;
var fieldModel = {};
fileItem.formData.forEach(function (formItem) {
Object.keys(formItem).forEach(function(key){
fieldModel[key] = formItem[key];
})
});
$scope.multiUploadSuccessItems.push(fieldModel);
$('#busy-indicator-container').show();
};
$scope.confirmUploadResult = function () {
$('#uploadResultPop').modal('hide');
$scope.loadMainData();
$("#multiUploadPopDialog").modal("show");
};
$scope.closeUploadReview = function () {
clearCache();
$("#multiUploadPopDialog").modal("hide");
};
function clearCache(){
$scope.multiUploadErrorItems.length = 0;
$scope.multiUploadSuccessItems.length = 0;
$scope.multiUploader.clearQueue();
$scope.editFieldModel_multi.length = 0;
}
}]
}
});
......@@ -1407,17 +1550,81 @@ taxDocumentManageModule.directive('tempModule', function () {
controller: ['$scope', 'taxDocumentListService', '$translate',
function ($scope, taxDocumentListService, $translate) {
//税种
$scope.taxTypeSelects =
[ "纳税申报表",
"税票",
"企业所得税",
"印花税",
"附加税",
"代扣代缴税",
"其它税",
"增值税",
];
$scope.taxTypeSelects = [
"纳税申报表",
"税票",
"企业所得税",
"印花税",
"附加税",
"代扣代缴税",
"其它税",
"增值税",
];
//审批状态
$scope.auditSelectsMap = {
"0":"待审批",
"1":"已审批",
"-1":"拒绝审批",
};
$scope.typeAndAttrMap = {};
$scope.fileTypeOptions = [];
$scope.fileAttrOptions = [];
$scope.curFileTypeOptions = [];
$scope.companyNameOptionsMap = {};
$scope.loadSelectMap = function () {
taxDocumentListService.getFileInfoOptions().then(function (data) {
// console.log(data);
if (data) {
$scope.typeAndAttrMap = data;
// 抽取每个元素的头一个字串,用于排序;
// $scope.fileTypeOptions = $scope.sortByFirstCode(Object.keys(data));
// $scope.fileAttrOptions = $scope.sortByFirstCode(Object.values(data));
$scope.fileTypeOptions = Object.keys(data);
$scope.fileAttrOptions = Object.values(data);
// 过滤去重
var temp = $scope.fileTypeOptions;
$scope.fileTypeOptions = (function(){
var result = [];
temp.forEach(function(typeItem){
if(result.indexOf(typeItem) === -1){
result.push(typeItem);
}
});
return result;
})();
$scope.fileTypeOptions.sort();
temp = $scope.fileAttrOptions;
$scope.fileAttrOptions = (function(){
var result = [];
temp.forEach(function(attrItem){
if(result.indexOf(attrItem) === -1){
result.push(attrItem);
}
});
return result;
})();
$scope.fileAttrOptions.sort();
}
});
taxDocumentListService.getCompanyNameOptions().then(function (data) {
// console.log(data);
if (data) {
$scope.companyNameOptionsMap = data;
}
});
};
$scope.loadSelectMap();
$scope.businessLineOptions = [];
$scope.loadBusinessList = function(){
taxDocumentListService.getBusinessList().then(function(resData){
$scope.businessLineOptions = resData;
});
};
$scope.loadBusinessList();
$scope.getQueryDate = function (time, mark) {
if (!time) return "";
var theDate = new Date(time);
......@@ -1504,7 +1711,6 @@ taxDocumentManageModule.directive('tempModule', function () {
$("#period-picker4").val("");
};
$scope.sortByFirstCode = function(src){
var result = [];
var firstCodesOrigin = [];
......@@ -1523,7 +1729,8 @@ taxDocumentManageModule.directive('tempModule', function () {
});
return result;
}
};
$scope.intToDate = function(src,type){
if(!src) return "";
src = src + "";
......@@ -1534,6 +1741,30 @@ taxDocumentManageModule.directive('tempModule', function () {
if(!day) return year + type + mon;
return year + type + mon + type + day;
};
$scope.transformAuditStatusToServer = function(src){
var result = 0;
if(src === $translate.instant('ApprovalStandby')){
result = 0;
}else if(src === $translate.instant('ApprovalPass')){
result = 1;
}else if(src === $translate.instant('ApprovalReject')){
result = -1;
}
return result;
};
$scope.transformAuditStatusToView = function(src){
var result = $translate.instant('ApprovalStandby');
if(src == 0){
result = $translate.instant('ApprovalStandby');
}else if(src == 1){
result = $translate.instant('ApprovalPass');
}else if(src == -1){
result = $translate.instant('ApprovalReject');
}
return result;
};
}]
}
});
......
......@@ -5,6 +5,10 @@
padding: 0;
list-style: none;
}
.upload-fail-mark{
border:2px solid red;
}
.edit-panel-left-part{
padding-left:0;
padding-right:0;
......@@ -538,8 +542,17 @@
<span translate="ApprovalStatus"></span>
</div>
<div class="TDL-query-val">
<input type="text" class="form-control radius3"
ng-model="queryFieldModel.auditStatus"/>
<!--auditSelectsMap-->
<select ng-model="queryFieldModel.auditStatus"
class="form-control radius3">
<option ng-repeat="(code,val) in auditSelectsMap track by $index"
ng-selected="(queryFieldModel.auditStatus == code || queryFieldModel.auditStatus == val)"
value="{{code}}">{{val}}
</option>
</select>
<!--<input type="text" class="form-control radius3"-->
<!--ng-model="queryFieldModel.auditStatus"/>-->
</div>
</div>
<div class="TDL-query-block">
......@@ -869,6 +882,252 @@
<div class="modal fade" id="multiUploadPopDialog" multi-file-uploader tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width:80%;height:200px;max-width:1028px" role="document">
<div class="modal-content">
<form class="form-horizontal" name="newDocFileTypeForm">
<div class="modal-header" >
<div class="modal-title"><span>{{'MultiUploadFailList'|translate}}</span></div>
<input id="multiUploadFilePlugin" type="file" multiple style="display:none" nv-file-select
uploader="multiUploader">
</div>
<div class="modal-body">
<div class="TDL-multi-upload-tab">
<ul>
<li class="TDL-multi-upload-tab-item"
ng-class="{true:'TDL-multi-upload-tab-active',false:''}[editFieldItem.iShow]"
ng-repeat="editFieldItem in multiUploadErrorItems"
ng-click="activeTab($index)">
<span>{{'档案' + ($index + 1)}}</span>
</li>
</ul>
</div>
<div class="TDL-multi-upload-content">
<ul>
<li ng-repeat="editFieldItem in multiUploadErrorItems" ng-show="editFieldItem.iShow">
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
{{'DocumentPath'|translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input class="form-control" title="{{editFieldItem.fileNativePath}}"
placeholder="{{'PleaseSelected' | translate}}"
ng-class="{'upload-fail-mark':!editFieldItem.fileNativePath && editFieldItem.fileNativePath != 0}"
readonly disabled
ng-model="editFieldItem.fileNativePath"/>
<!--<input id="{{multiUploadFilePlugin}}" type="file" style="display:none" nv-file-select uploader="uploader" filters="fileTypeFilter">-->
</div>
</div>
<div style="clear:both"></div>
<!--档案名称-->
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
{{'DocumentName' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input class="form-control"
ng-class="{'upload-fail-mark':!editFieldItem.fileName && editFieldItem.fileName != 0}"
title="{{editFieldItem.fileName}}"
placeholder="{{'PleaseType' | translate}}" disabled
ng-model="editFieldItem.fileName" readonly/>
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
{{'DocumentAttr' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<select ng-model="editFieldItem.fileAttr"
ng-class="{'upload-fail-mark':!editFieldItem.fileAttr}"
ng-change="syncFileType(editFieldItem.fileAttr)" disabled
class="form-control" readonly placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileAttr in fileAttrOptions track by $index"
ng-selected="(editFieldItem.fileAttr == fileAttr)"
value="{{fileAttr}}">{{fileAttr}}
</option>
</select>
</div>
<!--<div class="DTL-special-external-btn" title="查看类型列表">
<a href="javascript:void(0)" ng-click="openHelpPop()"><i
class="fa fake-question-circle" aria-hidden="true"></i></a>
</div>-->
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
{{'CorporationName' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<select ng-model="editFieldItem.companyName" class="form-control"
title="{{editFieldItem.companyName}}" readonly disabled
ng-class="{'upload-fail-mark':!editFieldItem.companyName}"
ng-change="matchCompanyId(editFieldItem,companyNameOptionsMap)"
placeholder="{{'PleaseSelected' | translate}}">
<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">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
{{'DocumentType' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<select ng-model="editFieldItem.fileType"
ng-change="syncRequiredFields(editFieldItem)"
class="form-control" readonly disabled
ng-class="{'upload-fail-mark':!editFieldItem.fileType}"
placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileType in curFileTypeOptions track by $index"
ng-selected="(editFieldItem.fileType == fileType)"
value="{{fileType}}">{{fileType}}
</option>
</select>
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip" ng-if="isRequired('TaxType')"> * </span>
{{'TaxType' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<select ng-model="editFieldItem.taxType"
class="form-control" readonly disabled
ng-required="isRequired('TaxType')"
ng-class="{'upload-fail-mark':isRequired('TaxType') && !editFieldItem.taxType}"
placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="taxType in taxTypeSelects track by $index"
ng-selected="(editFieldItem.taxType == taxType)"
value="{{taxType}}">{{taxType}}
</option>
</select>
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
{{'Duration' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}"
date-time-picker data-date-format="yyyy/mm"
ng-class="{'upload-fail-mark':!editFieldItem.ownTime}"
class="form-control" ng-model="editFieldItem.ownTime" readonly disabled
data-min-view-mode="1"/>
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip" ng-if="isRequired('AvailabilityDate')"> * </span>
{{'AvailabilityDate' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}"
ng-class="{'upload-fail-mark':isRequired('AvailabilityDate') && !editFieldItem.fileTime}"
date-time-picker data-date-format="yyyy/mm/dd" readonly disabled
class="form-control" ng-model="editFieldItem.fileTime"/>
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip" ng-if="isRequired('DueDate')"> * </span>
{{'DueDate' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}"
ng-class="{'upload-fail-mark':isRequired('DueDate') && !editFieldItem.effectiveTime}"
date-time-picker data-date-format="yyyy/mm/dd" readonly disabled
class="form-control" ng-model="editFieldItem.effectiveTime"/>
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip" ng-if="isRequired('EntityStorageLocation')"> * </span>
{{'EntityStorageLocation' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input class="form-control"
ng-class="{'upload-fail-mark':isRequired('EntityStorageLocation') && !editFieldItem.storageArea}"
placeholder="{{'PleaseSelected'|translate}}"
ng-model="editFieldItem.storageArea" readonly disabled
/>
</div>
<div class="DTL-special-external-btn"
title="{{'EntityStorageDescription'|translate}}">
<!--<i class="fa fake-exclamatory-circle"></i>-->
<a href="javascript:void(0)" ng-click="openHelpPopForEntityStorage()">
<i class="fa fake-exclamatory-circle" aria-hidden="true"></i>
</a>
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip" ng-if="isRequired('EntityCustodian')"> * </span>
{{'EntityCustodian' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input class="form-control" readonly disabled
ng-class="{'upload-fail-mark':isRequired('EntityCustodian') && !editFieldItem.keeper}"
placeholder="{{'PleaseType' | translate}}"
ng-model="editFieldItem.keeper"
/>
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip" ng-if="isRequired('EntityIndex')"> * </span>
{{'EntityIndex' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input class="form-control"
type="text"
placeholder="{{'PleaseType' | translate}}"
ng-class="{'upload-fail-mark':isRequired('EntityIndex') && !editFieldItem.physicalIndexNumber && editFieldItem.physicalIndexNumber != 0}"
ng-model="editFieldItem.physicalIndexNumber"
readonly disabled
/>
</div>
</div>
<div class="form-group" style="width:100%;float:left;">
<label class="col-sm-3 control-label edit-panel-left-part" style="width:12.5%">
<span class="required-tip" ng-if="isRequired('Remarks')"> * </span>
{{'Remarks' | translate}}
</label>
<div class="col-sm-11" style="width:87.5%">
<textarea class="form-control"
ng-class="{'upload-fail-mark':isRequired('Remarks') && !editFieldItem.remark && editFieldItem.remark != 0}"
placeholder="{{'PleaseType' | translate}}"
readonly disabled
ng-model="editFieldItem.remark">
</textarea>
</div>
</div>
<div style="clear:both;"></div>
</li>
</ul>
</div>
<div style="clear:both"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" translate="Confirm" ng-click="closeUploadReview()"></button>
<!--<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()"-->
<!--translate="Cancel"></button>-->
</div>
</form>
</div>
</div>
</div>
<!--<div class="modal fade" id="multiUploadPopDialog" multi-file-uploader tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width:80%;height:200px;max-width:1028px" role="document">
<div class="modal-content">
<form class="form-horizontal" name="newDocFileTypeForm">
......@@ -882,7 +1141,7 @@
<ul>
<li class="TDL-multi-upload-tab-item"
ng-class="{true:'TDL-multi-upload-tab-active',false:''}[editFieldItem.iShow]"
ng-repeat="editFieldItem in editFieldModel_multi"
ng-repeat="editFieldItem in multiUploadErrorItems"
ng-click="activeTab($index)">
<span>{{'档案' + ($index + 1)}}</span>
</li>
......@@ -901,18 +1160,18 @@
placeholder="{{'PleaseSelected' | translate}}"
readonly required
ng-model="editFieldItem.fileNativePath"/>
<!--<input id="{{multiUploadFilePlugin}}" type="file" style="display:none" nv-file-select uploader="uploader" filters="fileTypeFilter">-->
&lt;!&ndash;<input id="{{multiUploadFilePlugin}}" type="file" style="display:none" nv-file-select uploader="uploader" filters="fileTypeFilter">&ndash;&gt;
</div>
</div>
<!--取消上传时的预览功能-->
<!-- <div class="col-sm-6 form-group">
&lt;!&ndash;取消上传时的预览功能&ndash;&gt;
&lt;!&ndash; <div class="col-sm-6 form-group">
<label class="col-sm-3 control-label" style="text-align: left;margin-left: -34px;">
<a href="javascript:void(0)" class="DTL-special-external-preview" ng-click="viewNativeFile(multiUploader.queue[$index])">预览文件</a>
</label>
</div>-->
</div>&ndash;&gt;
<div style="clear:both"></div>
<!--档案名称-->
&lt;!&ndash;档案名称&ndash;&gt;
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
<span class="required-tip"> * </span>
......@@ -942,10 +1201,10 @@
</select>
</div>
<!--<div class="DTL-special-external-btn" title="查看类型列表">
&lt;!&ndash;<div class="DTL-special-external-btn" title="查看类型列表">
<a href="javascript:void(0)" ng-click="openHelpPop()"><i
class="fa fake-question-circle" aria-hidden="true"></i></a>
</div>-->
</div>&ndash;&gt;
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
......@@ -1050,7 +1309,7 @@
</div>
<div class="DTL-special-external-btn"
title="{{'EntityStorageDescription'|translate}}">
<!--<i class="fa fake-exclamatory-circle"></i>-->
&lt;!&ndash;<i class="fa fake-exclamatory-circle"></i>&ndash;&gt;
<a href="javascript:void(0)" ng-click="openHelpPopForEntityStorage()">
<i class="fa fake-exclamatory-circle" aria-hidden="true"></i>
......@@ -1111,7 +1370,7 @@
</form>
</div>
</div>
</div>
</div>-->
<div class="modal fade" id="filePreviewPop" file-preview tabindex="-1" role="dialog" aria-labelledby="myModal"
data-backdrop="static" data-keyboard="false">
......@@ -1143,16 +1402,16 @@
<div class="modal-title">提示讯息</div>
</div>
<div class="modal-body">
<p ng-if="multiUploadSuccessItems.length">{{multiUploadSuccessItems.length}}个档案上传成功</p>
<p ng-if="multiUploadSuccessItems.length">{{multiUploadSuccessItems.length}}{{'UploadSuccessCount'|translate}}</p>
<ul>
<li ng-repeat="item in multiUploadSuccessItems">
<span>{{item._file.name}}</span>
<span>{{item.fileName}}</span>
</li>
</ul>
<p ng-if="multiUploadErrorItems.length">{{multiUploadErrorItems.length}}个档案上传失败</p>
<p ng-if="multiUploadErrorItems.length">{{multiUploadErrorItems.length}}{{'UploadFailCount'|translate}}</p>
<ul>
<li ng-repeat="item in multiUploadErrorItems">
<span>{{item._file.name}}</span>
<span>{{item.fileName}}</span>
</li>
</ul>
</div>
......
......@@ -73,7 +73,7 @@ taxDocumentManageModule.factory('taxDocumentListService',
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/batchDelete', params);
},
getDocumentsAttrAndType:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/selectList', params);
return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/selectEnableList', params);
},
getBusinessList:function(params){
return jqFetch.get(apiInterceptor.webApiHostUrl + '/businessunit/getlist', params);
......
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