Commit 1e9d27f2 authored by gary's avatar gary

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

parents a1399503 86a8faee
...@@ -2,14 +2,12 @@ package pwc.taxtech.atms.common; ...@@ -2,14 +2,12 @@ package pwc.taxtech.atms.common;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Iterator;
import java.util.Optional; import java.util.Optional;
public class POIUtil { public class POIUtil {
...@@ -119,6 +117,89 @@ public class POIUtil { ...@@ -119,6 +117,89 @@ public class POIUtil {
return row; return row;
} }
public static Row createAndCloneRow(Workbook wb ,Sheet sheet, Integer destRowIndex,Row fromRow) {
Row toRow = null;
if (sheet.getRow(destRowIndex) != null) {
int lastRowNo = sheet.getLastRowNum();
sheet.shiftRows(destRowIndex, lastRowNo, 1);
}
toRow = sheet.createRow(destRowIndex);
for (Iterator cellIt = fromRow.cellIterator(); cellIt.hasNext();) {
Cell tmpCell = (Cell) cellIt.next();
Cell newCell = toRow.createCell(tmpCell.getColumnIndex());
copyCell(wb, tmpCell, newCell, false);
}
return toRow;
}
public static void copyCell(Workbook wb,Cell srcCell, Cell distCell,
boolean copyValueFlag) {
CellStyle newstyle=wb.createCellStyle();
copyCellStyle(wb,srcCell.getCellStyle(), newstyle);
if(srcCell.getColumnIndex()==7){
newstyle.setLocked(false);
}
// distCell.setEncoding(srcCell.getEncoding());
//样式
distCell.setCellStyle(newstyle);
//评论
if (srcCell.getCellComment() != null) {
distCell.setCellComment(srcCell.getCellComment());
}
// 不同数据类型处理
int srcCellType = srcCell.getCellType();
distCell.setCellType(srcCellType);
if (copyValueFlag) {
if (srcCellType == Cell.CELL_TYPE_NUMERIC) {
if (DateUtil.isCellDateFormatted(srcCell)) {
distCell.setCellValue(srcCell.getDateCellValue());
} else {
distCell.setCellValue(srcCell.getNumericCellValue());
}
} else if (srcCellType == Cell.CELL_TYPE_STRING) {
distCell.setCellValue(srcCell.getRichStringCellValue());
} else if (srcCellType == Cell.CELL_TYPE_BLANK) {
// nothing21
} else if (srcCellType == Cell.CELL_TYPE_BOOLEAN) {
distCell.setCellValue(srcCell.getBooleanCellValue());
} else if (srcCellType == Cell.CELL_TYPE_ERROR) {
distCell.setCellErrorValue(srcCell.getErrorCellValue());
} else if (srcCellType == Cell.CELL_TYPE_FORMULA) {
distCell.setCellFormula(srcCell.getCellFormula());
} else { // nothing29
}
}
}
public static void copyCellStyle(Workbook wb,CellStyle fromStyle,
CellStyle toStyle) {
toStyle.setAlignment(HorizontalAlignment.forInt(fromStyle.getAlignment()));
//边框和边框颜色
toStyle.setBorderBottom(BorderStyle.valueOf(fromStyle.getBorderBottom()));
toStyle.setBorderLeft(BorderStyle.valueOf(fromStyle.getBorderLeft()));
toStyle.setBorderRight(BorderStyle.valueOf(fromStyle.getBorderRight()));
toStyle.setBorderTop(BorderStyle.valueOf(fromStyle.getBorderTop()));
toStyle.setTopBorderColor(fromStyle.getTopBorderColor());
toStyle.setBottomBorderColor(fromStyle.getBottomBorderColor());
toStyle.setRightBorderColor(fromStyle.getRightBorderColor());
toStyle.setLeftBorderColor(fromStyle.getLeftBorderColor());
//背景和前景
toStyle.setFillBackgroundColor(fromStyle.getFillBackgroundColor());
toStyle.setFillForegroundColor(fromStyle.getFillForegroundColor());
//
toStyle.setDataFormat(fromStyle.getDataFormat());
toStyle.setFillPattern(FillPatternType.forInt(fromStyle.getFillPattern()));
toStyle.setFont(wb.getFontAt(fromStyle.getFontIndex()));
toStyle.setHidden(fromStyle.getHidden());
toStyle.setIndention(fromStyle.getIndention());//首行缩进
toStyle.setLocked(fromStyle.getLocked());
toStyle.setRotation(fromStyle.getRotation());//旋转
toStyle.setVerticalAlignment(VerticalAlignment.forInt(fromStyle.getVerticalAlignment()));
toStyle.setWrapText(fromStyle.getWrapText());
}
} }
package pwc.taxtech.atms.constant.enums;
import java.util.HashMap;
import java.util.Map;
public class TaxesCalculateReportEnum {
public enum Column {
Column_1(0, "序号"),
Column_2(1, "收入类型名称"),
Column_3(2, "税金项目"),
Column_4(3, "账载收入-明细"),
Column_5(4, "销项开票收入数-专票"),
Column_6(5, "销项开票收入数-普票"),
Column_7(6, "计税基数(应税收入)"),
Column_8(7, "税率"),
Column_9(8, "税额(元)"),
Column_10(9, "收入类别"),
Column_11(10, "计税方式"),
Column_12(11, "备注")
;
private Integer index;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
Column(Integer index, String name) {
this.index = index;
this.name = name;
}
public Integer getIndex() {
return index;
}
public String getName() {
return name;
}
static {
for (TaxesCalculateReportEnum.Column accountType : TaxesCalculateReportEnum.Column.values()) {
MAPPING.put(accountType.getIndex(), accountType.getName());
}
}
}
}
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import pwc.taxtech.atms.dto.ReturnData; import pwc.taxtech.atms.dto.ReturnData;
...@@ -24,7 +26,7 @@ public class OperationLogTaxDocController { ...@@ -24,7 +26,7 @@ public class OperationLogTaxDocController {
@RequestMapping("selectList") @RequestMapping("selectList")
@ResponseBody @ResponseBody
public ReturnData selectTaxDocumentList(){ public ReturnData selectTaxDocumentList() {
List<OperationLogTaxDocument> operationLogTaxDocuments = operationLogTaxDocService.selectTaxDocumentList(); List<OperationLogTaxDocument> operationLogTaxDocuments = operationLogTaxDocService.selectTaxDocumentList();
ReturnData returnData = new ReturnData(); ReturnData returnData = new ReturnData();
returnData.setItems(operationLogTaxDocuments); returnData.setItems(operationLogTaxDocuments);
...@@ -34,13 +36,15 @@ public class OperationLogTaxDocController { ...@@ -34,13 +36,15 @@ public class OperationLogTaxDocController {
/** /**
* 根据 id 数组来查询相关日志 * 根据 id 数组来查询相关日志
* @param taxDocumentIds *
* @param operationLogTaxDocument
* @return * @return
*/ */
@RequestMapping("/selectListForLog") @RequestMapping("/selectListForLog")
@ResponseBody @ResponseBody
public ReturnData selectListForLog(List<String> taxDocumentIds){ public ReturnData selectListForLog(@RequestBody OperationLogTaxDocument operationLogTaxDocument) {
List<OperationLogTaxDocument> operationLogTaxDocuments = operationLogTaxDocService.selectListForLog(taxDocumentIds); List<String> ids = operationLogTaxDocument.getIds() == null ? Lists.newArrayList() : operationLogTaxDocument.getIds();
List<OperationLogTaxDocument> operationLogTaxDocuments = operationLogTaxDocService.selectListForLog(ids);
ReturnData returnData = new ReturnData(); ReturnData returnData = new ReturnData();
returnData.setItems(operationLogTaxDocuments); returnData.setItems(operationLogTaxDocuments);
returnData.setTotalCount(operationLogTaxDocuments.size()); returnData.setTotalCount(operationLogTaxDocuments.size());
...@@ -49,25 +53,25 @@ public class OperationLogTaxDocController { ...@@ -49,25 +53,25 @@ public class OperationLogTaxDocController {
@RequestMapping("add") @RequestMapping("add")
@ResponseBody @ResponseBody
public boolean addTaxDocuments(OperationLogTaxDocument operationLogTaxDocument){ public boolean addTaxDocuments(OperationLogTaxDocument operationLogTaxDocument) {
return operationLogTaxDocService.addTaxDocumentList(operationLogTaxDocument); return operationLogTaxDocService.addTaxDocumentList(operationLogTaxDocument);
} }
@RequestMapping("delete") @RequestMapping("delete")
@ResponseBody @ResponseBody
public boolean deleteTaxDocuments(String id){ public boolean deleteTaxDocuments(String id) {
return operationLogTaxDocService.deleteTaxDocument(id); return operationLogTaxDocService.deleteTaxDocument(id);
} }
@RequestMapping("edit") @RequestMapping("edit")
@ResponseBody @ResponseBody
public boolean editTaxDocuments(OperationLogTaxDocument operationLogTaxDocument){ public boolean editTaxDocuments(OperationLogTaxDocument operationLogTaxDocument) {
return operationLogTaxDocService.editFilesType(operationLogTaxDocument); return operationLogTaxDocService.editFilesType(operationLogTaxDocument);
} }
@RequestMapping("exportExcel") @RequestMapping("exportExcel")
@ResponseBody @ResponseBody
public void exportExcelFile (HttpServletResponse response){ public void exportExcelFile(HttpServletResponse response) {
try { try {
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
headers.put("id", "id"); headers.put("id", "id");
...@@ -86,7 +90,7 @@ public class OperationLogTaxDocController { ...@@ -86,7 +90,7 @@ public class OperationLogTaxDocController {
response.setHeader("Content-Disposition", "attachment;fileName=" + new String("".getBytes("GB2312"), "ISO-8859-1")); response.setHeader("Content-Disposition", "attachment;fileName=" + new String("".getBytes("GB2312"), "ISO-8859-1"));
OutputStream ouputStream = response.getOutputStream(); OutputStream ouputStream = response.getOutputStream();
ExcelUtil.exportExcel(headers, TaxDocuments, ouputStream); ExcelUtil.exportExcel(headers, TaxDocuments, ouputStream);
}catch(Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
......
...@@ -246,6 +246,13 @@ public class TaxDocumentController { ...@@ -246,6 +246,13 @@ public class TaxDocumentController {
} }
} }
/**
* 下载全部附件
*/
@PostMapping(value = "/downloadAllFile")
public void downloadAllFile(HttpServletResponse response, @RequestBody TaxDocumentDto taxDocumentDto) {
taxDocumentService.downloadAllFile(response,taxDocumentDto.getIds());
}
/** /**
* 解析json * 解析json
......
...@@ -185,7 +185,6 @@ public class TemplateController extends BaseController { ...@@ -185,7 +185,6 @@ public class TemplateController extends BaseController {
@RequestParam(name = "projectId") String projectId, @RequestParam(name = "projectId") String projectId,
HttpServletResponse response) throws URISyntaxException { HttpServletResponse response) throws URISyntaxException {
period = 0;
String filePath; String filePath;
File templateFile; File templateFile;
InputStream inputStream = null; InputStream inputStream = null;
......
...@@ -51,7 +51,9 @@ public class OperationLogTaxDocServiceImpl { ...@@ -51,7 +51,9 @@ public class OperationLogTaxDocServiceImpl {
public List<OperationLogTaxDocument> selectListForLog(List<String> taxDocumentIds) { public List<OperationLogTaxDocument> selectListForLog(List<String> taxDocumentIds) {
OperationLogTaxDocumentExample example = new OperationLogTaxDocumentExample(); OperationLogTaxDocumentExample example = new OperationLogTaxDocumentExample();
OperationLogTaxDocumentExample.Criteria criteria = example.createCriteria(); OperationLogTaxDocumentExample.Criteria criteria = example.createCriteria();
if (taxDocumentIds.size()>0){
criteria.andIdIn(taxDocumentIds); criteria.andIdIn(taxDocumentIds);
}
return operationLogTaxDocumentMapper.selectByExample(example); return operationLogTaxDocumentMapper.selectByExample(example);
} }
} }
...@@ -22,8 +22,16 @@ import pwc.taxtech.atms.vat.entity.FileUpload; ...@@ -22,8 +22,16 @@ import pwc.taxtech.atms.vat.entity.FileUpload;
import pwc.taxtech.atms.vat.entity.ReportFileUpload; import pwc.taxtech.atms.vat.entity.ReportFileUpload;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/** /**
* 查询 * 查询
...@@ -47,8 +55,6 @@ public class TaxDocumentServiceImpl { ...@@ -47,8 +55,6 @@ public class TaxDocumentServiceImpl {
@Autowired @Autowired
DidiFileUploadService didiFileUploadService; DidiFileUploadService didiFileUploadService;
@Autowired
private BusinessUnitServiceImpl businessUnitService;
@Autowired @Autowired
private OrganizationServiceImpl organizationService; private OrganizationServiceImpl organizationService;
...@@ -340,4 +346,127 @@ public class TaxDocumentServiceImpl { ...@@ -340,4 +346,127 @@ public class TaxDocumentServiceImpl {
return false; return false;
} }
} }
public void downloadAllFile(HttpServletResponse response, List<Long> ids) {
String downloadName = "多选附件.zip";
try {
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(downloadName, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("下载文件名编码时出现错误.", e);
}
OutputStream outputStream = null;
ZipOutputStream zos = null;
try {
outputStream = response.getOutputStream();
zos = new ZipOutputStream(outputStream);
// 将文件流写入zip中
downloadTolocal(zos, ids);
} catch (IOException e) {
log.error("downloadAllFile-xxx下载全部附件失败,ids=[{}],错误信息=[{}]", ids, e);
} finally {
if (zos != null) {
try {
zos.close();
} catch (Exception e2) {
log.info("关闭输入流时出现错误", e2);
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (Exception e2) {
log.info("关闭输入流时出现错误", e2);
}
}
}
}
/**
* // 将文件流写入zip中
*
* @param zos
* @param ids
*/
private void downloadTolocal(ZipOutputStream zos, List<Long> ids) {
TaxDocumentExample example = new TaxDocumentExample();
TaxDocumentExample.Criteria criteria = example.createCriteria();
if (null == ids || ids.size() < 1) {
throw new RuntimeException("传入参数错误:空参数数组");
}
criteria.andIdIn(ids);
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(example);
for (TaxDocument item : taxDocuments) {
//文件url
String urlPath = item.getFilePositionUrl();
//如果url为null或空字符串而抛出异常
if (StringUtils.isBlank(urlPath)) {
throw new RuntimeException("文件url为空,id为:" + item.getId());
}
//文件名称(带后缀)
String fileName = StringUtils.isBlank(item.getFileOriginalName()) ? "未知文件(请修改后缀名).xlsx" : item.getFileOriginalName();
InputStream is = null;
BufferedInputStream in = null;
byte[] buffer = new byte[1024];
int len;
//创建zip实体(一个文件对应一个ZipEntry)
ZipEntry entry = new ZipEntry(fileName);
try {
//获取需要下载的文件流
URL httpurl = new URL(URLDecoder.decode(urlPath, "UTF-8"));
HttpURLConnection httpConn = (HttpURLConnection) httpurl.openConnection();
httpConn.setDoOutput(true);// 使用 URL 连接进行输出
httpConn.setDoInput(true);// 使用 URL 连接进行输入
httpConn.setUseCaches(false);// 忽略缓存
httpConn.setRequestMethod("GET");// 设置URL请求方法
//可设置请求头
httpConn.setRequestProperty("Content-Type", "application/octet-stream");
httpConn.setRequestProperty("Connection", "Keep-Alive");// 维持长连接
httpConn.setRequestProperty("Charset", "UTF-8");
httpConn.connect();
if (httpConn.getResponseCode() >= 400) {
is = httpConn.getErrorStream();
} else {
is = httpConn.getInputStream();
}
in = new BufferedInputStream(is);
zos.putNextEntry(entry);
//文件流循环写入ZipOutputStream
while ((len = in.read(buffer)) != -1) {
zos.write(buffer, 0, len);
}
} catch (Exception e) {
log.info("xxx--下载全部附件--压缩文件出错", e);
} finally {
if (entry != null) {
try {
zos.closeEntry();
} catch (Exception e2) {
log.info("xxx下载全部附件--zip实体关闭失败", e2);
}
}
if (in != null) {
try {
in.close();
} catch (Exception e2) {
log.info("xxx下载全部附件--文件输入流关闭失败", e2);
}
}
if (is != null) {
try {
is.close();
} catch (Exception e) {
log.info("xxx下载全部附件--输入缓冲流关闭失败", e);
}
}
}
}
}
} }
...@@ -177,6 +177,7 @@ public class FormulaAgent { ...@@ -177,6 +177,7 @@ public class FormulaAgent {
public static String _buildSql(String getField, String tableName, String filter, String filterValue, Integer period, FormulaContext formulaContext, String year, boolean bool, boolean getSql) throws Exception { public static String _buildSql(String getField, String tableName, String filter, String filterValue, Integer period, FormulaContext formulaContext, String year, boolean bool, boolean getSql) throws Exception {
String sql = ""; String sql = "";
if(getSql){ if(getSql){
tableName = tableName.toLowerCase();
sql = "select * from " + tableName + " where 1=1 and " + filter + filterValue; sql = "select * from " + tableName + " where 1=1 and " + filter + filterValue;
return sql; return sql;
}else{ }else{
......
...@@ -19,7 +19,6 @@ import org.springframework.stereotype.Component; ...@@ -19,7 +19,6 @@ import org.springframework.stereotype.Component;
import pwc.taxtech.atms.common.POIUtil; import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.enums.CellDataSourceType; import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import pwc.taxtech.atms.constant.enums.FileUploadEnum;
import pwc.taxtech.atms.dao.ProjectMapper; import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam; import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult; import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
...@@ -34,7 +33,10 @@ import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto; ...@@ -34,7 +33,10 @@ import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto;
import pwc.taxtech.atms.vat.entity.*; import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.report.functions.*; import pwc.taxtech.atms.vat.service.impl.report.functions.*;
import java.io.*; import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
...@@ -47,31 +49,32 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*; ...@@ -47,31 +49,32 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component @Component
public class ReportGeneratorImpl { public class ReportGeneratorImpl {
private static final Logger logger = LoggerFactory.getLogger(ReportGeneratorImpl.class); private static final Logger logger = LoggerFactory.getLogger(ReportGeneratorImpl.class);
@Autowired @Resource
private ProjectMapper projectMapper; private ProjectMapper projectMapper;
@Autowired @Autowired
private HttpFileService httpFileService; private HttpFileService httpFileService;
@Autowired @Autowired
private FormulaAgent formulaAgent; private FormulaAgent formulaAgent;
@Autowired @Resource
private PeriodCellDataMapper periodCellDataMapper; private PeriodCellDataMapper periodCellDataMapper;
@Autowired @Resource
private PeriodFormulaBlockMapper periodFormulaBlockMapper; private PeriodFormulaBlockMapper periodFormulaBlockMapper;
@Autowired @Resource
private PeriodDataSourceMapper periodDataSourceMapper; private RevenueConfigMapper revenueConfigMapper;
@Autowired @Resource
private PeriodCellTemplateConfigMapper periodCellTemplateConfigMapper; private PeriodCellTemplateConfigMapper periodCellTemplateConfigMapper;
@Autowired @Resource
private PeriodCellTemplateMapper periodCellTemplateMapper; private PeriodCellTemplateMapper periodCellTemplateMapper;
@Autowired @Resource
private PeriodTemplateMapper periodTemplateMapper; private PeriodTemplateMapper periodTemplateMapper;
@Autowired @Autowired
private DistributedIdService distributedIdService; private DistributedIdService distributedIdService;
@Autowired @Resource
private PeriodJobMapper periodJobMapper; private PeriodJobMapper periodJobMapper;
@Autowired @Autowired
private DidiFileUploadService didiFileUploadService; private DidiFileUploadService didiFileUploadService;
public FormulaContext initContext(PeriodResources resources, Integer period) { public FormulaContext initContext(PeriodResources resources, Integer period) {
return FormulaContext.extractContextFromProject(resources.getProject()).fixedFormula(period, resources.getTemplateGroupId(), return FormulaContext.extractContextFromProject(resources.getProject()).fixedFormula(period, resources.getTemplateGroupId(),
formulaAgent); formulaAgent);
...@@ -503,26 +506,7 @@ public class ReportGeneratorImpl { ...@@ -503,26 +506,7 @@ public class ReportGeneratorImpl {
} }
} }
} }
//TODO 当是税金计算表时动态添加行
if ("VAT8002".equals(a.getCode())) {
tWorkbook = assembleTaxWorkBook(tWorkbook);
//覆盖template地址
ByteArrayOutputStream bout = new ByteArrayOutputStream();
try {
tWorkbook.write(bout);
FileUpload fileUpload = didiFileUploadService.uploadFile(bout.toByteArray(), a.getCode() + "_" + a.getName() + ".xlsx", FileUploadEnum.BizSource.PERIOD_REPORT_TEMPLATE_UPLOAD.name());
a.setPath(fileUpload.getUid());
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bout.close();
} catch (Exception e) {
}
}
periodTemplateMapper.updateByPrimaryKey(a);
}
POIUtil.cloneSheet(tWorkbook.getSheetAt(0), workbook.createSheet(a.getCode())); POIUtil.cloneSheet(tWorkbook.getSheetAt(0), workbook.createSheet(a.getCode()));
}); });
...@@ -536,29 +520,6 @@ public class ReportGeneratorImpl { ...@@ -536,29 +520,6 @@ public class ReportGeneratorImpl {
} }
} }
public Workbook assembleTaxWorkBook(Workbook tWorkbook) {
Sheet sheet = tWorkbook.getSheetAt(0);
Row row = POIUtil.createRow(sheet, 3);
Cell cell = row.createCell(0);
cell.setCellValue("test");
return tWorkbook;
}
private void saveExcel(Workbook wb) {
FileOutputStream fileOut;
try {
fileOut = new FileOutputStream("");
wb.write(fileOut);
fileOut.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/** /**
* 注册所有的自定义方法到工作簿 * 注册所有的自定义方法到工作簿
......
...@@ -9,17 +9,20 @@ import com.google.common.collect.Sets; ...@@ -9,17 +9,20 @@ import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.FormulaEvaluator; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.util.*; import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.util.DataUtil;
import pwc.taxtech.atms.common.util.FileUploadUtil;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant; import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.*; import pwc.taxtech.atms.constant.enums.*;
import pwc.taxtech.atms.dao.*; import pwc.taxtech.atms.dao.*;
...@@ -27,24 +30,25 @@ import pwc.taxtech.atms.dpo.ReportDto; ...@@ -27,24 +30,25 @@ import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.FileDto; import pwc.taxtech.atms.dto.FileDto;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.ReportAttachDto; import pwc.taxtech.atms.dto.ReportAttachDto;
import pwc.taxtech.atms.dto.revenuconf.RevenueConfResult; import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.dto.vatdto.*; import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.NotFoundException; import pwc.taxtech.atms.exception.NotFoundException;
import pwc.taxtech.atms.service.impl.BaseService; import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.service.impl.CellConfigTranslater; import pwc.taxtech.atms.service.impl.*;
import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.vat.dao.*; import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.dao.DataValidateLogMapper;
import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto; import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto;
import pwc.taxtech.atms.vat.dpo.DataSourceExtendDto; import pwc.taxtech.atms.vat.dpo.DataSourceExtendDto;
import pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto; import pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto;
import pwc.taxtech.atms.vat.entity.*; import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.entity.DataValidateLog;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper; import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper;
import javax.annotation.Resource;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
...@@ -60,69 +64,75 @@ public class ReportServiceImpl extends BaseService { ...@@ -60,69 +64,75 @@ public class ReportServiceImpl extends BaseService {
private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class); private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>(); private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>();
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX", private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX",
"JXFP", "PSUM", "DFFS", "JFFS", "WPSR","WPNAME","WPTYPE", "SUM2", "RSUMIF", "TABLESUMIF", "SUM"}; "JXFP", "PSUM", "DFFS", "JFFS", "WPSR","WPNAME","WPTYPE", "SUM2", "RSUMIF", "SUM"};
@Autowired @Autowired
private ReportGeneratorImpl reportGenerator; private ReportGeneratorImpl reportGenerator;
@Autowired @Resource
private PeriodTaxRuleSettingMapper periodTaxRuleSettingMapper; private PeriodTaxRuleSettingMapper periodTaxRuleSettingMapper;
@Autowired @Resource
private PeriodTaxPayerReportRuleMapper periodTaxPayerReportRuleMapper; private PeriodTaxPayerReportRuleMapper periodTaxPayerReportRuleMapper;
@Autowired @Resource
private PeriodEnterpriseAccountMapper periodEnterpriseAccountMapper; private PeriodEnterpriseAccountMapper periodEnterpriseAccountMapper;
@Autowired @Autowired
private InputVatInvoiceMapper inputVATInvoiceMapper; private InputVatInvoiceMapper inputVATInvoiceMapper;
@Autowired @Autowired
private OutputVatInvoiceMapper outputVATInvoiceMapper; private OutputVatInvoiceMapper outputVATInvoiceMapper;
@Autowired @Resource
private CustomsInvoiceMapper customsInvoiceMapper; private CustomsInvoiceMapper customsInvoiceMapper;
@Autowired @Resource
private PeriodCellDataSourceMapper periodCellDataSourceMapper; private PeriodCellDataSourceMapper periodCellDataSourceMapper;
@Autowired @Resource
private KeyValueConfigMapper keyValueConfigMapper; private KeyValueConfigMapper keyValueConfigMapper;
@Autowired @Resource
private PeriodModifiedReportCellMapper periodModifiedReportCellMapper; private PeriodModifiedReportCellMapper periodModifiedReportCellMapper;
@Autowired @Resource
private PeriodReportMapper periodReportMapper; private PeriodReportMapper periodReportMapper;
@Autowired @Resource
private EnterpriseAccountMapper enterpriseAccountMapper; private EnterpriseAccountMapper enterpriseAccountMapper;
@Autowired @Resource
private CellTemplateConfigMapper cellTemplateConfigMapper; private CellTemplateConfigMapper cellTemplateConfigMapper;
@Autowired @Resource
private CellTemplateMapper cellTemplateMapper; private CellTemplateMapper cellTemplateMapper;
@Autowired @Resource
private PeriodDataSourceDetailMapper periodDataSourceDetailMapper; private PeriodDataSourceDetailMapper periodDataSourceDetailMapper;
@Autowired @Resource
private PeriodDataSourceMapper periodDataSourceMapper; private PeriodDataSourceMapper periodDataSourceMapper;
@Autowired @Resource
private PeriodCellDataMapper periodCellDataMapper; private PeriodCellDataMapper periodCellDataMapper;
@Autowired @Resource
private PeriodFormulaBlockMapper periodFormulaBlockMapper; private PeriodFormulaBlockMapper periodFormulaBlockMapper;
@Autowired @Resource
private PeriodCellTemplateConfigMapper periodCellTemplateConfigMapper; private PeriodCellTemplateConfigMapper periodCellTemplateConfigMapper;
@Autowired @Resource
private PeriodCellTemplateMapper periodCellTemplateMapper; private PeriodCellTemplateMapper periodCellTemplateMapper;
@Autowired @Resource
private PeriodTemplateMapper periodTemplateMapper; private PeriodTemplateMapper periodTemplateMapper;
@Autowired @Resource
private TemplateMapper templateMapper; private TemplateMapper templateMapper;
@Autowired @Resource
private ProjectServiceTypeMapper projectServiceTypeMapper; private ProjectServiceTypeMapper projectServiceTypeMapper;
@Autowired @Resource
private TaxPayerReportRuleMapper taxPayerReportRuleMapper; private TaxPayerReportRuleMapper taxPayerReportRuleMapper;
@Autowired @Resource
private ProjectMapper projectMapper; private ProjectMapper projectMapper;
@Autowired @Resource
private DistributedIdService distributedIdService; private DistributedIdService distributedIdService;
@Autowired @Resource
private PeriodJobMapper periodJobMapper; private PeriodJobMapper periodJobMapper;
@Autowired @Resource
private PeriodApproveMapper periodApprovalMapper; private PeriodApproveMapper periodApprovalMapper;
@Resource
RevenueConfigMapper revenueConfigMapper;
@Autowired
private HttpFileService httpFileService;
@Autowired
DidiFileUploadService didiFileUploadService;
public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) { public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) {
OperationResultDto<List<ReportDto>> result = new OperationResultDto<>(); OperationResultDto<List<ReportDto>> result = new OperationResultDto<>();
CommonUtils.copyProperties(getReportTemplate(projectId,serviceType,periodParam),result); CommonUtils.copyProperties(getReportTemplate(projectId, serviceType, periodParam), result);
if(!result.getResult() || CollectionUtils.isEmpty(result.getData())) return result; if (!result.getResult() || CollectionUtils.isEmpty(result.getData())) return result;
int period = periodParam != null ? periodParam : 0; int period = periodParam != null ? periodParam : 0;
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample(); PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId) periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId)
...@@ -348,12 +358,187 @@ public class ReportServiceImpl extends BaseService { ...@@ -348,12 +358,187 @@ public class ReportServiceImpl extends BaseService {
periodCellTemplateConfigList.add(periodCellTemplateConfig); periodCellTemplateConfigList.add(periodCellTemplateConfig);
} }
CommonUtils.subListWithLen(periodCellTemplateConfigList,CommonUtils.BATCH_NUM).forEach(batch->{ CommonUtils.subListWithLen(periodCellTemplateConfigList, CommonUtils.BATCH_NUM).forEach(batch -> {
periodCellTemplateConfigMapper.batchInsert(batch); periodCellTemplateConfigMapper.batchInsert(batch);
}); });
} }
@Transactional
public void assemblePeriodTemplate(Template template, Workbook workbook, String projectId, Integer period, Integer addRowIndex) throws ServiceException {
try {
Date now = new Date();
Sheet sheet = workbook.getSheetAt(0);
List<PeriodCellTemplate> cellTemplateList = Lists.newArrayList();
List<PeriodCellTemplateConfig> cellTemplateConfigList = Lists.newArrayList();
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r);
for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) {
Cell cell = row.getCell(c);
if (cell == null) {
continue;//todo cell == null 如何处理
}
//查询原来行cell是否有CellTemplate
CellTemplateExample cellTemplateExample = new CellTemplateExample();
cellTemplateExample.createCriteria().andReportTemplateIdEqualTo(template.getId()).andRowIndexEqualTo(r - addRowIndex).andColumnIndexEqualTo(c);
List<CellTemplate> cellTemplates = cellTemplateMapper.selectByExample(cellTemplateExample);
if (CollectionUtils.isNotEmpty(cellTemplates)) {
CellTemplate cellTemplate = cellTemplates.get(0);
PeriodCellTemplate periodCellTemplate = new PeriodCellTemplate();
CommonUtils.copyProperties(cellTemplate, periodCellTemplate);
periodCellTemplate.setId(distributedIdService.nextId());
periodCellTemplate.setPeriod(period);
periodCellTemplate.setReportTemplateId(template.getId());
periodCellTemplate.setRowIndex(r);
periodCellTemplate.setRowName(cellTemplate.getRowName());
periodCellTemplate.setColumnIndex(c);
periodCellTemplate.setColumnName(cellTemplate.getColumnName());
periodCellTemplate.setComment(cellTemplate.getComment());
periodCellTemplate.setCreateTime(cellTemplate.getCreateTime());
periodCellTemplate.setUpdateTime(cellTemplate.getUpdateTime());
periodCellTemplate.setCellTemplateId(cellTemplate.getId());
periodCellTemplate.setDataType(cellTemplate.getDataType());
periodCellTemplate.setIsReadOnly(cellTemplate.getIsReadOnly() ? 1 : 0);
periodCellTemplate.setCopyFromId(cellTemplate.getCopyFromId());
periodCellTemplate.setCreateBy(StringUtils.isBlank(cellTemplate.getCreateBy()) ? "admin" : cellTemplate.getCreateBy());
periodCellTemplate.setUpdateBy(StringUtils.isBlank(cellTemplate.getUpdateBy()) ? "admin" : cellTemplate.getUpdateBy());
periodCellTemplate.setProjectId(projectId);
cellTemplateList.add(periodCellTemplate);
CellTemplateConfigExample configExample = new CellTemplateConfigExample();
configExample.createCriteria().andCellTemplateIdEqualTo(cellTemplate.getId());
List<CellTemplateConfig> configs = cellTemplateConfigMapper.selectByExample(configExample);
if (CollectionUtils.isNotEmpty(configs)) {
for (CellTemplateConfig cellTemplateConfig : configs) {
PeriodCellTemplateConfig periodCellTemplateConfig = new PeriodCellTemplateConfig();
CommonUtils.copyProperties(cellTemplateConfig, periodCellTemplateConfig);
periodCellTemplateConfig.setId(distributedIdService.nextId());
periodCellTemplateConfig.setPeriod(period);
periodCellTemplateConfig.setCellTemplateId(cellTemplateConfig.getCellTemplateId());
periodCellTemplateConfig.setReportTemplateId(template.getId());
periodCellTemplateConfig.setDataSourceType(cellTemplateConfig.getDataSourceType());
periodCellTemplateConfig.setFormula(StringUtils.isBlank(cellTemplateConfig.getFormula()) ? null : cellTemplateConfig.getFormula());
periodCellTemplateConfig.setParsedFormula(null);
periodCellTemplateConfig.setFormulaDescription(cellTemplateConfig.getFormulaDescription());
periodCellTemplateConfig.setAccountCodes(cellTemplateConfig.getAccountCodes());
periodCellTemplateConfig.setInvoiceType(cellTemplateConfig.getInvoiceType());
periodCellTemplateConfig.setTaxRate(cellTemplateConfig.getTaxRate());
periodCellTemplateConfig.setInvoiceAmountType(cellTemplateConfig.getInvoiceAmountType());
periodCellTemplateConfig.setModelIds(cellTemplateConfig.getModelIds());
periodCellTemplateConfig.setCreateBy(StringUtils.isBlank(cellTemplateConfig.getCreateBy()) ? "admin" : cellTemplateConfig.getCreateBy());
periodCellTemplateConfig.setCreateTime(cellTemplateConfig.getCreateTime());
periodCellTemplateConfig.setUpdateBy(StringUtils.isBlank(cellTemplateConfig.getUpdateBy()) ? "admin" : cellTemplateConfig.getUpdateBy());
periodCellTemplateConfig.setUpdateTime(cellTemplateConfig.getUpdateTime());
periodCellTemplateConfig.setInvoiceCategory(cellTemplateConfig.getInvoiceCategory());
periodCellTemplateConfig.setFormulaDataSource(cellTemplateConfig.getFormulaDataSource());
periodCellTemplateConfig.setValidation(cellTemplateConfig.getValidation());
periodCellTemplateConfig.setParsedValidation(null);
periodCellTemplateConfig.setValidationDescription(cellTemplateConfig.getValidationDescription());
periodCellTemplateConfig.setVoucherKeyword(cellTemplateConfig.getVoucherKeyword());
periodCellTemplateConfig.setCellTemplateConfigId(cellTemplateConfig.getId());
periodCellTemplateConfig.setKeyValueParsedFormula(null);
periodCellTemplateConfig.setProjectId(projectId);
fixedParsedFormula(periodCellTemplateConfig);
fixedAccountCode(periodCellTemplateConfig);
cellTemplateConfigList.add(periodCellTemplateConfig);
}
}
} else {
Long cellTemplateId = distributedIdService.nextId();
PeriodCellTemplate cellTemplate = new PeriodCellTemplate();
cellTemplate.setPeriod(period);
cellTemplate.setProjectId(projectId);
cellTemplate.setColumnIndex(c);
cellTemplate.setCreateTime(now);
cellTemplate.setCellTemplateId(cellTemplateId);
cellTemplate.setUpdateTime(now);
cellTemplate.setRowIndex(r);
cellTemplate.setReportTemplateId(template.getId());
cellTemplate.setId(distributedIdService.nextId());
if (cell.getCellComment() != null) {
cellTemplate.setComment(cell.getCellComment().getString().getString());
}
cellTemplate.setIsReadOnly(cell.getCellStyle().getLocked() ? 1 : 0);
cellTemplateList.add(cellTemplate);
//todo: 这里没有Config数据只有在上传模板以后,在界面里面可以配置公式
if (hasKeyIn(cell)) {
cell.setCellValue(StringUtils.EMPTY);
addManualConfig(template.getId(), cell, now, cellTemplateConfigList);
} else if (!cell.getCellStyle().getLocked() && StringUtils.isNotBlank(POIUtil.getCellFormulaString(cell))) {
PeriodCellTemplateConfig periodCellTemplateConfig = new PeriodCellTemplateConfig();
periodCellTemplateConfig.setCellTemplateId(cellTemplateId);
periodCellTemplateConfig.setId(distributedIdService.nextId());
periodCellTemplateConfig.setPeriod(period);
periodCellTemplateConfig.setCellTemplateId(cellTemplateId);
periodCellTemplateConfig.setReportTemplateId(template.getId());
periodCellTemplateConfig.setDataSourceType(1);
periodCellTemplateConfig.setFormula(POIUtil.getCellFormulaString(cell));
periodCellTemplateConfig.setParsedFormula(null);
// periodCellTemplateConfig.setCreateBy(authUserHelper.getCurrentUserId());
periodCellTemplateConfig.setCreateTime(now);
// periodCellTemplateConfig.setUpdateBy(authUserHelper.getCurrentUserId());
periodCellTemplateConfig.setUpdateTime(now);
periodCellTemplateConfig.setFormulaDataSource("报表数据");
periodCellTemplateConfig.setKeyValueParsedFormula(null);
periodCellTemplateConfig.setProjectId(projectId);
fixedParsedFormula(periodCellTemplateConfig);
fixedAccountCode(periodCellTemplateConfig);
cellTemplateConfigList.add(periodCellTemplateConfig);
addManualConfig(template.getId(), cell, now, cellTemplateConfigList);
}
}
}
}
List<List<PeriodCellTemplate>> tmpList = CommonUtils.subListWithLen(cellTemplateList, CommonUtils.BATCH_NUM);
// tmpList.forEach(list -> cellTemplateMapper.batchInsert2(list));
tmpList.forEach(list -> periodCellTemplateMapper.batchInsert(list));//todo 批量插入优化
List<List<PeriodCellTemplateConfig>> tmpConfigList = CommonUtils.subListWithLen(cellTemplateConfigList, CommonUtils.BATCH_NUM);
tmpConfigList.forEach(list -> periodCellTemplateConfigMapper.batchInsert(list));
} catch (Exception e) {
logger.error("importTemplateExcelFile error.", e);
throw new ServiceException(ErrorMessage.SystemError);
}
}
private void addManualConfig(Long templateId, Cell cell, Date now, List<PeriodCellTemplateConfig> list) {
PeriodCellTemplateConfig configManual = new PeriodCellTemplateConfig();
configManual.setId(distributedIdService.nextId());
// configManual.setCellTemplateId(cellTemplate.getId());
configManual.setReportTemplateId(templateId);
configManual.setDataSourceType(CellDataSourceType.KeyIn.getCode());
configManual.setFormula(POIUtil.getCellFormulaString(cell));
// config.setFormula(cell.getCellFormula());
// configManual.setFormulaDataSource("报表数据"); //todo KV相关
configManual.setUpdateTime(now);
// configManual.setUpdateBy(authUserHelper.getCurrentUserId());
list.add(configManual);
}
/**
* 替换占位符
*
* @param cell cell
* @return Boolean
*/
private Boolean hasKeyIn(Cell cell) {
if (null == cell) {
return false;
}
CellType cellType = cell.getCellTypeEnum();
if (!CellType.STRING.equals(cellType)) {
return false;
}
String v = cell.getStringCellValue();
if (StringUtils.isBlank(v)) {
return false;
}
return StringUtils.equals(v, Constant.ReplaceKeyword.KEY_IN);
}
private void fixedAccountCode(PeriodCellTemplateConfig pctc) { private void fixedAccountCode(PeriodCellTemplateConfig pctc) {
if (StringUtils.isNotBlank(pctc.getAccountCodes())) { if (StringUtils.isNotBlank(pctc.getAccountCodes())) {
...@@ -434,7 +619,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -434,7 +619,7 @@ public class ReportServiceImpl extends BaseService {
periodCellTemplateList.add(periodCellTemplate); periodCellTemplateList.add(periodCellTemplate);
} }
CommonUtils.subListWithLen(periodCellTemplateList,CommonUtils.BATCH_NUM).forEach(batch->{ CommonUtils.subListWithLen(periodCellTemplateList, CommonUtils.BATCH_NUM).forEach(batch -> {
periodCellTemplateMapper.batchInsert(batch); periodCellTemplateMapper.batchInsert(batch);
}); });
...@@ -472,21 +657,75 @@ public class ReportServiceImpl extends BaseService { ...@@ -472,21 +657,75 @@ public class ReportServiceImpl extends BaseService {
periodTemplate.setCreateBy(StringUtils.isBlank(template.getCreateBy()) ? "admin" : template.getCreateBy()); periodTemplate.setCreateBy(StringUtils.isBlank(template.getCreateBy()) ? "admin" : template.getCreateBy());
periodTemplate.setUpdateBy(StringUtils.isBlank(template.getUpdateBy()) ? "admin" : template.getUpdateBy()); periodTemplate.setUpdateBy(StringUtils.isBlank(template.getUpdateBy()) ? "admin" : template.getUpdateBy());
periodTemplate.setProjectId(projectId); periodTemplate.setProjectId(projectId);
periodTemplateList.add(periodTemplate); //TODO 当是税金计算表时动态添加行
if ("VAT020".equals(periodTemplate.getCode())) {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
InputStream is = null;
try {
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(Arrays.asList(periodTemplate.getPath()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
Map<String, String> urlMap = null;
is = httpFileService.getUserTemplate(uploadDetail.getList().get(0).getViewHttpUrl());
Workbook tWorkbook = WorkbookFactory.create(is);
tWorkbook = assembleTaxWorkBook(template,tWorkbook,projectId,period);
tWorkbook.write(bout);
FileUpload fileUpload = didiFileUploadService.uploadFile(bout.toByteArray(), template.getCode() + "_" + template.getName() + ".xlsx", FileUploadEnum.BizSource.PERIOD_REPORT_TEMPLATE_UPLOAD.name());
periodTemplate.setPath(fileUpload.getUid());
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
is.close();
bout.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} else {
copyPeriodCellTemplateFromCellTemplate(projectId, template.getId(), period); copyPeriodCellTemplateFromCellTemplate(projectId, template.getId(), period);
copyPeriodConfigFromCellTemplateConfig(projectId, template.getId(), period); copyPeriodConfigFromCellTemplateConfig(projectId, template.getId(), period);
} }
periodTemplateList.add(periodTemplate);
}
periodTemplateMapper.batchInsert(periodTemplateList); periodTemplateMapper.batchInsert(periodTemplateList);
} }
public Workbook assembleTaxWorkBook(Template template, Workbook tWorkbook, String projectId, Integer period) {
Sheet sheet = tWorkbook.getSheetAt(0);
RevenueConfigExample example = new RevenueConfigExample();
List<RevenueConfig> dataList = revenueConfigMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(dataList)) {
int rowIndex = 1;
Row sourceRow = sheet.getRow(3);
for (RevenueConfig config : dataList) {
Row row = POIUtil.createAndCloneRow(tWorkbook, sheet, 1, sourceRow);
row.getCell(TaxesCalculateReportEnum.Column.Column_1.getIndex()).setCellValue("1-" + rowIndex);
row.getCell(TaxesCalculateReportEnum.Column.Column_2.getIndex()).setCellValue("");
row.getCell(TaxesCalculateReportEnum.Column.Column_3.getIndex()).setCellValue(config.getName());
row.getCell(TaxesCalculateReportEnum.Column.Column_4.getIndex()).setCellValue("YYYY-MM");
row.getCell(TaxesCalculateReportEnum.Column.Column_5.getIndex()).setCellValue("");
row.getCell(TaxesCalculateReportEnum.Column.Column_6.getIndex()).setCellValue("");
row.getCell(TaxesCalculateReportEnum.Column.Column_7.getIndex()).setCellValue("");
row.getCell(TaxesCalculateReportEnum.Column.Column_8.getIndex()).setCellValue("BB(\"VAT005\",\"M\",8,0,0)");
row.getCell(TaxesCalculateReportEnum.Column.Column_9.getIndex()).setCellValue(config.getTaxRate().multiply(new BigDecimal(100)).intValue() + "%");
row.getCell(TaxesCalculateReportEnum.Column.Column_10.getIndex()).setCellValue(0);
row.getCell(TaxesCalculateReportEnum.Column.Column_11.getIndex()).setCellValue(RevenueConfEnum.RevenueType.MAPPING.get(config.getRevenueType()));
row.getCell(TaxesCalculateReportEnum.Column.Column_12.getIndex()).setCellValue(RevenueConfEnum.TaxType.MAPPING.get(config.getTaxType()));
rowIndex++;
}
}
assemblePeriodTemplate(template, tWorkbook, projectId, period,dataList.size());
return tWorkbook;
}
public OperationResultDto generateData(String projectId, EnumServiceType serviceType, Boolean isMergeManualData, public OperationResultDto generateData(String projectId, EnumServiceType serviceType, Boolean isMergeManualData,
Integer periodParam, Integer reportType, Optional<String> generator) { Integer periodParam, Integer reportType, Optional<String> generator) {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
MyAsserts.assertEq(serviceType, EnumServiceType.VAT, new NotFoundException()); MyAsserts.assertEq(serviceType, EnumServiceType.VAT, new NotFoundException());
MyAsserts.assertNull(periodJobMapper.getRunningJob(projectId,periodParam), Exceptions.TASK_HAS_BEGINNING); MyAsserts.assertNull(periodJobMapper.getRunningJob(projectId, periodParam), Exceptions.TASK_HAS_BEGINNING);
String status = periodApprovalMapper.getStatusByProjectIdAndPeriod(projectId, periodParam); String status = periodApprovalMapper.getStatusByProjectIdAndPeriod(projectId, periodParam);
MyAsserts.assertTrue(status == null || !status.equals(Constant.APPROVAL_COMMITTED), Exceptions.REPORT_IN_PROCESS_OR_AGREED_EXCEPTION); MyAsserts.assertTrue(status == null || !status.equals(Constant.APPROVAL_COMMITTED), Exceptions.REPORT_IN_PROCESS_OR_AGREED_EXCEPTION);
try { try {
...@@ -495,7 +734,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -495,7 +734,7 @@ public class ReportServiceImpl extends BaseService {
return operationResultDto; return operationResultDto;
} }
List<Template> templates = getTemplatesByProjectId(projectId); List<Template> templates = getTemplatesByProjectId(projectId);
List<String> dataValidateArray= new ArrayList<String>(); List<String> dataValidateArray = new ArrayList<String>();
/*dataValidateArray.add("DA001"); /*dataValidateArray.add("DA001");
dataValidateArray.add("DA002"); dataValidateArray.add("DA002");
dataValidateArray.add("DA003");*/ dataValidateArray.add("DA003");*/
...@@ -509,7 +748,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -509,7 +748,7 @@ public class ReportServiceImpl extends BaseService {
try { try {
updateConfig(projectId, periodParam, isMergeManualData, templates, genJob); updateConfig(projectId, periodParam, isMergeManualData, templates, genJob);
//进行数据校验 //进行数据校验
DataValidation(periodParam, projectId,genJob ); DataValidation(periodParam, projectId, genJob);
PeriodResources resources = reportGenerator.getPeriodResources(projectId, periodParam, PeriodResources resources = reportGenerator.getPeriodResources(projectId, periodParam,
templates.stream().map(Template::getId).collect(Collectors.toList())); templates.stream().map(Template::getId).collect(Collectors.toList()));
...@@ -522,12 +761,12 @@ public class ReportServiceImpl extends BaseService { ...@@ -522,12 +761,12 @@ public class ReportServiceImpl extends BaseService {
evaluator.evaluateAll(); evaluator.evaluateAll();
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob); reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
setStatus(genJob,STATUS_END); setStatus(genJob, STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob); periodJobMapper.updateByPrimaryKey(genJob);
} catch (Exception e) { } catch (Exception e) {
setStatus(genJob, STATUS_ERROR); setStatus(genJob, STATUS_ERROR);
e.printStackTrace(); e.printStackTrace();
genJob.setErrorMsg("Sever error "+e.getClass().getName()); genJob.setErrorMsg("Sever error " + e.getClass().getName());
periodJobMapper.updateByPrimaryKey(genJob); periodJobMapper.updateByPrimaryKey(genJob);
} }
} }
...@@ -541,21 +780,23 @@ public class ReportServiceImpl extends BaseService { ...@@ -541,21 +780,23 @@ public class ReportServiceImpl extends BaseService {
} }
return operationResultDto; return operationResultDto;
} }
@Autowired
@Resource
private TrialBalanceMapper trialBalanceMapper; private TrialBalanceMapper trialBalanceMapper;
@Autowired @Resource
private AdjustmentTableMapper adjustmentTableMapper; private AdjustmentTableMapper adjustmentTableMapper;
@Autowired @Resource
private ProfitLossStatementMapper profitLossStatementMapper; private ProfitLossStatementMapper profitLossStatementMapper;
@Autowired @Resource
private JournalEntryMapper journalEntryMapper; private JournalEntryMapper journalEntryMapper;
@Autowired @Autowired
private DataUtil dataUtil; private DataUtil dataUtil;
/* @Autowired /* @Autowired
private CitJour*/ private CitJour*/
//数据校验 //数据校验
private void DataValidation(Integer periodParam, String projectId, PeriodJob genJob) { private void DataValidation(Integer periodParam, String projectId, PeriodJob genJob) {
setStatus(genJob,"DA004", STATUS_BEGIN); setStatus(genJob, "DA004", STATUS_BEGIN);
//本期余额表 //本期余额表
/* TrialBalanceExample trialBalanceExample = new TrialBalanceExample(); /* TrialBalanceExample trialBalanceExample = new TrialBalanceExample();
...@@ -575,18 +816,18 @@ public class ReportServiceImpl extends BaseService { ...@@ -575,18 +816,18 @@ public class ReportServiceImpl extends BaseService {
Map<String, Object> map1 = new HashedMap(); Map<String, Object> map1 = new HashedMap();
map1.put("projectId", projectId); map1.put("projectId", projectId);
map1.put("period", periodParam); map1.put("period", periodParam);
if((periodParam+"").length() == 1){ if ((periodParam + "").length() == 1) {
map1.put("period", "0"+ periodParam); map1.put("period", "0" + periodParam);
}else{ } else {
map1.put("period", "" + periodParam); map1.put("period", "" + periodParam);
} }
List<AdjustmentTable> adjustmentTables = adjustmentTableMapper.selectBeforeAdjustData(map1); List<AdjustmentTable> adjustmentTables = adjustmentTableMapper.selectBeforeAdjustData(map1);
Map<String, Object> map2 = new HashedMap(); Map<String, Object> map2 = new HashedMap();
map2.put("projectId", projectId); map2.put("projectId", projectId);
if((periodParam+"").length() == 1){ if ((periodParam + "").length() == 1) {
map2.put("period", "0"+ periodParam); map2.put("period", "0" + periodParam);
}else{ } else {
map2.put("period", "" + periodParam); map2.put("period", "" + periodParam);
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
...@@ -596,14 +837,14 @@ public class ReportServiceImpl extends BaseService { ...@@ -596,14 +837,14 @@ public class ReportServiceImpl extends BaseService {
map.put("companyCode", mapProject.get("code")); map.put("companyCode", mapProject.get("code"));
map.put("companyName", mapProject.get("name")); map.put("companyName", mapProject.get("name"));
List<JournalEntry> journalEntries = journalEntryMapper.selectNowAdjustData(map2); List<JournalEntry> journalEntries = journalEntryMapper.selectNowAdjustData(map2);
for(int i =0; i< adjustmentTables.size(); i++){ for (int i = 0; i < adjustmentTables.size(); i++) {
for(int j =0; j< journalEntries.size(); j++){ for (int j = 0; j < journalEntries.size(); j++) {
JournalEntry journalEntry = journalEntries.get(j); JournalEntry journalEntry = journalEntries.get(j);
AdjustmentTable adjustmentTable = adjustmentTables.get(j); AdjustmentTable adjustmentTable = adjustmentTables.get(j);
if(journalEntry.getSegment3().equals(adjustmentTable.getSegment3()) && if (journalEntry.getSegment3().equals(adjustmentTable.getSegment3()) &&
journalEntry.getSegment5().equals(adjustmentTable.getSegment5())&& journalEntry.getSegment5().equals(adjustmentTable.getSegment5()) &&
journalEntry.getSegment6().equals(adjustmentTable.getSegment6()) && journalEntry.getPeriodJrMinDr() != adjustmentTable.getPeriodDrMixCr() ){ journalEntry.getSegment6().equals(adjustmentTable.getSegment6()) && journalEntry.getPeriodJrMinDr() != adjustmentTable.getPeriodDrMixCr()) {
setStatus(genJob,STATUS_ERROR ); setStatus(genJob, STATUS_ERROR);
Constant.ReportDataValidateLog reportDataValidateLog = new Constant.ReportDataValidateLog(journalEntries.get(j).getSegment3(), journalEntries.get(j).getSegment5(), journalEntries.get(j).getSegment6()); Constant.ReportDataValidateLog reportDataValidateLog = new Constant.ReportDataValidateLog(journalEntries.get(j).getSegment3(), journalEntries.get(j).getSegment5(), journalEntries.get(j).getSegment6());
//记录校验结果 //记录校验结果
// //
...@@ -622,10 +863,10 @@ public class ReportServiceImpl extends BaseService { ...@@ -622,10 +863,10 @@ public class ReportServiceImpl extends BaseService {
setStatus(genJob, STATUS_END); setStatus(genJob, STATUS_END);
map.put("validateResult", "success"); map.put("validateResult", "success");
map.put("result", ""); map.put("result", "");
if(journalEntries.size()==0){ if (journalEntries.size() == 0) {
map.put("tmsPeriod", 0); map.put("tmsPeriod", 0);
}else{ } else {
map.put("tmsPeriod", journalEntries.get(0).getTmsPeriod()); map.put("tmsPeriod", journalEntries.get(0).getTmsPeriod());
} }
map.put("organizationId", mapProject.get("organizationId")); map.put("organizationId", mapProject.get("organizationId"));
...@@ -637,16 +878,16 @@ public class ReportServiceImpl extends BaseService { ...@@ -637,16 +878,16 @@ public class ReportServiceImpl extends BaseService {
@Autowired @Autowired
private DataValidateLogMapper dataValidateLogMapper; private DataValidateLogMapper dataValidateLogMapper;
public void insertDataValidateResult(Map map){ public void insertDataValidateResult(Map map) {
DataValidateLog dataValidateLog = new DataValidateLog(); DataValidateLog dataValidateLog = new DataValidateLog();
dataValidateLog.setCreateTime(new Date()); dataValidateLog.setCreateTime(new Date());
dataValidateLog.setPeriod((Integer) map.get("period")); dataValidateLog.setPeriod((Integer) map.get("period"));
dataValidateLog.setProjectId((String)map.get("projectId")); dataValidateLog.setProjectId((String) map.get("projectId"));
dataValidateLog.setValidateResult((String)map.get("validateResult")); dataValidateLog.setValidateResult((String) map.get("validateResult"));
dataValidateLog.setResult((String)map.get("result")); dataValidateLog.setResult((String) map.get("result"));
dataValidateLog.setOrganizationId((String)map.get("organizationId")); dataValidateLog.setOrganizationId((String) map.get("organizationId"));
dataValidateLog.setCompanyCode((String)map.get("companyCode")); dataValidateLog.setCompanyCode((String) map.get("companyCode"));
dataValidateLog.setCompanyName((String)map.get("companyName")); dataValidateLog.setCompanyName((String) map.get("companyName"));
dataValidateLog.setTmsPeriod((Integer) map.get("tmsPeriod")); dataValidateLog.setTmsPeriod((Integer) map.get("tmsPeriod"));
dataValidateLogMapper.insert(dataValidateLog); dataValidateLogMapper.insert(dataValidateLog);
} }
...@@ -777,7 +1018,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -777,7 +1018,7 @@ public class ReportServiceImpl extends BaseService {
dataSourceDto.setDataSourceType(CellDataSourceType.InputInvoice.getCode()); dataSourceDto.setDataSourceType(CellDataSourceType.InputInvoice.getCode());
} else if (a.getType().equals(FormulaDataSourceType.Voucher.getCode())) { } else if (a.getType().equals(FormulaDataSourceType.Voucher.getCode())) {
dataSourceDto.setDataSourceType(CellDataSourceType.Voucher.getCode()); dataSourceDto.setDataSourceType(CellDataSourceType.Voucher.getCode());
} else if(a.getType().equals(FormulaDataSourceType.OutputInvoice.getCode())){ } else if (a.getType().equals(FormulaDataSourceType.OutputInvoice.getCode())) {
dataSourceDto.setDataSourceType(CellDataSourceType.OutputInvoice.getCode()); dataSourceDto.setDataSourceType(CellDataSourceType.OutputInvoice.getCode());
} else { } else {
dataSourceDto.setDataSourceType(0); dataSourceDto.setDataSourceType(0);
...@@ -818,12 +1059,12 @@ public class ReportServiceImpl extends BaseService { ...@@ -818,12 +1059,12 @@ public class ReportServiceImpl extends BaseService {
if (z.getItem2().getItems() != null && !z.getItem2().getItems().isEmpty() && z.getItem2().getItems().get(0).contains("tag")) { if (z.getItem2().getItems() != null && !z.getItem2().getItems().isEmpty() && z.getItem2().getItems().get(0).contains("tag")) {
z.getItem2().getItems().forEach(m -> { z.getItem2().getItems().forEach(m -> {
ReportCellDataSourceDto dto = JSON.parseObject(m, ReportCellDataSourceDto.class); ReportCellDataSourceDto dto = JSON.parseObject(m, ReportCellDataSourceDto.class);
if(dto != null && dto.getReportTemplateId() != null && !Pattern.compile("\\D").matcher(dto.getReportTemplateId()).find()){ if (dto != null && dto.getReportTemplateId() != null && !Pattern.compile("\\D").matcher(dto.getReportTemplateId()).find()) {
PeriodTemplateExample periodTemplateExample1 = new PeriodTemplateExample(); PeriodTemplateExample periodTemplateExample1 = new PeriodTemplateExample();
periodTemplateExample1.createCriteria().andTemplateIdEqualTo(Long.parseLong(dto.getReportTemplateId())) periodTemplateExample1.createCriteria().andTemplateIdEqualTo(Long.parseLong(dto.getReportTemplateId()))
.andPeriodEqualTo(report.getPeriod()); .andPeriodEqualTo(report.getPeriod());
Optional<PeriodTemplate> optional = periodTemplateMapper.selectByExample(periodTemplateExample1).stream().findFirst(); Optional<PeriodTemplate> optional = periodTemplateMapper.selectByExample(periodTemplateExample1).stream().findFirst();
if(optional.isPresent()){ if (optional.isPresent()) {
dto.setReportName(optional.get().getName()); dto.setReportName(optional.get().getName());
} }
} }
...@@ -1017,12 +1258,12 @@ public class ReportServiceImpl extends BaseService { ...@@ -1017,12 +1258,12 @@ public class ReportServiceImpl extends BaseService {
data.setCellId(cellData.getId()); data.setCellId(cellData.getId());
} else { } else {
PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(data.getCellId()); PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(data.getCellId());
if(StringUtils.isNotBlank(data.getKeyinData())){ if (StringUtils.isNotBlank(data.getKeyinData())) {
cellData.setKeyinData(data.getKeyinData()); cellData.setKeyinData(data.getKeyinData());
if (StringUtils.isEmpty(cellData.getFormulaExp())) if (StringUtils.isEmpty(cellData.getFormulaExp()))
cellData.setFormulaExp(data.getKeyinData()); cellData.setFormulaExp(data.getKeyinData());
periodCellDataMapper.updateByPrimaryKeySelective(cellData); periodCellDataMapper.updateByPrimaryKeySelective(cellData);
}else if (data.getAmount() != null && cellData.getData() != data.getAmount().toString()) { } else if (data.getAmount() != null && cellData.getData() != data.getAmount().toString()) {
cellData.setData(data.getAmount().toString()); cellData.setData(data.getAmount().toString());
if (StringUtils.isEmpty(cellData.getFormulaExp())) if (StringUtils.isEmpty(cellData.getFormulaExp()))
cellData.setFormulaExp(data.getAmount().toString()); cellData.setFormulaExp(data.getAmount().toString());
...@@ -1043,7 +1284,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1043,7 +1284,7 @@ public class ReportServiceImpl extends BaseService {
PeriodDataSource dataSourceModel = null; PeriodDataSource dataSourceModel = null;
if (dataSourceExtendDtos.size() > 0) { if (dataSourceExtendDtos.size() > 0) {
dataSourceModel = dataSourceExtendDtos.get(0).getDataSource(); dataSourceModel = dataSourceExtendDtos.get(0).getDataSource();
if(StringUtils.isBlank(data.getKeyinData())) if (StringUtils.isBlank(data.getKeyinData()))
updateCellValueForDataSourceChange(dataSourceModel, data.getAmount()); updateCellValueForDataSourceChange(dataSourceModel, data.getAmount());
originalAmount = dataSourceModel.getAmount() != null ? dataSourceModel.getAmount() : new BigDecimal("0"); originalAmount = dataSourceModel.getAmount() != null ? dataSourceModel.getAmount() : new BigDecimal("0");
dataSourceModel.setName(data.getName()); dataSourceModel.setName(data.getName());
...@@ -1125,7 +1366,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1125,7 +1366,7 @@ public class ReportServiceImpl extends BaseService {
dataSource.setUpdateTime(new Date()); dataSource.setUpdateTime(new Date());
periodDataSourceMapper.updateByPrimaryKeySelective(dataSource); periodDataSourceMapper.updateByPrimaryKeySelective(dataSource);
if (!cellData.getData().equals("#VALUE!")) { if (!cellData.getData().equals("#VALUE!")) {
if(StringUtils.isBlank(cellData.getData())) cellData.setData("0"); if (StringUtils.isBlank(cellData.getData())) cellData.setData("0");
cellData.setData(new BigDecimal(cellData.getData()).add(changeValue).toString()); cellData.setData(new BigDecimal(cellData.getData()).add(changeValue).toString());
} else { } else {
cellData.setData(new BigDecimal("0.0").add(changeValue).toString()); cellData.setData(new BigDecimal("0.0").add(changeValue).toString());
...@@ -1133,7 +1374,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1133,7 +1374,7 @@ public class ReportServiceImpl extends BaseService {
//cellData.setFormulaExp(cellData.getData()); //cellData.setFormulaExp(cellData.getData());
cellData.setUpdateTime(new Date()); cellData.setUpdateTime(new Date());
periodCellDataMapper.updateByPrimaryKeySelective(cellData); periodCellDataMapper.updateByPrimaryKeySelective(cellData);
} else if(dataSource.getDescription().equals(cellName) && StringUtils.isNotBlank(data.getKeyinData())){ } else if (dataSource.getDescription().equals(cellName) && StringUtils.isNotBlank(data.getKeyinData())) {
dataSource.setKeyinData(data.getKeyinData()); dataSource.setKeyinData(data.getKeyinData());
dataSource.setUpdateBy("admin"); dataSource.setUpdateBy("admin");
dataSource.setUpdateTime(new Date()); dataSource.setUpdateTime(new Date());
...@@ -1260,7 +1501,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1260,7 +1501,7 @@ public class ReportServiceImpl extends BaseService {
operationResultDto.setResult(false); operationResultDto.setResult(false);
return operationResultDto; return operationResultDto;
} }
if(StringUtils.isEmpty(datasourceEntity.getKeyinData())) if (StringUtils.isEmpty(datasourceEntity.getKeyinData()))
updateCellValueForDataSourceChange(datasourceEntity, dataSource.getAmount()); updateCellValueForDataSourceChange(datasourceEntity, dataSource.getAmount());
periodDataSourceMapper.updateByPrimaryKeySelective(datasourceEntity); periodDataSourceMapper.updateByPrimaryKeySelective(datasourceEntity);
//todo:MarkProjectModelDirty(dataSource.projectId, dataSource.serviceTypeId, dataSource.Updater); //todo:MarkProjectModelDirty(dataSource.projectId, dataSource.serviceTypeId, dataSource.Updater);
...@@ -1422,23 +1663,23 @@ public class ReportServiceImpl extends BaseService { ...@@ -1422,23 +1663,23 @@ public class ReportServiceImpl extends BaseService {
} }
public OperationResultDto doUploadAttach(MultipartFile file, String remarks){ public OperationResultDto doUploadAttach(MultipartFile file, String remarks) {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
try { try {
FileDto fileDto = new FileDto(); FileDto fileDto = new FileDto();
int i = file.getOriginalFilename().lastIndexOf("."); int i = file.getOriginalFilename().lastIndexOf(".");
fileDto.setFileName(file.getOriginalFilename()); fileDto.setFileName(file.getOriginalFilename());
if(remarks != null){ if (remarks != null) {
fileDto.setRemarks(remarks); fileDto.setRemarks(remarks);
} }
fileDto.setFileUrl(FileUploadUtil.upload(file, true)); fileDto.setFileUrl(FileUploadUtil.upload(file, true));
//绑定 //绑定
fileDto.setSize(String.valueOf(file.getSize()/1024) + "KB"); fileDto.setSize(String.valueOf(file.getSize() / 1024) + "KB");
fileDto.setUploadUser(authUserHelper.getCurrentAuditor().get()); fileDto.setUploadUser(authUserHelper.getCurrentAuditor().get());
fileDto.setCreateTime(new Date()); fileDto.setCreateTime(new Date());
operationResultDto.setData(fileDto); operationResultDto.setData(fileDto);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
operationResultDto.setResultMsg("error"); operationResultDto.setResultMsg("error");
} }
...@@ -1447,6 +1688,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1447,6 +1688,7 @@ public class ReportServiceImpl extends BaseService {
@Autowired @Autowired
private PwcReportAttachMapper pwcReportAttachMapper; private PwcReportAttachMapper pwcReportAttachMapper;
public void bindPwcAttach(Long activeCol, Long activeRow, String activeTemplateId, FileDto file) { public void bindPwcAttach(Long activeCol, Long activeRow, String activeTemplateId, FileDto file) {
PwcReportAttach pwcReportAttach = new PwcReportAttach(); PwcReportAttach pwcReportAttach = new PwcReportAttach();
pwcReportAttach.setCol(activeCol); pwcReportAttach.setCol(activeCol);
...@@ -1477,6 +1719,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1477,6 +1719,7 @@ public class ReportServiceImpl extends BaseService {
/** /**
* 删除附件 * 删除附件
*
* @param id * @param id
* @return * @return
*/ */
...@@ -1485,7 +1728,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1485,7 +1728,7 @@ public class ReportServiceImpl extends BaseService {
OperationResultDto<Object> objectOperationResultDto = new OperationResultDto<>(); OperationResultDto<Object> objectOperationResultDto = new OperationResultDto<>();
example.createCriteria().andIdEqualTo(id); example.createCriteria().andIdEqualTo(id);
int i = pwcReportAttachMapper.deleteByExample(example); int i = pwcReportAttachMapper.deleteByExample(example);
if(i>0){ if (i > 0) {
objectOperationResultDto.setResultMsg("success"); objectOperationResultDto.setResultMsg("success");
} }
return objectOperationResultDto; return objectOperationResultDto;
......
...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.entity; ...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.entity;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* *
...@@ -110,6 +111,8 @@ public class OperationLogTaxDocument implements Serializable { ...@@ -110,6 +111,8 @@ public class OperationLogTaxDocument implements Serializable {
*/ */
private Date createTime; private Date createTime;
List<String> ids;
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database table operation_log_tax_document * This field corresponds to the database table operation_log_tax_document
...@@ -118,6 +121,14 @@ public class OperationLogTaxDocument implements Serializable { ...@@ -118,6 +121,14 @@ public class OperationLogTaxDocument implements Serializable {
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public List<String> getIds() {
return ids;
}
public void setIds(List<String> ids) {
this.ids = ids;
}
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column operation_log_tax_document.id * This method returns the value of the database column operation_log_tax_document.id
......
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
case enums.formulaDataSourceType.InvoiceFilter: case enums.formulaDataSourceType.InvoiceFilter:
break; break;
case enums.formulaDataSourceType.CIT_TBAM: case enums.formulaDataSourceType.CIT_TBAM:
obj.relSql = sourceData.relSql; obj.relSql = sourceData.rel_sql;
} }
if (sourceData.type === 0 && sourceData.dataSourceType === enums.cellDataSourceType.RelatedModel) { if (sourceData.type === 0 && sourceData.dataSourceType === enums.cellDataSourceType.RelatedModel) {
......
...@@ -1536,7 +1536,7 @@ ...@@ -1536,7 +1536,7 @@
} }
, ,
{ {
dataField: 'Attribute', dataField: 'attribute',
caption: $translate.instant('Attribute'), caption: $translate.instant('Attribute'),
alignment: 'left' alignment: 'left'
} }
...@@ -2212,7 +2212,7 @@ ...@@ -2212,7 +2212,7 @@
$scope.detail.dataGridSourceBind = [$scope.detail.dataGridSource[0]]; $scope.detail.dataGridSourceBind = [$scope.detail.dataGridSource[0]];
break; break;
case enums.formulaDataSourceType.CIT_TBAM: case enums.formulaDataSourceType.CIT_TBAM:
$scope.detail.dataGridSourceBind = getBlowGridData($scope.detail.dataGridSource[0]); getBlowGridData($scope.detail.dataGridSource[0]);
break; break;
default : default :
$scope.detail.dataGridSourceBind = $scope.detail.dataGridSource; $scope.detail.dataGridSourceBind = $scope.detail.dataGridSource;
...@@ -2236,7 +2236,7 @@ ...@@ -2236,7 +2236,7 @@
var getBlowGridData = function( data){ var getBlowGridData = function( data){
cellCommentService.getCellInformation(data).success(function (res) { cellCommentService.getCellInformation(data).success(function (res) {
if(res.resultMsg){ if(res.resultMsg){
return res.data; $scope.detail.dataGridSourceBind = [res.data[0]];
} }
}).error(function (error) { }).error(function (error) {
......
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
case enums.formulaDataSourceType.InvoiceFilter: case enums.formulaDataSourceType.InvoiceFilter:
break; break;
case enums.formulaDataSourceType.CIT_TBAM: case enums.formulaDataSourceType.CIT_TBAM:
obj.relSql = sourceData.relSql; obj.relSql = sourceData.rel_sql;
} }
......
...@@ -12,7 +12,7 @@ webservices.factory('cellCommentService', ['$http', 'apiConfig', function ($http ...@@ -12,7 +12,7 @@ webservices.factory('cellCommentService', ['$http', 'apiConfig', function ($http
return $http.post('/CellComment/Delete/' + commentId, {}, apiConfig.createVat()); return $http.post('/CellComment/Delete/' + commentId, {}, apiConfig.createVat());
}, },
getCellInformation: function(data){ getCellInformation: function(data){
return $http.get('/CellComment/getCellInformation?sql=' + data.relSql, apiConfig.vat()); return $http.get('/CellComment/getCellInformation?sql=' + data.relSql, apiConfig.createVat());
} }
}; };
}]); }]);
\ No newline at end of file
...@@ -45,16 +45,19 @@ ...@@ -45,16 +45,19 @@
.select-simulator-option-menu ul li{ .select-simulator-option-menu ul li{
padding:0 8px; padding:0 8px;
list-style: none; list-style: none;
color: #000;
font-size: 13px;
line-height: 1;
} }
.select-simulator-option-menu ul li:hover{ .select-simulator-option-menu ul li:hover{
background-color: #e7e8e0; background-color: #e7e8e0;
} }
.select-simulator-option-menu ul li:nth-child(odd){ .select-simulator-option-menu ul li:nth-child(odd){
background-color: #efefef; background-color: #F2F2F2;;
} }
.select-simulator-option-menu ul li > label{ .select-simulator-option-menu ul li > label{
padding-bottom:5px;
margin:0; margin:0;
padding: 8px 0;
} }
.input-reset-button { .input-reset-button {
...@@ -93,6 +96,13 @@ ...@@ -93,6 +96,13 @@
position: relative; position: relative;
background: inherit; background: inherit;
} }
.select-simulator-option-name{
float:left;
}
.select-simulator-option-check-icon{
float:right;
color:#0db4ff;
}
</style> </style>
<div class="select-simulator"> <div class="select-simulator">
<input class="for-fake-input" <input class="for-fake-input"
...@@ -120,10 +130,11 @@ ...@@ -120,10 +130,11 @@
<label style="width: 100%;" ng-click="checksOption()"> <label style="width: 100%;" ng-click="checksOption()">
<input type="{{optionType}}" <input type="{{optionType}}"
name="simulatorOptionMenu" name="simulatorOptionMenu"
value="{{value}}" value="{{value}}" ng-hide="true"
ng-checked="selected.indexOf(optionValues[$index]) > -1" ng-checked="selected.indexOf(optionValues[$index]) > -1"
data-key="{{optionKeys[$index]}}"/> data-key="{{optionKeys[$index]}}"/>
<span>{{value}}</span> <span class="select-simulator-option-name">{{value}}</span>
<i ng-if="selected.indexOf(optionValues[$index]) > -1" class="fa fa-check select-simulator-option-check-icon"></i>
</label> </label>
</li> </li>
</ul> </ul>
......
...@@ -11,9 +11,9 @@ frameworkModule.controller('appUsrOperateLogController', ...@@ -11,9 +11,9 @@ frameworkModule.controller('appUsrOperateLogController',
$scope.loadMainData = function () { $scope.loadMainData = function () {
$scope.thisModuleId = $scope.thisModuleId ? $scope.thisModuleId : []; $scope.thisModuleId = $scope.thisModuleId ? $scope.thisModuleId : [];
var config = { var config = {
params: { // params: {
taxDocumentIds:JSON.stringify($scope.thisModuleId) "ids":$scope.thisModuleId
} // }
}; };
usrOperateLogService[$scope.thisModuleName](config).then(function (data) { usrOperateLogService[$scope.thisModuleName](config).then(function (data) {
if (status === 204) { if (status === 204) {
......
...@@ -10,7 +10,7 @@ function ($q, apiConfig, jqFetch,apiInterceptor) { ...@@ -10,7 +10,7 @@ function ($q, apiConfig, jqFetch,apiInterceptor) {
return jqFetch.get(apiInterceptor.webApiHostUrl + '/operLogFileTypes/selectList', params); return jqFetch.get(apiInterceptor.webApiHostUrl + '/operLogFileTypes/selectList', params);
}, },
docManageListLog: function (params) { docManageListLog: function (params) {
return jqFetch.get(apiInterceptor.webApiHostUrl + '/operLogTaxDoc/selectListForLog', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/operLogTaxDoc/selectListForLog', params);
} }
}; };
}]); }]);
\ No newline at end of file
...@@ -9,15 +9,6 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -9,15 +9,6 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.queryFieldModel = {}; $scope.queryFieldModel = {};
$scope.editFieldModel = {}; $scope.editFieldModel = {};
$scope.resetQueryField = function () {
$scope.queryFieldModel = {};
$("#period-picker1").val("");
$("#period-picker2").val("");
$("#period-picker3").val("");
$("#period-picker4").val("");
};
$scope.pagingOptions = {}; $scope.pagingOptions = {};
$scope.localData = null; $scope.localData = null;
$scope.loadMainData = function () { $scope.loadMainData = function () {
...@@ -31,28 +22,30 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -31,28 +22,30 @@ taxDocumentManageModule.controller('taxDocumentListController',
params.ownTime = params.ownTime ? params.ownTime : ""; params.ownTime = params.ownTime ? params.ownTime : "";
var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/"; var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/";
params.ownTime = parseInt(params.ownTime.split(splitMark).join("")); params.ownTime = parseInt(params.ownTime.split(splitMark).join(""));
// if($scope.queryOwnTime)params.ownTime = $scope.queryOwnTime(params.ownTime,"int");
params.fileBeginTime ? params.fileBeginTime += "-01" : ""; params.fileBeginTime ? params.fileBeginTime += "-01" : "";
if(params.fileEndTTime){ if (params.fileEndTTime) {
var fileEndTTimeDate = $scope.getMonthLastDate(params.fileEndTTime.split("-")[0],params.fileEndTTime.split("-")[1]); var fileEndTTimeDate = $scope.getMonthLastDate(params.fileEndTTime.split("-")[0], params.fileEndTTime.split("-")[1]);
params.fileEndTTime += "-" + fileEndTTimeDate; params.fileEndTTime += "-" + fileEndTTimeDate;
} }
params.ownBeginTime ? params.ownBeginTime += "-01" : ""; params.ownBeginTime ? params.ownBeginTime += "-01" : "";
if(params.ownEndTime){ if (params.ownEndTime) {
var ownEndTimeDate = $scope.getMonthLastDate(params.ownEndTime.split("-")[0],params.ownEndTime.split("-")[1]); var ownEndTimeDate = $scope.getMonthLastDate(params.ownEndTime.split("-")[0], params.ownEndTime.split("-")[1]);
params.ownEndTime += "-" + ownEndTimeDate; params.ownEndTime += "-" + ownEndTimeDate;
} }
params.effectiveBeginTime ? params.effectiveBeginTime += "-01" : ""; params.effectiveBeginTime ? params.effectiveBeginTime += "-01" : "";
if(params.effectiveEndTime){ if (params.effectiveEndTime) {
var effectiveEndTimeDate = $scope.getMonthLastDate(params.effectiveEndTime.split("-")[0],params.effectiveEndTime.split("-")[1]); var effectiveEndTimeDate = $scope.getMonthLastDate(params.effectiveEndTime.split("-")[0], params.effectiveEndTime.split("-")[1]);
params.effectiveEndTime += "-" + effectiveEndTimeDate; params.effectiveEndTime += "-" + effectiveEndTimeDate;
} }
params.uploadBeginTime ? params.uploadBeginTime += "-01" : ""; params.uploadBeginTime ? params.uploadBeginTime += "-01" : "";
if(params.uploadEndTime){ if (params.uploadEndTime) {
var uploadEndTimeDate = $scope.getMonthLastDate(params.uploadEndTime.split("-")[0],params.uploadEndTime.split("-")[1]); var uploadEndTimeDate = $scope.getMonthLastDate(params.uploadEndTime.split("-")[0], params.uploadEndTime.split("-")[1]);
params.uploadEndTime += "-" + uploadEndTimeDate; params.uploadEndTime += "-" + uploadEndTimeDate;
} }
...@@ -170,10 +163,10 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -170,10 +163,10 @@ taxDocumentManageModule.controller('taxDocumentListController',
try { try {
if (options.data.ownTime) { if (options.data.ownTime) {
// 这是所属时间返回的是int类型 // 这是所属时间返回的是int类型
var ownTimeString = options.data.ownTime + ""; // var ownTimeString = options.data.ownTime + "";
var year = ownTimeString.substr(0, 4); // var year = ownTimeString.substr(0, 4);
var mon = ownTimeString.substr(4, 2); // var mon = ownTimeString.substr(4, 2);
$('<span>').text(year + "/" + mon).appendTo(container); $('<span>').text($scope.queryOwnTime(options.data.ownTime, "/")).appendTo(container);
} else { } else {
$('<span>').text('').appendTo(container); $('<span>').text('').appendTo(container);
} }
...@@ -263,12 +256,12 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -263,12 +256,12 @@ taxDocumentManageModule.controller('taxDocumentListController',
// var eventTarget = $(prevTargetString + editTargetString); // var eventTarget = $(prevTargetString + editTargetString);
// $compile(eventTarget)($scope); // $compile(eventTarget)($scope);
// container.append(eventTarget); // container.append(eventTarget);
var prevTarget = $('<a style="color:#506bf7;margin-right:1rem;" href="javascript:void(0)"><span>'+$translate.instant('Preview')+'</span></a>'); var prevTarget = $('<a style="color:#506bf7;margin-right:1rem;" href="javascript:void(0)"><span>' + $translate.instant('Preview') + '</span></a>');
prevTarget.off('click').on('click',function(){ prevTarget.off('click').on('click', function () {
$scope.viewRemoteFile(options.data.fileName,options.data.filePositionUrl); $scope.viewRemoteFile(options.data.fileName, options.data.filePositionUrl);
}); });
var editTarget = $('<a style="color:#506bf7;" href="javascript:void(0)"><span>'+$translate.instant('Edit')+'</span></a>'); var editTarget = $('<a style="color:#506bf7;" href="javascript:void(0)"><span>' + $translate.instant('Edit') + '</span></a>');
editTarget.off('click').on('click',function(){ editTarget.off('click').on('click', function () {
$scope.openSimpleUploadPop(options.data.id); $scope.openSimpleUploadPop(options.data.id);
}); });
...@@ -292,12 +285,14 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -292,12 +285,14 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.localData.forEach(function (item) { $scope.localData.forEach(function (item) {
if (item.id == rowId) { if (item.id == rowId) {
$scope.editFieldModel = angular.copy(item); $scope.editFieldModel = angular.copy(item);
var ownTimeString = item.ownTime + ""; // var ownTimeString = item.ownTime + "";
var year = ownTimeString.substr(0, 4); // var year = ownTimeString.substr(0, 4);
var mon = ownTimeString.substr(4, 2); // var mon = ownTimeString.substr(4, 2);
$scope.editFieldModel.ownTime = year + "/" + mon; // $scope.editFieldModel.ownTime = year + "/" + mon;
$scope.editFieldModel.fileTime = $scope.queryDate(item.fileTime,"/");
$scope.editFieldModel.effectiveTime = $scope.queryDate(item.effectiveTime,"/"); $scope.editFieldModel.ownTime = $scope.queryOwnTime(item.ownTime, "/");
$scope.editFieldModel.fileTime = $scope.queryDate(item.fileTime, "/");
$scope.editFieldModel.effectiveTime = $scope.queryDate(item.effectiveTime, "/");
$scope.syncFileType($scope.editFieldModel.fileAttr); $scope.syncFileType($scope.editFieldModel.fileAttr);
$scope.matchFieldTypeId($scope.editFieldModel); $scope.matchFieldTypeId($scope.editFieldModel);
} }
...@@ -318,11 +313,13 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -318,11 +313,13 @@ taxDocumentManageModule.controller('taxDocumentListController',
var simpleUploadSubmit = function () { var simpleUploadSubmit = function () {
var params = angular.copy($scope.editFieldModel); var params = angular.copy($scope.editFieldModel);
params.ownTime = params.ownTime ? params.ownTime : ""; // params.ownTime = params.ownTime ? params.ownTime : "";
var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/"; // var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/";
params.ownTime = parseInt(params.ownTime.split(splitMark).join("")); // params.ownTime = parseInt(params.ownTime.split(splitMark).join(""));
params.fileTime = $scope.queryDate(params.fileTime,"-"); params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
params.effectiveTime = $scope.queryDate(params.effectiveTime,"-"); params.fileTime = $scope.queryDate(params.fileTime, "-");
params.effectiveTime = $scope.queryDate(params.effectiveTime, "-");
params.filePositionUrl = encodeURIComponent(params.filePositionUrl);
taxDocumentListService.verifyDuplicate(params).then(function (data) { taxDocumentListService.verifyDuplicate(params).then(function (data) {
// 先设置上传参数 // 先设置上传参数
...@@ -335,14 +332,14 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -335,14 +332,14 @@ taxDocumentManageModule.controller('taxDocumentListController',
var fields = {}; var fields = {};
var curItemValue = $scope.editFieldModel[key] ? $scope.editFieldModel[key] : ""; var curItemValue = $scope.editFieldModel[key] ? $scope.editFieldModel[key] : "";
if (/ownTime/.test(key)) { if (/ownTime/.test(key)) {
// var splitMark = curItemValue.indexOf("-") > -1 ? "-" : "/";
// fields[key] = parseInt(curItemValue.split(splitMark).join(""));
fields[key] = $scope.queryOwnTime(curItemValue, "int");
} else {
var splitMark = curItemValue.indexOf("-") > -1 ? "-" : "/"; if (/(createTime|updateTime|uploadTime)/.test(key)) {
fields[key] = parseInt(curItemValue.split(splitMark).join("")); fields[key] = $scope.queryDate(curItemValue, "/");
}else{ } else fields[key] = curItemValue;
if(/(createTime|updateTime|uploadTime)/.test(key)){
fields[key] = $scope.queryDate(fields[key],"/");
}else fields[key] = curItemValue;
} }
uploadItem.formData.push(fields); uploadItem.formData.push(fields);
...@@ -382,9 +379,10 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -382,9 +379,10 @@ taxDocumentManageModule.controller('taxDocumentListController',
var addLogicAfterUploadFile = function (editFieldModel, type) { var addLogicAfterUploadFile = function (editFieldModel, type) {
var params = angular.copy(editFieldModel); var params = angular.copy(editFieldModel);
params.ownTime = params.ownTime ? params.ownTime : ""; // params.ownTime = params.ownTime ? params.ownTime : "";
var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/"; // var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/";
params.ownTime = parseInt(params.ownTime.split(splitMark).join("")); // params.ownTime = parseInt(params.ownTime.split(splitMark).join(""));
params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
taxDocumentListService.addNewRecord(params).then(function (data) { taxDocumentListService.addNewRecord(params).then(function (data) {
if (data == true) { if (data == true) {
if (type == 'simp') { if (type == 'simp') {
...@@ -421,15 +419,16 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -421,15 +419,16 @@ taxDocumentManageModule.controller('taxDocumentListController',
var editDocFileRecord = function (fieldModel, type) { var editDocFileRecord = function (fieldModel, type) {
var params = angular.copy(fieldModel); var params = angular.copy(fieldModel);
params.ownTime = params.ownTime ? params.ownTime : ""; // params.ownTime = params.ownTime ? params.ownTime : "";
var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/"; // var splitMark = params.ownTime.indexOf("-") > -1 ? "-" : "/";
params.ownTime = parseInt(params.ownTime.split(splitMark).join("")); // params.ownTime = parseInt(params.ownTime.split(splitMark).join(""));
params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
params.effectiveTime = $scope.queryDate(params.effectiveTime,"/"); params.effectiveTime = $scope.queryDate(params.effectiveTime, "/");
params.fileTime = $scope.queryDate(params.fileTime,"/"); params.fileTime = $scope.queryDate(params.fileTime, "/");
params.createTime = $scope.queryDate(params.createTime,"/"); params.createTime = $scope.queryDate(params.createTime, "/");
params.updateTime = $scope.queryDate(params.updateTime,"/"); params.updateTime = $scope.queryDate(params.updateTime, "/");
params.uploadTime = $scope.queryDate(params.uploadTime,"/"); params.uploadTime = $scope.queryDate(params.uploadTime, "/");
params.filePositionUrl = encodeURIComponent(params.filePositionUrl);
taxDocumentListService.editRecord(params).then(function (data) { taxDocumentListService.editRecord(params).then(function (data) {
if (data == true) { if (data == true) {
if (type == 'simple') { if (type == 'simple') {
...@@ -469,16 +468,18 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -469,16 +468,18 @@ taxDocumentManageModule.controller('taxDocumentListController',
}; };
var delRecord = function () { var delRecord = function () {
var delItems = {}; var delIDs = [];
delItems.ids = []; // delItems.ids = [];
$("input[name='dataGridCheckBox']").each(function (index, tdCell) { $("input[name='dataGridCheckBox']").each(function (index, tdCell) {
if (tdCell.checked) { if (tdCell.checked) {
var cellId = $(tdCell).attr('data-id'); var cellId = $(tdCell).attr('data-id');
delItems.ids.push(cellId); delIDs.push(cellId);
} }
}); });
taxDocumentListService.delFileRecordItems(delItems).then(function (data) { taxDocumentListService.delFileRecordItems({
"ids":delIDs
}).then(function (data) {
if (data) { if (data) {
SweetAlert.swal({ SweetAlert.swal({
title: $translate.instant("Deleted"), title: $translate.instant("Deleted"),
...@@ -493,37 +494,6 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -493,37 +494,6 @@ taxDocumentManageModule.controller('taxDocumentListController',
}); });
}; };
var downloadAttachment = function () {
var checkedURLs = [
// 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=',
// 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=',
// 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=',
// 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=',
];
$("input[name='dataGridCheckBox']").each(function (index, item) {
if (item.checked) {
var cellUrl = $(item).attr("data-url");
checkedURLs.push(cellUrl);
}
});
if (!checkedURLs.length) return SweetAlert.warning($translate.instant("NeedChecked"));
var triggerDelay = 100;
var removeDelay = 1000;
checkedURLs.forEach(function (item, index) {
_createIFrame(item, index * triggerDelay, removeDelay);
});
function _createIFrame(url, _triggerDelay, _removeDelay) {
setTimeout(function () {
var frame = $('<iframe style="display: none;" class="multi-download"></iframe>');
frame.attr('src', url);
document.body.appendChild(frame[0]);
setTimeout(function () {
frame.remove();
}, _removeDelay);
}, _triggerDelay);
}
};
$scope.loadSelectMap = function () { $scope.loadSelectMap = function () {
taxDocumentListService.getFileInfoOptions().then(function (data) { taxDocumentListService.getFileInfoOptions().then(function (data) {
// console.log(data); // console.log(data);
...@@ -550,6 +520,12 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -550,6 +520,12 @@ taxDocumentManageModule.controller('taxDocumentListController',
}); });
}; };
$scope.businessLineOptions = [];
$scope.loadBusinessList = function(){
taxDocumentListService.getBusinessList().then(function(resData){
$scope.businessLineOptions = resData;
});
};
(function initialize() { (function initialize() {
$scope.typeAndAttrMap = {}; $scope.typeAndAttrMap = {};
$scope.fileTypeOptions = {}; $scope.fileTypeOptions = {};
...@@ -562,10 +538,10 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -562,10 +538,10 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.multiUploader = {}; $scope.multiUploader = {};
$scope.loadMainData(); $scope.loadMainData();
$scope.loadSelectMap(); $scope.loadSelectMap();
$scope.loadBusinessList();
//注册方法 //注册方法
$scope.openSimpleUploadPop = openSimpleUploadPop; $scope.openSimpleUploadPop = openSimpleUploadPop;
$scope.delRecord = delRecord; $scope.delRecord = delRecord;
$scope.downloadAttachment = downloadAttachment;
$scope.addLogicAfterUploadFile = addLogicAfterUploadFile; $scope.addLogicAfterUploadFile = addLogicAfterUploadFile;
$scope.simpleUploadSubmit = simpleUploadSubmit; $scope.simpleUploadSubmit = simpleUploadSubmit;
$scope.coverDocFileRecord = editDocFileRecord; $scope.coverDocFileRecord = editDocFileRecord;
...@@ -589,8 +565,8 @@ taxDocumentManageModule.directive('dateTimePicker', function () { ...@@ -589,8 +565,8 @@ taxDocumentManageModule.directive('dateTimePicker', function () {
$element.datepicker({ $element.datepicker({
startDate: new Date(year - 20, 1, 1), startDate: new Date(year - 20, 1, 1),
endDate: new Date(year + 20, 1, 1), endDate: new Date(year + 20, 1, 1),
viewMode: $attrs["viewMode"] ? parseInt($attrs["viewMode"]):0, viewMode: $attrs["viewMode"] ? parseInt($attrs["viewMode"]) : 0,
minViewMode: $attrs["minViewMode"] ? parseInt($attrs["minViewMode"]):0, minViewMode: $attrs["minViewMode"] ? parseInt($attrs["minViewMode"]) : 0,
autoclose: true, autoclose: true,
language: region, language: region,
todayBtn: true, todayBtn: true,
...@@ -655,8 +631,8 @@ taxDocumentManageModule.directive('dateTimePicker', function () { ...@@ -655,8 +631,8 @@ taxDocumentManageModule.directive('dateTimePicker', function () {
taxDocumentManageModule.directive('fileUploader', function () { taxDocumentManageModule.directive('fileUploader', function () {
return { return {
restrict: "EA", restrict: "EA",
controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert','$compile', controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert', '$compile',
function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert,$compile) { function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert, $compile) {
$scope.uploadFile = function () { $scope.uploadFile = function () {
$("#uploadFilePlugin").click(); $("#uploadFilePlugin").click();
}; };
...@@ -669,19 +645,19 @@ taxDocumentManageModule.directive('fileUploader', function () { ...@@ -669,19 +645,19 @@ taxDocumentManageModule.directive('fileUploader', function () {
$scope.uploader.filters.push({//xls限制 $scope.uploader.filters.push({//xls限制
name: 'fileTypeFilter', name: 'fileTypeFilter',
fn: function (item, options) { fn: function (item, options) {
if(item.name.indexOf("_") === -1) { // if(item.name.indexOf("_") === -1) {
SweetAlert.warning("文件名格式不符合规则,请重新选择(正确格式必须包含'公司名称'和'档案类型',并用下划线'_'分隔)"); // SweetAlert.warning("文件名格式不符合规则,请重新选择(正确格式必须包含'公司名称'和'档案类型',并用下划线'_'分隔)");
return false; // return false;
} // }
var fileNativePath = $("#uploadFilePlugin")[0].value || ""; var fileNativePath = $("#uploadFilePlugin")[0].value || "";
fileNativePath = fileNativePath.replace(/fakepath/img,"******"); fileNativePath = fileNativePath.replace(/fakepath/img, "******");
var splitMark = /\//.test(fileNativePath) ? "/" : "\\"; var splitMark = /\//.test(fileNativePath) ? "/" : "\\";
var prevPath = fileNativePath.split(splitMark); var prevPath = fileNativePath.split(splitMark);
prevPath.pop(); prevPath.pop();
fileNativePath = prevPath.join(splitMark) + splitMark; fileNativePath = prevPath.join(splitMark) + splitMark;
$scope.editFieldModel.fileNativePath = fileNativePath; $scope.editFieldModel.fileNativePath = fileNativePath;
$scope.editFieldModel.fileName = item.name; $scope.editFieldModel.fileName = item.name;
$scope.autoMatchAttrAndType(item.name,$scope.editFieldModel); $scope.autoMatchAttrAndType(item.name, $scope.editFieldModel);
return true; return true;
} }
}); });
...@@ -721,7 +697,7 @@ taxDocumentManageModule.directive('fileUploader', function () { ...@@ -721,7 +697,7 @@ taxDocumentManageModule.directive('fileUploader', function () {
taxDocumentManageModule.directive('multiFileUploader', function () { taxDocumentManageModule.directive('multiFileUploader', function () {
return { return {
restrict: "EA", restrict: "EA",
controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert','$compile', controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert', '$compile',
function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert, $compile) { function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert, $compile) {
var timer = null; var timer = null;
$scope.activeTab = function (activeIndex) { $scope.activeTab = function (activeIndex) {
...@@ -760,12 +736,12 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -760,12 +736,12 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$scope.multiUploader.filters.push({//xls限制 $scope.multiUploader.filters.push({//xls限制
name: 'fileTypeFilter', name: 'fileTypeFilter',
fn: function (item, options) { fn: function (item, options) {
if(item.name.indexOf("_") === -1) { if (item.name.indexOf("_") === -1) {
SweetAlert.warning("文件名格式不符合规则,请重新选择(正确格式必须包含'公司名称''档案类型',并用下划线'_'分隔)"); SweetAlert.warning("文件名格式不符合规则,请重新选择(正确格式必须包含'公司名称''档案类型',并用下划线'_'分隔)");
return false; return false;
} }
var fileNativePath = $("#multiUploadFilePlugin")[0].value || ""; var fileNativePath = $("#multiUploadFilePlugin")[0].value || "";
fileNativePath = fileNativePath.replace(/fakepath/img,"******"); fileNativePath = fileNativePath.replace(/fakepath/img, "******");
var splitMark = /\//.test(fileNativePath) ? "/" : "\\"; var splitMark = /\//.test(fileNativePath) ? "/" : "\\";
var prevPath = fileNativePath.split(splitMark); var prevPath = fileNativePath.split(splitMark);
prevPath.pop(); prevPath.pop();
...@@ -776,7 +752,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -776,7 +752,7 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
iShow: $scope.editFieldModel_multi.length == 0 iShow: $scope.editFieldModel_multi.length == 0
}; };
$scope.editFieldModel_multi.push(thisModel); $scope.editFieldModel_multi.push(thisModel);
$scope.autoMatchAttrAndType(item.name,thisModel); $scope.autoMatchAttrAndType(item.name, thisModel);
// 根据需求,改为不做类型限制 // 根据需求,改为不做类型限制
return true; return true;
} }
...@@ -824,12 +800,14 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -824,12 +800,14 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
var fields = {}; var fields = {};
var curItemValue = editFieldModel[key] ? editFieldModel[key] : ""; var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
if (/ownTime/.test(key)) { if (/ownTime/.test(key)) {
var splitMark = curItemValue.indexOf("-") > -1 ? "-" : "/"; // var splitMark = curItemValue.indexOf("-") > -1 ? "-" : "/";
fields[key] = parseInt(curItemValue.split(splitMark).join("")); // fields[key] = parseInt(curItemValue.split(splitMark).join(""));
}else {
if(/(createTime|updateTime|uploadTime)/.test(key)){ fields[key] = $scope.queryOwnTime(curItemValue, "int");
fields[key] = $scope.queryDate(fields[key],"/"); } else {
}else fields[key] = curItemValue; if (/(createTime|updateTime|uploadTime)/.test(key)) {
fields[key] = $scope.queryDate(curItemValue, "/");
} else fields[key] = curItemValue;
} }
fileItem.formData.push(fields); fileItem.formData.push(fields);
}); });
...@@ -838,15 +816,16 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -838,15 +816,16 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) { (function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
var params = angular.copy(_editFieldModel); var params = angular.copy(_editFieldModel);
params.ownTime = params.ownTime ? params.ownTime : ""; // params.ownTime = params.ownTime ? params.ownTime : "";
params.ownTime = parseInt(_editFieldModel.ownTime.split("-").join("")); // params.ownTime = parseInt(_editFieldModel.ownTime.split("-").join(""));
params.fileTime = $scope.queryDate(params.fileTime,"-"); params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
params.effectiveTime = $scope.queryDate(params.effectiveTime,"-"); params.fileTime = $scope.queryDate(params.fileTime, "-");
params.effectiveTime = $scope.queryDate(params.effectiveTime, "-");
_taxDocumentListService.verifyDuplicate(params).then(function (data) { _taxDocumentListService.verifyDuplicate(params).then(function (data) {
if (data == true) { if (data == true) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add"; _fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/add";
} else { } else {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/edit"; _fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/edit";
} }
_multiUploader.uploadItem(_i); _multiUploader.uploadItem(_i);
}); });
...@@ -932,7 +911,7 @@ taxDocumentManageModule.directive('filePreview', function () { ...@@ -932,7 +911,7 @@ taxDocumentManageModule.directive('filePreview', function () {
function renderXLS(resData) { function renderXLS(resData) {
try { try {
if(!resData || !resData.length) return SweetAlert.warning("Empty File"); if (!resData || !resData.length) return SweetAlert.warning("Empty File");
var _resData = JSON.parse(resData); var _resData = JSON.parse(resData);
sheetSumPages = _resData.length; sheetSumPages = _resData.length;
var curSheet = _resData[sheetCurPageIndex]; var curSheet = _resData[sheetCurPageIndex];
...@@ -1133,8 +1112,8 @@ taxDocumentManageModule.directive('pdfPreview', function () { ...@@ -1133,8 +1112,8 @@ taxDocumentManageModule.directive('pdfPreview', function () {
taxDocumentManageModule.directive('helpPop', function () { taxDocumentManageModule.directive('helpPop', function () {
return { return {
restrict: 'EA', restrict: 'EA',
controller: ['$scope', 'taxDocumentListService', '$translate', '$compile', controller: ['$scope', 'taxDocumentListService', '$translate', '$compile','SweetAlert',
function ($scope, taxDocumentListService, $translate, $compile) { function ($scope, taxDocumentListService, $translate, $compile,SweetAlert) {
$scope.openHelpPop = function () { $scope.openHelpPop = function () {
$scope.help_loadData(); $scope.help_loadData();
}; };
...@@ -1191,7 +1170,9 @@ taxDocumentManageModule.directive('helpPop', function () { ...@@ -1191,7 +1170,9 @@ taxDocumentManageModule.directive('helpPop', function () {
], ],
}; };
}; };
$scope.openHelpPopForEntityStorage = function () {
window.swal($translate.instant('EntityStorageDescription'));
}
}] }]
} }
}); });
...@@ -1223,10 +1204,10 @@ taxDocumentManageModule.directive('watchGroup', function () { ...@@ -1223,10 +1204,10 @@ taxDocumentManageModule.directive('watchGroup', function () {
// 3,文档属性 // 3,文档属性
// 4,文档类型 // 4,文档类型
// 5,文档类型ID // 5,文档类型ID
$scope.autoMatchAttrAndType = function (fileName,fieldModel) { $scope.autoMatchAttrAndType = function (fileName, fieldModel) {
fileName = fileName ? fileName : ""; fileName = fileName ? fileName : "";
var fieldsAttrs = fileName.split("_"); var fieldsAttrs = fileName.split("_");
fieldModel.companyName = fieldsAttrs[0]; fieldModel.fileName = fieldsAttrs[0];
fieldModel.fileType = fieldsAttrs[1]; fieldModel.fileType = fieldsAttrs[1];
// 根据Type来匹配Attr; // 根据Type来匹配Attr;
...@@ -1241,10 +1222,10 @@ taxDocumentManageModule.directive('watchGroup', function () { ...@@ -1241,10 +1222,10 @@ taxDocumentManageModule.directive('watchGroup', function () {
}; };
// 选了类型之后,就自动匹配必填字段 // 选了类型之后,就自动匹配必填字段
$scope.syncRequiredFields = function(fieldModel){ $scope.syncRequiredFields = function (fieldModel) {
$scope.FileAttrAndTypeCache.forEach(function (FATItem) { $scope.FileAttrAndTypeCache.forEach(function (FATItem) {
if(FATItem.fileType === fieldModel.fileType if (FATItem.fileType === fieldModel.fileType
&& FATItem.fileAttr === fieldModel.fileAttr){ && FATItem.fileAttr === fieldModel.fileAttr) {
$scope.requiredField = FATItem.requiredField; $scope.requiredField = FATItem.requiredField;
} }
}); });
...@@ -1253,24 +1234,24 @@ taxDocumentManageModule.directive('watchGroup', function () { ...@@ -1253,24 +1234,24 @@ taxDocumentManageModule.directive('watchGroup', function () {
$scope.matchFieldTypeId(fieldModel); $scope.matchFieldTypeId(fieldModel);
}; };
$scope.isRequired = function(IT8nField){ $scope.isRequired = function (IT8nField) {
return $scope.requiredField.indexOf($translate.instant(IT8nField)) > -1; return $scope.requiredField.indexOf($translate.instant(IT8nField)) > -1;
}; };
$scope.matchFieldTypeId = function(fieldModel){ $scope.matchFieldTypeId = function (fieldModel) {
// 根据Type来匹配TypeId; // 根据Type来匹配TypeId;
$scope.FileAttrAndTypeCache.forEach(function (FATItem) { $scope.FileAttrAndTypeCache.forEach(function (FATItem) {
if(FATItem.fileType === fieldModel.fileType if (FATItem.fileType === fieldModel.fileType
&& FATItem.fileAttr === fieldModel.fileAttr){ && FATItem.fileAttr === fieldModel.fileAttr) {
fieldModel.fileTypeId = FATItem.id; fieldModel.fileTypeId = FATItem.id;
} }
}); });
}; };
// 选了公司之后,就自动匹配公司ID // 选了公司之后,就自动匹配公司ID
$scope.matchCompanyId = function(fieldModel){ $scope.matchCompanyId = function (fieldModel) {
Object.keys($scope.companyNameOptionsMap).forEach(function (key) { Object.keys($scope.companyNameOptionsMap).forEach(function (key) {
if($scope.companyNameOptionsMap[key] === fieldModel.companyName){ if ($scope.companyNameOptionsMap[key] === fieldModel.companyName) {
fieldModel.companyId = key; fieldModel.companyId = key;
} }
}) })
...@@ -1283,15 +1264,13 @@ taxDocumentManageModule.directive('watchGroup', function () { ...@@ -1283,15 +1264,13 @@ taxDocumentManageModule.directive('watchGroup', function () {
taxDocumentManageModule.directive('tempModule', function () { taxDocumentManageModule.directive('tempModule', function () {
return { return {
restrict: 'EA', restrict: 'EA',
controller: ['$scope','taxDocumentListService','$translate', controller: ['$scope', 'taxDocumentListService', '$translate',
function ($scope,taxDocumentListService,$translate) { function ($scope, taxDocumentListService, $translate) {
//税种 //税种
$scope.taxTypeSelects = ["纳税申报表","税票"]; $scope.taxTypeSelects = ["纳税申报表", "税票"];
// updateTime: null
// uploadTime: "2019-03-13T12:05:03.000+08:00"
$scope.queryDate = function(time,mark){ $scope.queryDate = function (time, mark) {
if(!time) return ""; if (!time) return "";
var theDate = new Date(time); var theDate = new Date(time);
var year = theDate.getFullYear(); var year = theDate.getFullYear();
var mm = theDate.getMonth() + 1; var mm = theDate.getMonth() + 1;
...@@ -1302,7 +1281,7 @@ taxDocumentManageModule.directive('tempModule', function () { ...@@ -1302,7 +1281,7 @@ taxDocumentManageModule.directive('tempModule', function () {
}; };
$scope.checkedItemIds = []; $scope.checkedItemIds = [];
$scope.sniffCheckbox = function(){ $scope.sniffCheckbox = function () {
$scope.checkedItemIds.length = 0; $scope.checkedItemIds.length = 0;
$("input[name='dataGridCheckBox']").each(function (index, item) { $("input[name='dataGridCheckBox']").each(function (index, item) {
if (item.checked) { if (item.checked) {
...@@ -1313,21 +1292,94 @@ taxDocumentManageModule.directive('tempModule', function () { ...@@ -1313,21 +1292,94 @@ taxDocumentManageModule.directive('tempModule', function () {
console.info($scope.checkedItemIds.join(",")); console.info($scope.checkedItemIds.join(","));
}; };
$scope.getMonthLastDate = function(year,month){ $scope.getMonthLastDate = function (year, month) {
year = year ? year : new Date().getFullYear(); year = year ? year : new Date().getFullYear();
month = month ? month : (new Date().getMonth() + 1); month = month ? month : (new Date().getMonth() + 1);
var nextMoth = null; var nextMoth = null;
if(month==12){ if (month == 12) {
year += 1; year += 1;
nextMoth = 1; nextMoth = 1;
}else{ } else {
nextMoth = month + 1; nextMoth = month + 1;
} }
var curMothLastDayObj = new Date(new Date(year,nextMoth,1).getTime() - 1000*60*60*24); var curMothLastDayObj = new Date(new Date(year, nextMoth, 1).getTime() - 1000 * 60 * 60 * 24);
var date = curMothLastDayObj.getDate(); var date = curMothLastDayObj.getDate();
date = (date + "").length < 2 ? "0" + date : date; date = (date + "").length < 2 ? "0" + date : date;
return date; return date;
};
$scope.queryOwnTime = function (target, type) {
if (!target) return "";
var result = "";
try {
if (type === "int") {
if (typeof target === "number") {
result = target;
} else {
var date = new Date(target);
var year = date.getFullYear() + "";
var mon = (date.getMonth() + 1) + "";
year = year.length < 2 ? "0" + year : year;
mon = mon.length < 2 ? "0" + mon : mon;
result = parseInt(year + "" + mon);
}
} else {
var newMark = type;
if (typeof target === "number") {
var ownTimeString = target + "";
var year = ownTimeString.substr(0, 4);
var mon = ownTimeString.substr(4, 2);
result = year + newMark + mon;
} else {
var date = new Date(target);
var year = date.getFullYear() + "";
var mon = (date.getMonth() + 1) + "";
year = year.length < 2 ? "0" + year : year;
mon = mon.length < 2 ? "0" + mon : mon;
result = year + newMark + mon;
}
}
} catch (e) {
console.info(e.message);
result = "";
}
return result;
};
$scope.resetQueryField = function () {
$scope.queryFieldModel = {};
$("#period-picker1").val("");
$("#period-picker2").val("");
$("#period-picker3").val("");
$("#period-picker4").val("");
};
}]
}
});
taxDocumentManageModule.directive('downLoadModule', function () {
return {
restrict: 'EA',
controller: ['$scope', 'taxDocumentListService', '$translate',
function ($scope, taxDocumentListService, $translate) {
$scope.downloadAttachment = function () {
var checkedIDs = [
// 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=',
// 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=',
// 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=',
// 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=',
];
$("input[name='dataGridCheckBox']").each(function (index, item) {
if (item.checked) {
var cellId = $(item).attr("data-id");
checkedIDs.push(cellId);
} }
});
taxDocumentListService.downloadAllFile({
"ids":checkedIDs
});
};
}] }]
} }
}); });
\ No newline at end of file
<div class="land-manage-page" watch-group temp-module> <div class="land-manage-page" watch-group temp-module down-load-module>
<style> <style>
ul { ul {
margin: 0; margin: 0;
...@@ -344,7 +344,7 @@ ...@@ -344,7 +344,7 @@
<div class="TDL-query-val"> <div class="TDL-query-val">
<select ng-model="queryFieldModel.fileAttr" <select ng-model="queryFieldModel.fileAttr"
class="form-control radius3" class="form-control radius3"
required placeholder="{{'PleaseSelected' | translate}}"> placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileAttr in fileAttrOptions track by $index" <option ng-repeat="fileAttr in fileAttrOptions track by $index"
value="{{fileAttr}}">{{fileAttr}} value="{{fileAttr}}">{{fileAttr}}
</option> </option>
...@@ -360,8 +360,7 @@ ...@@ -360,8 +360,7 @@
<div class="TDL-query-val"> <div class="TDL-query-val">
<select ng-model="queryFieldModel.fileType" <select ng-model="queryFieldModel.fileType"
class="form-control radius3" class="form-control radius3"
required placeholder="{{'PleaseSelected' | translate}}"> placeholder="{{'PleaseSelected' | translate}}">
<option selected></option>
<option ng-repeat="fileType in fileTypeOptions track by $index" value="{{fileType}}"> <option ng-repeat="fileType in fileTypeOptions track by $index" value="{{fileType}}">
{{fileType}} {{fileType}}
</option> </option>
...@@ -424,8 +423,15 @@ ...@@ -424,8 +423,15 @@
<span translate="BusinessLine"></span> <span translate="BusinessLine"></span>
</div> </div>
<div class="TDL-query-val"> <div class="TDL-query-val">
<input type="text" class="form-control radius3" <select ng-model="queryFieldModel.businessLine"
ng-model="queryFieldModel.businessLine"/> class="form-control radius3"
placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="businessLine in businessLineOptions track by $index" value="{{businessLine.name}}">
{{businessLine.name}}
</option>
</select>
<!--<input type="text" class="form-control radius3"-->
<!--ng-model="queryFieldModel.businessLine"/>-->
</div> </div>
</div> </div>
<div class="TDL-query-block"> <div class="TDL-query-block">
...@@ -779,13 +785,16 @@ ...@@ -779,13 +785,16 @@
</label> </label>
<div class="col-sm-11" style="width:61.67%"> <div class="col-sm-11" style="width:61.67%">
<input class="form-control" <input class="form-control"
placeholder="{{'PleaseType' | translate}}" placeholder="{{'PleaseType'|translate}}"
ng-required="isRequired('EntityStorageLocation')" ng-required="isRequired('EntityStorageLocation')"
ng-model="editFieldModel.storageArea" ng-model="editFieldModel.storageArea"
/> />
</div> </div>
<div class="DTL-special-external-btn" title="{{'EntityStorageDescription' | translate}}"> <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> </div>
<div class="col-sm-6 form-group"> <div class="col-sm-6 form-group">
...@@ -807,7 +816,7 @@ ...@@ -807,7 +816,7 @@
{{'EntityIndex' | translate}} {{'EntityIndex' | translate}}
</label> </label>
<div class="col-sm-11" style="width:61.67%"> <div class="col-sm-11" style="width:61.67%">
<input class="form-control" title="{{editFieldModel.storageArea}}" <input class="form-control"
placeholder="{{'PleaseType' | translate}}" placeholder="{{'PleaseType' | translate}}"
ng-required="isRequired('EntityIndex')" ng-required="isRequired('EntityIndex')"
ng-model="editFieldModel.physicalIndexNumber" ng-model="editFieldModel.physicalIndexNumber"
...@@ -822,7 +831,7 @@ ...@@ -822,7 +831,7 @@
<textarea class="form-control" <textarea class="form-control"
placeholder="{{'PleaseType' | translate}}" placeholder="{{'PleaseType' | translate}}"
ng-required="isRequired('Remarks')" ng-required="isRequired('Remarks')"
ng-model="editFieldModel.remarks"> ng-model="editFieldModel.remark">
</textarea> </textarea>
</div> </div>
</div> </div>
...@@ -1014,7 +1023,7 @@ ...@@ -1014,7 +1023,7 @@
</label> </label>
<div class="col-sm-11" style="width:61.67%"> <div class="col-sm-11" style="width:61.67%">
<input class="form-control" <input class="form-control"
placeholder="{{'PleaseType' | translate}}" placeholder="{{'EntityStorageDescription'|translate}}"
ng-model="editFieldItem.storageArea" ng-model="editFieldItem.storageArea"
ng-required="isRequired('EntityStorageLocation')" ng-required="isRequired('EntityStorageLocation')"
/> />
......
...@@ -2,54 +2,143 @@ ...@@ -2,54 +2,143 @@
* Created by Administrator on 2019/3/1 0001. * Created by Administrator on 2019/3/1 0001.
*/ */
taxDocumentManageModule.factory('taxDocumentListService', taxDocumentManageModule.factory('taxDocumentListService',
['$q', 'apiConfig', 'jqFetch', 'apiInterceptor', ['$q', 'apiConfig', 'jqFetch','apiInterceptor',
function ($q, apiConfig, jqFetch, apiInterceptor) { function ($q, apiConfig, jqFetch,apiInterceptor) {
'use strict'; 'use strict';
return { return {
fetchMainList: function (params) { fetchMainList: function (params) {
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/selectList', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/selectList', params);
}, },
addNewRecord: function (params) { addNewRecord: function (params) {
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/add', params);
var defer = $q.defer();
window.$.ajax({
type: 'POST',
url: apiInterceptor.webApiHostUrl + '/v1/taxDoc/add',
data: params,
dataType: "json",
beforeSend: function(request) {
request.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken());
request.setRequestHeader("Content-Type", 'application/x-www-form-urlencoded');
request.setRequestHeader("Accept", "*/*");
},
success: function(result) {
$('#busy-indicator-container').hide();
defer.resolve(result);
},
error:function(result){
$('#busy-indicator-container').hide();
defer.reject(result);
}
});
return defer.promise;
}, },
editRecord: function (params) { editRecord: function (params) {
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/edit', params); $('#busy-indicator-container').show();
var defer = $q.defer();
window.$.ajax({
type: 'POST',
url: apiInterceptor.webApiHostUrl + '/v1/taxDoc/edit',
data: params,
dataType: "json",
beforeSend: function(request) {
request.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken());
// request.setRequestHeader("Content-Type", 'multipart/form-data; boundary=----WebKitFormBoundaryNBBkL3vAiuTDbAZP');
request.setRequestHeader("Content-Type", 'application/x-www-form-urlencoded');
request.setRequestHeader("Accept", "*/*");
},
success: function(result) {
$('#busy-indicator-container').hide();
defer.resolve(result);
},
error:function(result){
$('#busy-indicator-container').hide();
defer.reject(result);
}
});
return defer.promise;
}, },
verifyDuplicate: function (params) { verifyDuplicate:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/queryWhetherData', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/queryWhetherData', params);
}, },
getFileInfoOptions: function (params) { getFileInfoOptions:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/query4SelectionBox', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/query4SelectionBox', params);
}, },
getCompanyNameOptions: function (params) { getCompanyNameOptions:function(params){
return jqFetch.get(apiInterceptor.webApiHostUrl + '/org/getMyOrgList', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/org/query4SelectionBox', params);
}, },
delFileRecordItems: function (params) { delFileRecordItems:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/batchDelete', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/batchDelete', params);
}, },
getDocumentsAttrAndType:function(params){ getDocumentsAttrAndType:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/selectList', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/v1/fileTypes/selectList', params);
},
getBusinessList:function(params){
return jqFetch.get(apiInterceptor.webApiHostUrl + '/v1/businessunit/getlist', params);
},
downloadAllFile:function(params){
var xhr = new XMLHttpRequest();
var fileName = 'files.zip'; // 文件名称
xhr.open('POST', apiInterceptor.webApiHostUrl + "/taxDoc/downloadAllFile", true);
xhr.responseType = 'arraybuffer';
// xhr.setRequestHeader(token, 'xxxxx') ;// 请求头中的验证信息等(如果有)
xhr.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken());
xhr.setRequestHeader("Content-Type", 'application/json;charset=UTF-8');
xhr.onload = function() {
if (this.status === 200) {
// let type = xhr.getResponseHeader('Content-Type');
var blob = new Blob([this.response], {type: "arraybuffer"});
if (typeof window.navigator.msSaveBlob !== 'undefined') {
/*
* IE workaround for "HTML7007: One or more blob URLs were revoked by closing
* the blob for which they were created. These URLs will no longer resolve as
* the data backing the URL has been freed."
*/
window.navigator.msSaveBlob(blob, fileName)
} else {
var URL = window.URL || window.webkitURL;
var objectUrl = URL.createObjectURL(blob);
if (fileName) {
var a = document.createElement('a');
// safari doesn't support this yet
if (typeof a.download === 'undefined') {
window.location = objectUrl
} else {
a.href = objectUrl;
a.download = fileName;
document.body.appendChild(a);
a.click();
a.remove();
}
} else {
window.location = objectUrl;
}
}
}
};
xhr.send(JSON.stringify(params));
}, },
readXLSX:function(params){ readXLSX:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/previewExcelToJson', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/previewExcelToJson', params);
}, },
getBinaryData: function (url) { getBinaryData:function(url){
var defer = $q.defer(); var defer = $q.defer();
var oReq = new XMLHttpRequest(); var oReq = new XMLHttpRequest();
oReq.onload = function (e) { oReq.onload = function(e) {
var arraybuffer = oReq.response; var arraybuffer = oReq.response;
console.info("arraybuffer:", arraybuffer); console.info("arraybuffer:",arraybuffer);
defer.resolve(arraybuffer); defer.resolve(arraybuffer);
}; };
// oReq.open("GET", 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=', true);
oReq.open("GET", url, true); oReq.open("GET", url, true);
oReq.responseType = "arraybuffer"; oReq.responseType = "arraybuffer";
oReq.send(); oReq.send();
// return jqFetch.get(url,{},'arraybuffer');
return defer.promise; return defer.promise;
} }
}; };
}]); }]);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment