Commit b88c4703 authored by chase's avatar chase

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

parents b1ffe129 d28dd2cc
......@@ -754,6 +754,13 @@ public class DateUtils {
return getPeriodEndFormat(year, period, Constant.DateFormat.DEFAULT);
}
//获取当前 格式化成stirng的日期 yyyy-MM-dd
public static String nowDateFormat() {
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
return simpleDateFormat.format(date);
}
// /***************************************************************************
// * //nd=1表示返回的值中包含年度 //yf=1表示返回的值中包含月份 //rq=1表示返回的值中包含日期 //format表示返回的格式 1
// * 以年月日中文返回 2 以横线-返回 // 3 以斜线/返回 4 以缩写不带其它符号形式返回 // 5 以点号.返回
......
package pwc.taxtech.atms.common.util;
/**
* @ClassName FileExcelUtil
* Description TODO
* @Author pwc kevin
* @Date 3/31/2019 12:35 PM
* Version 1.0
**/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.misc.BASE64Encoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@SuppressWarnings("restriction")
public class FileExcelUtil {
private static final Logger logger = LoggerFactory.getLogger(FileExcelUtil.class);
/**
* 编译下载的文件名
* @param filename
* @param agent
* @return
* @throws IOException
*/
public static String encodeDownloadFilename(String filename, String agent)throws IOException {
if (agent.contains("Firefox")) { // 火狐浏览器
filename = "=?UTF-8?B?"
+ new BASE64Encoder().encode(filename.getBytes("utf-8"))
+ "?=";
filename = filename.replaceAll("\r\n", "");
} else { // IE及其他浏览器
filename = URLEncoder.encode(filename, "utf-8");
filename = filename.replace("+"," ");
}
return filename;
}
/**
* 创建文件夹;
* @param path
*/
public static void createFile(String path) {
File file = new File(path);
//判断文件是否存在;
if (!file.exists()) {
//创建文件;
file.mkdirs();
}
}
/**
* 生成.zip文件;
* @param path
* @throws IOException
*/
public static ZipOutputStream craeteZipPath(String path) throws IOException{
ZipOutputStream zipOutputStream = null;
File file = new File(path+DateUtils.nowDateFormat()+".zip");
zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
File[] files = new File(path).listFiles();
FileInputStream fileInputStream = null;
byte[] buf = new byte[1024];
int len = 0;
if(files!=null && files.length > 0){
for(File excelFile:files){
String fileName = excelFile.getName();
fileInputStream = new FileInputStream(excelFile);
//放入压缩zip包中;
zipOutputStream.putNextEntry(new ZipEntry(path + "/"+fileName));
//读取文件;
while((len=fileInputStream.read(buf)) >0){
zipOutputStream.write(buf, 0, len);
}
//关闭;
zipOutputStream.closeEntry();
if(fileInputStream != null){
fileInputStream.close();
}
}
}
/*if(zipOutputStream !=null){
zipOutputStream.close();
}*/
return zipOutputStream;
}
/**
* //压缩文件
* @param srcfile 要压缩的文件数组
* @param zipfile 生成的zip文件对象
*/
public static void ZipFiles(java.io.File[] srcfile, File zipfile) throws Exception {
byte[] buf = new byte[1024];
FileOutputStream fos = new FileOutputStream(zipfile);
ZipOutputStream out = new ZipOutputStream(fos);
for (int i = 0; i < srcfile.length; i++) {
FileInputStream in = new FileInputStream(srcfile[i]);
out.putNextEntry(new ZipEntry(srcfile[i].getName()));
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.closeEntry();
in.close();
}
out.close();
fos.flush();
fos.close();
}
/**
* 删除文件夹及文件夹下所有文件
* @param dir
* @return
*/
public static boolean deleteDir(File dir) {
if (dir == null || !dir.exists()){
return true;
}
if (dir.isDirectory()) {
String[] children = dir.list();
//递归删除目录中的子目录下
for (int i=0; i<children.length; i++) {
boolean success = deleteDir(new File(dir, children[i]));
if (!success) {
return false;
}
}
}
// 目录此时为空,可以删除
return dir.delete();
}
/**
* 生成html
* @param msg
* @return
*/
public static String getErrorHtml(String msg) {
StringBuffer sb = new StringBuffer();
sb.append("<html>");
sb.append("<head>");
sb.append("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
sb.append("</head>");
sb.append("<body>");
sb.append("<div id='errorInfo'> ");
sb.append("</div>");
sb.append("<script>alert('"+msg+"')</script>");
sb.append("</body>");
sb.append("</html>");
return sb.toString();
}
/**
* 设置下载excel的响应头信息
* @param response
* @param request
* @param fileName
* @throws IOException
*/
public static void setExcelHeadInfo(HttpServletResponse response, HttpServletRequest request, String fileName) {
try {
// 获取客户端浏览器的类型
String agent = request.getHeader("User-Agent");
// 对文件名重新编码
String encodingFileName = FileExcelUtil.encodeDownloadFilename(fileName, agent);
// 告诉客户端允许断点续传多线程连接下载
response.setHeader("Accept-Ranges", "bytes");
//文件后缀
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment; filename=" + encodingFileName);
} catch (IOException e) {
logger.error(Thread.currentThread().getStackTrace()[1].getMethodName() +"发生的异常是: ",e);
throw new RuntimeException(e);
}
}
/**
* 设置下载zip的响应头信息
* @param response
* @param fileName 文件名
* @param request
* @throws IOException
*/
public static void setZipDownLoadHeadInfo(HttpServletResponse response, HttpServletRequest request, String fileName) throws IOException {
// 获取客户端浏览器的类型
String agent = request.getHeader("User-Agent");
response.setContentType("application/octet-stream ");
// 表示不能用浏览器直接打开
response.setHeader("Connection", "close");
// 告诉客户端允许断点续传多线程连接下载
response.setHeader("Accept-Ranges", "bytes");
// 对文件名重新编码
String encodingFileName = FileExcelUtil.encodeDownloadFilename(fileName, agent);
response.setHeader("Content-Disposition", "attachment; filename=" + encodingFileName);
}
}
\ No newline at end of file
package pwc.taxtech.atms.common.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.config.FileServiceConfig;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.exception.ServiceException;
import java.io.IOException;
import java.net.URLEncoder;
import java.security.MessageDigest;
/**
* author kevin
* ver 1.0
*/
@Configuration
public class FileUploadUtil implements ApplicationContextAware {
protected static final Logger logger = LoggerFactory.getLogger(FileUploadUtil.class);
// Spring应用上下文环境
private static ApplicationContext applicationContext;
private static FileServiceConfig config;
private static final String HTTP_SUCCESS_CODE = "200";
protected static char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
public static String getUploadUrl() {
config = (FileServiceConfig) applicationContext.getBean("fileServiceConfig");
return config.getUploadUrl();
}
public static String downLoadUrl() {
config = (FileServiceConfig) applicationContext.getBean("fileServiceConfig");
return config.getDownloadUrl();
}
/**
* 上传模板
*
* @param file MultipartFile
* @return Boolean
*/
public static String upload(MultipartFile file, String fileName) throws ServiceException {
if (StringUtils.isBlank(file.getOriginalFilename()) || null == file) {
throw new IllegalArgumentException("上传参数为空");
}
if (fileName == null) {
fileName = file.getOriginalFilename();
}
CloseableHttpClient httpClient = null;
String requestKey = CommonUtils.getUUID();
String requestUrl = getUploadUrl() + "/" + requestKey;
try {
/*String serverPath = serverPath();
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(serverPath);
httpPost.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());*/
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(requestUrl);
String md5Str = getFileMD5String(file);
ByteArrayBody byteBody = new ByteArrayBody(file.getBytes(), ContentType.MULTIPART_FORM_DATA, StringUtils.isBlank(fileName) ? URLEncoder.encode(file.getOriginalFilename(), "UTF-8") : URLEncoder.encode(fileName, "UTF-8"));
StringBody md5 = new StringBody(md5Str, ContentType.create("text/plain"));
HttpEntity httpEntity = MultipartEntityBuilder.create().addPart("filecontent", byteBody).addPart("md5", md5).build();
httpPost.setEntity(httpEntity);
HttpResponse httpResponse = httpClient.execute(httpPost);
JSONObject resultDto = JSON.parseObject(IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"));
if (HTTP_SUCCESS_CODE.equals(resultDto.getString("status_code")))
return requestKey;
return null;
} catch (Exception e) {
e.printStackTrace();
logger.error("uploadTemplate error.", e);
return null;
} finally {
if (null != httpClient) {
try {
httpClient.close();
} catch (IOException e) {
logger.error("close httpClient error.", e);
}
}
}
}
public static boolean downLoad(String download_url) {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(downLoadUrl() + "/" + download_url);
HttpResponse httpResponse = null;
try {
httpResponse = httpClient.execute(httpGet);
JSONObject resultDto = JSON.parseObject(IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"));
if (resultDto.getString("status_code").equals(HTTP_SUCCESS_CODE))
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
return false;
}
/**
* 实现ApplicationContextAware接口的回调方法。设置上下文环境
*
* @param applicationContext
*/
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
/**
* @return ApplicationContext
*/
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
public static String getFileMD5String(MultipartFile file) throws Exception {
MessageDigest messagedigest = MessageDigest.getInstance("MD5");
messagedigest.update(file.getBytes());
byte bytes[] = messagedigest.digest();
return bufferToHex(bytes, 0, bytes.length);
}
private static String bufferToHex(byte bytes[], int m, int n) {
StringBuffer stringbuffer = new StringBuffer(2 * n);
int k = m + n;
for (int l = m; l < k; l++) {
appendHexPair(bytes[l], stringbuffer);
}
return stringbuffer.toString();
}
private static void appendHexPair(byte bt, StringBuffer stringbuffer) {
char c0 = hexDigits[(bt & 0xf0) >> 4];
char c1 = hexDigits[bt & 0xf];
stringbuffer.append(c0);
stringbuffer.append(c1);
}
}
......@@ -12,7 +12,8 @@ public enum EnumImportType {
CertifiedInvoicesList(8),
InvoiceRecord(9),
ExtractFinancialData(10),
ExtractInvoiceData(11)
ExtractInvoiceData(11),
RevenueMapping(12)
;
private Integer code;
......
......@@ -8,7 +8,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.util.FileUploadUtil;
import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
......@@ -20,6 +19,7 @@ import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.service.impl.BaseService;
import pwc.taxtech.atms.service.impl.DidiFileUploadService;
import pwc.taxtech.atms.service.impl.ReportUploadService;
import pwc.taxtech.atms.vat.dao.PwcReportAttachMapper;
import pwc.taxtech.atms.vat.entity.*;
......@@ -29,6 +29,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
......@@ -251,13 +252,18 @@ public class ReportController {
}
@Autowired
private DidiFileUploadService didiFileUploadService;
@RequestMapping(value = "doUpload", method = RequestMethod.POST)
public OperationResultDto doUploadAttach(@RequestParam("fileName") String fileName, MultipartFile file, String remarks, @RequestParam("activeCol") Long activeCol, @RequestParam("activeRow") Long activeRow, @RequestParam("activeTemplateId") String activeTemplateId) {
System.out.println(activeCol + "----" + activeRow + "-----" + activeTemplateId);
OperationResultDto operationResultDto = reportService.doUploadAttach(file, remarks);
if (!"error".equals(operationResultDto.getResultMsg())) {//上传成功绑定
reportService.bindPwcAttach(activeCol, activeRow, activeTemplateId, (FileDto) operationResultDto.getData());
FileUpload fileUpload = null;
try{
fileUpload = didiFileUploadService.uploadFile(file, file.getOriginalFilename(), "附件上传");
}catch(Exception e){
e.printStackTrace();
}
operationResultDto.success();
reportService.bindPwcAttach(activeCol, activeRow, activeTemplateId, fileUpload, remarks);
return operationResultDto;
}
......@@ -274,20 +280,19 @@ public class ReportController {
@Resource
private PwcReportAttachMapper pwcReportAttachMapper;
@RequestMapping("")
/* @RequestMapping("downLoadAttach")
public OperationResultDto downLoadAttach(Long id) {
OperationResultDto operationResultDto = new OperationResultDto();
PwcReportAttachExample example = new PwcReportAttachExample();
PwcReportAttachExample.Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(id);
if (FileUploadUtil.downLoad(pwcReportAttachMapper.selectByExample(example).get(0).getFileUrl()) == true) {
if (didiFileUploadService.queryPage(pwcReportAttachMapper.selectByExample(example).get(0).getFileUrl()) == true) {
return operationResultDto.success();
}
;
operationResultDto.setResultMsg("附件导出失败");
return operationResultDto;
}
*/
@Resource
private OrganizationMapper organizationMapper;
......@@ -342,6 +347,12 @@ public class ReportController {
@RequestMapping("manyExport")
public OperationResultDto manyExport(@RequestBody RequestParameterDto requestParameterDto) {
OperationResultDto operationResultDto = new OperationResultDto();
String zipName = "利润表";
try {
reportService.manyExport(requestParameterDto, zipName);
} catch (URISyntaxException e) {
e.printStackTrace();
}
operationResultDto.setResult(null);
return operationResultDto;
}
......
package pwc.taxtech.atms.dto.revenuconf;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import pwc.taxtech.atms.constant.enums.RevenueConfEnum;
import pwc.taxtech.atms.vat.entity.RevenueTypeMapping;
public class RevenueTypeResult extends RevenueTypeMapping {
@JsonSerialize(using = PwCIdSerialize.class)
private String id;
public String getStatusStr() {
return RevenueConfEnum.Status.MAPPING.get(this.getStatus());
}
}
......@@ -75,7 +75,7 @@ public class DidiFileUploadService extends BaseService {
private static final String PROXY_PORT = "11007";
public FileUpload getFileUpload(String uid){
public FileUpload getFileUpload(String uid) {
return fileUploadMapper.selectByPrimaryKey(uid);
}
......@@ -127,8 +127,7 @@ public class DidiFileUploadService extends BaseService {
throw new ServiceException("uploadFile error.");
}
public FileUpload uploadFile(byte[] bytes, String fileName, String bizSource) throws ServiceException
{
public FileUpload uploadFile(byte[] bytes, String fileName, String bizSource) throws ServiceException {
CloseableHttpClient httpClient = null;
String requestKey = CommonUtils.getUUID();
String requestUrl = upload_post_url + "/" + requestKey;
......@@ -173,6 +172,7 @@ public class DidiFileUploadService extends BaseService {
}
throw new ServiceException("uploadFile error.");
}
public static String getFileMD5String(MultipartFile file) throws Exception {
MessageDigest messagedigest = MessageDigest.getInstance("MD5");
messagedigest.update(file.getBytes());
......@@ -197,7 +197,6 @@ public class DidiFileUploadService extends BaseService {
}
public PageInfo<DidiFileUploadDetailResult> queryPage(DidiFileIUploadParam param) {
Page page = null;
if (param.getPageInfo() != null && param.getPageInfo().getPageSize() != null && param.getPageInfo().getPageIndex() != null) {
......
......@@ -41,6 +41,7 @@ public class RevenueConfService extends BaseService {
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
RevenueConfigExample example = new RevenueConfigExample();
example.createCriteria().andOrgIdIn(orgDtoList.stream().map(OrgSelectDto::getId).collect(Collectors.toList()));
example.setOrderByClause("org_id");
PageInfo<RevenueConfResult> pageInfo = new PageInfo<>(revenueConfigMapper.selectByExample(example).stream()
.map(o -> beanUtil.copyProperties(o, new RevenueConfResult())).collect(Collectors.toList()));
pageInfo.setTotal(page.getTotal());
......
......@@ -53,6 +53,7 @@ public class RevenueTypeMappingService extends BaseService {
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
RevenueTypeMappingExample example = new RevenueTypeMappingExample();
example.createCriteria().andOrgIdIn(orgDtoList.stream().map(OrgSelectDto::getId).collect(Collectors.toList()));
example.setOrderByClause("org_id");
PageInfo<RevenueTypeResult> pageInfo = new PageInfo<>(typeMappingMapper.selectByExample(example).stream()
.map(o -> beanUtil.copyProperties(o, new RevenueTypeResult())).collect(Collectors.toList()));
pageInfo.setTotal(page.getTotal());
......
......@@ -40,7 +40,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java">
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator>
<table tableName="ebit_spread_data" domainObjectName="EbitSpreadData">
<table tableName="pwc_report_attach" domainObjectName="PwcReportAttach">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
......@@ -548,11 +548,11 @@
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>-->
<!--
<table tableName="period_cell_data" domainObjectName="PeriodCellData">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
</table>-->
<!--<table tableName="period_cell_data_source" domainObjectName="PeriodCellDataSource">
<property name="useActualColumnNames" value="false"/>
......
......@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.EbitCellData;
......@@ -109,4 +110,8 @@ public interface EbitCellDataMapper extends MyVatMapper {
int insertBatch(List<EbitCellData> pls);
@Select({
"SELECT DISTINCT t.organization_id as organizationId FROM ebit_cell_data t WHERE 1=1 AND t.`period` = #{period}"
})
List<EbitCellData> selectOrgType(@Param("period") Integer period);
}
\ No newline at end of file
......@@ -126,6 +126,17 @@ public class PwcReportAttach extends BaseEntity implements Serializable {
*/
private Date updateTime;
/**
* Database Column Remarks:
* 文件上传id,绑定文件库(file_upload)
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column pwc_report_attach.file_upload_id
*
* @mbg.generated
*/
private String fileUploadId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table pwc_report_attach
......@@ -422,6 +433,30 @@ public class PwcReportAttach extends BaseEntity implements Serializable {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column pwc_report_attach.file_upload_id
*
* @return the value of pwc_report_attach.file_upload_id
*
* @mbg.generated
*/
public String getFileUploadId() {
return fileUploadId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column pwc_report_attach.file_upload_id
*
* @param fileUploadId the value for pwc_report_attach.file_upload_id
*
* @mbg.generated
*/
public void setFileUploadId(String fileUploadId) {
this.fileUploadId = fileUploadId == null ? null : fileUploadId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pwc_report_attach
......@@ -446,6 +481,7 @@ public class PwcReportAttach extends BaseEntity implements Serializable {
sb.append(", remarks=").append(remarks);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", fileUploadId=").append(fileUploadId);
sb.append("]");
return sb.toString();
}
......
......@@ -984,6 +984,76 @@ public class PwcReportAttachExample {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andFileUploadIdIsNull() {
addCriterion("file_upload_id is null");
return (Criteria) this;
}
public Criteria andFileUploadIdIsNotNull() {
addCriterion("file_upload_id is not null");
return (Criteria) this;
}
public Criteria andFileUploadIdEqualTo(String value) {
addCriterion("file_upload_id =", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdNotEqualTo(String value) {
addCriterion("file_upload_id <>", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdGreaterThan(String value) {
addCriterion("file_upload_id >", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdGreaterThanOrEqualTo(String value) {
addCriterion("file_upload_id >=", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdLessThan(String value) {
addCriterion("file_upload_id <", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdLessThanOrEqualTo(String value) {
addCriterion("file_upload_id <=", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdLike(String value) {
addCriterion("file_upload_id like", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdNotLike(String value) {
addCriterion("file_upload_id not like", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdIn(List<String> values) {
addCriterion("file_upload_id in", values, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdNotIn(List<String> values) {
addCriterion("file_upload_id not in", values, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdBetween(String value1, String value2) {
addCriterion("file_upload_id between", value1, value2, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdNotBetween(String value1, String value2) {
addCriterion("file_upload_id not between", value1, value2, "fileUploadId");
return (Criteria) this;
}
}
/**
......
......@@ -18,6 +18,7 @@
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="file_upload_id" jdbcType="VARCHAR" property="fileUploadId" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -91,7 +92,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, template_id, col, `row`, del_flag, file_name, file_url, upload_user, `size`,
remarks, create_time, update_time
remarks, create_time, update_time, file_upload_id
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttachExample" resultMap="BaseResultMap">
<!--
......@@ -147,13 +148,13 @@
insert into pwc_report_attach (id, template_id, col,
`row`, del_flag, file_name,
file_url, upload_user, `size`,
remarks, create_time, update_time
)
remarks, create_time, update_time,
file_upload_id)
values (#{id,jdbcType=BIGINT}, #{templateId,jdbcType=VARCHAR}, #{col,jdbcType=BIGINT},
#{row,jdbcType=BIGINT}, #{delFlag,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
#{fileUrl,jdbcType=VARCHAR}, #{uploadUser,jdbcType=VARCHAR}, #{size,jdbcType=VARCHAR},
#{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
#{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{fileUploadId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttach">
<!--
......@@ -198,6 +199,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="fileUploadId != null">
file_upload_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -236,6 +240,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="fileUploadId != null">
#{fileUploadId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttachExample" resultType="java.lang.Long">
......@@ -291,6 +298,9 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.fileUploadId != null">
file_upload_id = #{record.fileUploadId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -313,7 +323,8 @@
`size` = #{record.size,jdbcType=VARCHAR},
remarks = #{record.remarks,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
file_upload_id = #{record.fileUploadId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -358,6 +369,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="fileUploadId != null">
file_upload_id = #{fileUploadId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -377,7 +391,8 @@
`size` = #{size,jdbcType=VARCHAR},
remarks = #{remarks,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
file_upload_id = #{fileUploadId,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttachExample" resultMap="BaseResultMap">
......
......@@ -809,7 +809,7 @@
.sub-title-span {
line-height: 1.42857143;
font-family: 'Microsoft YaHei';
font-weight: 409;
font-weight: 409px;
font-style: normal;
font-size: 13px;
color: #434343;
......@@ -1136,3 +1136,22 @@
}
}
}
.col-sm-8{
width: 52.666667%;
text-align: left!important;
}
.col-sm-4{
width: 45.333333%;
text-align: left!important;
}
.swxx {
.col-sm-4{
width: 25.333333%;
text-align: left!important;
}
.col-sm-2{
width: 23.666667%;
}
margin-top: 20px;
}
......@@ -3068,7 +3068,7 @@
templateId : $scope.templateId
}
$timeout(function () {
/* $timeout(function () {
$('#busy-indicator-container').show();
var mainSpread = new GC.Spread.Sheets.Workbook(document.getElementById("report"), {sheetCount: 1});
mainSpread.isPaintSuspended(true);
......@@ -3087,7 +3087,6 @@
}
var excelIo = new GC.Spread.Excel.IO();
// here is excel IO API
excelIo.save(mainSpread.toJSON(), function (blob) {
if ('export' == $scope.evenType) {
saveAs(blob, vatSessionService.project.name + '-' + vatSessionService.month + '-纳税申报.xlsx');
......@@ -3099,7 +3098,7 @@
$('.export-container').html('');
$('#export').html('');
$log.debug(mainSpread);
}, 500);
}, 500);*/
vatReportService.manyExport(JSON.stringify(param)).success(function(res){
}).error(function(error){
......
......@@ -2487,7 +2487,7 @@
{
caption: '文件名', dataField: "fileName", cellTemplate: function (container, options) {
try {
$('<a href="javascript:;" onClick = "downLoadAttach('+options.data.id+')" target="_blank" style="cursor: pointer">"' + options.data.fileName + '"</a>&nbsp;&nbsp;')
$('<a href="'+options.data.fileUrl+'" target="_blank" style="cursor: pointer">"' + options.data.fileName + '"</a>&nbsp;&nbsp;')
.appendTo(container);
}
catch (e) {
......
......@@ -2322,7 +2322,7 @@
{
caption: '文件名', dataField: "fileName", cellTemplate: function (container, options) {
try {
$('<a href="' + options.data.fileUrl + '" target="_blank" style="cursor: pointer">"' + options.data.fileName + '"</a>&nbsp;&nbsp;')
$('<a href="'+options.data.fileUrl +'" target="_blank" style="cursor: pointer">"' + options.data.fileName + '"</a>&nbsp;&nbsp;')
.appendTo(container);
}
catch (e) {
......@@ -2337,7 +2337,7 @@
{
caption: '操作', cellTemplate: function (container, options) {
try {
$('<button type="button" class="btn btn-in-grid" onclick = "deleteAttach(' + options.data.id + ')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>删除</button>&nbsp;&nbsp;')
$('<button type="button" class="btn btn-in-grid" style="margin-top: -11px;" onclick = "deleteAttach(' + options.data.id + ')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>删除</button>&nbsp;&nbsp;')
.appendTo(container);
}
catch (e) {
......@@ -2361,6 +2361,17 @@
dataSource: '_gridData'
}
};
window.downLoadAttach = function(id){
vatReportService.downLoadAttach(id).success(function (res) {
if(res.result){
//导出成功
}else{
SweetAlert.error(res.resultMsg);
}
}).error();
}
window.deleteAttach = function (id, data) {
swal({
title: "warning!",
......
......@@ -1545,7 +1545,8 @@ constant.importFileType = {
certifiedInvoicesList: 8,
invoiceRecord: 9,
ExtractFinancialData: 10,
ExtractInvoiceData: 11
ExtractInvoiceData: 11,
RevenueMapping: 12
};
constant.citImportFileType = {
......
......@@ -244,9 +244,8 @@
},
downLoadAttach : function(id){
return $http.get('/Report/downLoadAttach?id=' + id);
return $http.get('/Report/downLoadAttach?id=' + id, apiConfig.createVat());
}
};
}]);
\ No newline at end of file
......@@ -106,6 +106,11 @@
//导入事件
var callFinancialApi = function () {
if (!$scope.formParam || !$scope.formParam.orgIds || !$scope.formParam.dataTypes
|| !$scope.formParam.period) {
SweetAlert.warning($translate.instant('PleaseSelectAtLeastOneItem'));
return;
}
dataImportService.callExtractFinancialData($scope.formParam).success(function (data) {
if (data) {
getFinancialDataStatus();
......
......@@ -20,15 +20,17 @@
<div dx-date-box="dateBoxStart"></div>
</div>
<label class="col-sm-1 control-label">{{'SelectedDataType' | translate}}:</label>
<div class="col-sm-3">
<div class="col-sm-2">
<div dx-tag-box="selectTypeOptions"></div>
</div>
<div class="col-sm-1">
<div class="col-sm-2">
<button type="button" atms-permission permission-control-type="ngIf"
permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
class="btn btn-vat-primary"
translate="ImportBtn"
translate="ImportBtn" style="min-width: 50px;"
ng-click="callFinancialApi()"></button>
<button type="button" class="btn btn-vat-primary" translate="Refresh"
ng-click="refreshConfigGrid()" style="min-width: 50px;"></button>
</div>
</div>
......
vatModule.controller('VatRevenueConfMappingController', ['$scope', '$log', '$translate', '$timeout', 'SweetAlert', '$q',
'$interval','dxDataGridService','$http','apiConfig','Upload','apiInterceptor',
function ($scope, $log, $translate, $timeout, SweetAlert, $q, $interval,dxDataGridService,$http,apiConfig,Upload,apiInterceptor) {
'$interval','dxDataGridService','$http','apiConfig','Upload','apiInterceptor','templateService',
function ($scope, $log, $translate, $timeout, SweetAlert, $q, $interval,dxDataGridService,$http,apiConfig,Upload,
apiInterceptor,templateService) {
'use strict';
//表格配置
......@@ -33,7 +34,7 @@
}).appendTo(container);
$('<i class="fa fa-trash" style="cursor: pointer;margin-left: 5px;"></i>')
.on('click', function () {
$scope.editConfig(options.data);
$scope.delConfig([options.data.id]);
}).appendTo(container);
}
catch (e) {
......@@ -48,7 +49,11 @@
mode: 'multiple',
showCheckBoxesMode: 'always',
allowSelectAll: true
}
},
onSelectionChanged: function (data) {
$scope.selectedItems = data.selectedRowsData;
$scope.selectedRecourdCount = data.selectedRowsData.length;
},
});
//刷新页面
......@@ -71,9 +76,25 @@
$($scope.revenueConfAddDiv).modal('show');
};
//删除配置
$scope.delConfig = function () {
SweetAlert.info('del');
$scope.batchDelConfig = function () {
if (!!$scope.selectedRecourdCount) {
$scope.delConfig(_.map($scope.selectedItems, function(item){ return item.id; }));
}else {
SweetAlert.warning($translate.instant('PleaseSelectAtLeastOneItem'));
}
};
///删除配置
$scope.delConfig = function (idList) {
$http.post('/revenueConfMapping/del',idList, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
SweetAlert.success($translate.instant('RevenueDelSuccess'));
$scope.refreshConfigGrid();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
})
};
//添加配置
......@@ -85,6 +106,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
......@@ -96,6 +118,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
......@@ -182,6 +205,35 @@
});
};
$scope.downloadTemplate = function () {
templateService.downloadTemplate(constant.importFileType.RevenueMapping).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "开票记录与收入类型映射模板");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "开票记录与收入类型映射模板.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
(function initialize() {
......
......@@ -5,16 +5,16 @@
</div>
<div id="tab_total">
<form class="form-inline">
<div class="form-group">
<div class="form-group" style="margin-top: 5px;">
<button type="button" class="btn btn-secondary" ng-click="addConfig()">{{'RevenueAddBtn' | translate }}</button>&nbsp;&nbsp;&nbsp;
<button type="button" class="btn btn-third" ng-click="delConfig()">{{'RevenueDelBtn' | translate }}</button>&nbsp;&nbsp;&nbsp;
<button type="button" class="btn btn-third" ng-click="batchDelConfig()">{{'RevenueDelBtn' | translate }}</button>&nbsp;&nbsp;&nbsp;
<label class="control-label">文件:</label>
<input class="form-control" type="text" name="fileName" ng-model="uploadFile.file.name" readonly placeholder=""/>
<button type="button" type="file" ngf-select ng-model="uploadFile.file" accept=".xls,.xlsx" class="btn btn-secondary browse">{{'SelectFile' | translate }}</button>
<button type="button" class="btn btn-secondary" translate="CoverImportBtn" ng-click="upload()"></button>
<button type="button" class="btn btn-secondary" translate="AddImportBtn" ng-click="upload()"></button>
<button type="button" class="btn btn-in-grid inline-div" ng-click="downEntepriseAccountTemplate()"><i
<button type="button" class="btn btn-in-grid inline-div" ng-click="downloadTemplate()"><i
class="fa fa-download" aria-hidden="true"></i>下载模板
</button>
</div>
......
......@@ -108,6 +108,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
......@@ -119,6 +120,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
......
......@@ -5,7 +5,7 @@
</div>
<div id="tab_total">
<form class="form-inline">
<div class="form-group"><div class="import-wrapper">
<div class="form-group" style="margin-top: 5px;"><div class="import-wrapper">
<button type="button" class="btn btn-primary" ng-click="addConfig()">{{'RevenueAddBtn' | translate }}</button>&nbsp;&nbsp;&nbsp;
<button type="button" class="btn btn-third" ng-click="batchDelConfig()">{{'RevenueDelBtn' | translate }}</button>
</div></div>
......
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