Commit f583a23e authored by chase's avatar chase

merge 档案管理

parent 72e50540
...@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -78,7 +79,7 @@ public class TaxDocumentController { ...@@ -78,7 +79,7 @@ public class TaxDocumentController {
@PostMapping("edit") @PostMapping("edit")
@ResponseBody @ResponseBody
public boolean editTaxDocument(@RequestBody TaxDocument taxDocument) { public boolean editTaxDocument( TaxDocument taxDocument) {
return taxDocumentService.editFilesType(taxDocument); return taxDocumentService.editFilesType(taxDocument);
} }
...@@ -161,84 +162,19 @@ public class TaxDocumentController { ...@@ -161,84 +162,19 @@ public class TaxDocumentController {
/** /**
* 读取Excel转换成 Json * 读取Excel转换成 Json
* @param taxDocumentDto 文件的路径 *
*/ */
@PostMapping("/previewExcelToJson") @PostMapping("/previewExcelToJson")
@ResponseBody @ResponseBody
public String previewExcel(@RequestBody TaxDocumentDto taxDocumentDto) { public String previewExcel(@RequestBody TaxDocumentDto taxDocumentDto) {
try { try {
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
URL httpurl=new URL(taxDocumentDto.getPath()); //根据url地址 获取文件输入流
InputStream is; InputStream is = getInputStreamByUrl(taxDocumentDto.getPath());
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();
}
InputStream inStream =is; InputStream inStream =is;
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(inStream); XSSFWorkbook xssfWorkbook = new XSSFWorkbook(inStream);
// 循环工作表Sheet // 循环工作表Sheet 将数据解析后 存入json对象
for (int numSheet = 0; numSheet < xssfWorkbook.getNumberOfSheets(); numSheet++) { workForSheet(dataArray, xssfWorkbook);
XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(numSheet);
String sheetName = xssfSheet.getSheetName();
if (xssfSheet == null) {
continue;
}
//当前sheet的json文件
JSONObject sheetJson = new JSONObject();
//当前sheet的array,作为sheetJson 的value值
JSONArray sheetArr = new JSONArray();
//sheet的第一行,获取作为json的key值
JSONArray key = new JSONArray();
int xssfLastRowNum = xssfSheet.getLastRowNum();
// 循环行Row
for (int rowNum = 0; rowNum <= xssfLastRowNum; rowNum++) {
XSSFRow xssfRow = xssfSheet.getRow(rowNum);
if (xssfRow == null) {
continue;
}
// 循环列Cell,在这里组合json文件
int firstCellNum = xssfRow.getFirstCellNum();
int lastCellNum = xssfRow.getLastCellNum();
JSONObject rowJson = new JSONObject();
for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNum++) {
XSSFCell cell = null;
try {
cell = xssfRow.getCell(cellNum);
if (cell == null) {
rowJson.put(key.getString(cellNum), "");
continue;
}
if (rowNum == 0)
key.add(toString(cell));
else {
//若是列号超过了key的大小,则跳过
if (cellNum >= key.size()) continue;
rowJson.put(key.getString(cellNum), toString(cell));
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (rowJson.keySet().size() > 0)
sheetArr.add(rowJson);
}
sheetJson.put(sheetName, shuffleData(sheetArr));
dataArray.add(sheetJson);
}
return dataArray.toString(); return dataArray.toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -322,4 +258,89 @@ public class TaxDocumentController { ...@@ -322,4 +258,89 @@ public class TaxDocumentController {
} }
return array; return array;
} }
/**
* 读取sheet数据 添加到json数据中
* @param dataArray
* @param xssfWorkbook
*/
private void workForSheet(JSONArray dataArray, XSSFWorkbook xssfWorkbook) {
for (int numSheet = 0; numSheet < xssfWorkbook.getNumberOfSheets(); numSheet++) {
XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(numSheet);
String sheetName = xssfSheet.getSheetName();
if (xssfSheet == null) {
continue;
}
//当前sheet的json文件
JSONObject sheetJson = new JSONObject();
//当前sheet的array,作为sheetJson 的value值
JSONArray sheetArr = new JSONArray();
//sheet的第一行,获取作为json的key值
JSONArray key = new JSONArray();
int xssfLastRowNum = xssfSheet.getLastRowNum();
// 循环行Row
for (int rowNum = 0; rowNum <= xssfLastRowNum; rowNum++) {
XSSFRow xssfRow = xssfSheet.getRow(rowNum);
if (xssfRow == null) {
continue;
}
// 循环列Cell,在这里组合json文件
int firstCellNum = xssfRow.getFirstCellNum();
int lastCellNum = xssfRow.getLastCellNum();
JSONObject rowJson = new JSONObject();
for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNum++) {
XSSFCell cell = null;
try {
cell = xssfRow.getCell(cellNum);
if (cell == null) {
rowJson.put(key.getString(cellNum), "");
continue;
}
if (rowNum == 0)
key.add(toString(cell));
else {
//若是列号超过了key的大小,则跳过
if (cellNum >= key.size()) continue;
rowJson.put(key.getString(cellNum), toString(cell));
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (rowJson.keySet().size() > 0)
sheetArr.add(rowJson);
}
sheetJson.put(sheetName, shuffleData(sheetArr));
dataArray.add(sheetJson);
}
}
/**
* 根据url地址 获取输入流
* @param url
* @return
* @throws IOException
*/
private InputStream getInputStreamByUrl(String url) throws IOException {
URL httpurl=new URL(URLDecoder.decode(url, "UTF-8"));
InputStream is;
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();
}
return is;
}
} }
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.AuthUserHelper; import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.constant.enums.FileUploadEnum;
import pwc.taxtech.atms.constant.enums.ReportFileUploadEnum;
import pwc.taxtech.atms.dao.TaxDocumentMapper; import pwc.taxtech.atms.dao.TaxDocumentMapper;
import pwc.taxtech.atms.dto.TaxDocumentDto; import pwc.taxtech.atms.dto.TaxDocumentDto;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.entity.OperationLogTaxDocument; import pwc.taxtech.atms.entity.OperationLogTaxDocument;
import pwc.taxtech.atms.entity.TaxDocument; import pwc.taxtech.atms.entity.TaxDocument;
import pwc.taxtech.atms.entity.TaxDocumentExample; import pwc.taxtech.atms.entity.TaxDocumentExample;
import pwc.taxtech.atms.vat.entity.FileUpload;
import pwc.taxtech.atms.vat.entity.ReportFileUpload;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -28,8 +19,9 @@ import java.net.HttpURLConnection; ...@@ -28,8 +19,9 @@ import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; import java.util.Calendar;
import java.util.stream.Collectors; import java.util.Date;
import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -49,37 +41,14 @@ public class TaxDocumentServiceImpl { ...@@ -49,37 +41,14 @@ public class TaxDocumentServiceImpl {
@Autowired @Autowired
private OperationLogTaxDocServiceImpl operationLogTaxDocService; private OperationLogTaxDocServiceImpl operationLogTaxDocService;
@Autowired
ReportFileUploadService reportFileUploadService;
@Autowired
DidiFileUploadService didiFileUploadService;
@Autowired @Autowired
private OrganizationServiceImpl organizationService; private OrganizationServiceImpl organizationService;
public List<TaxDocument> selectTaxDocumentList(TaxDocumentDto taxDocumentDto) { public List<TaxDocument> selectTaxDocumentList(TaxDocumentDto taxDocumentDto) {
List<TaxDocument> dataList = taxDocumentMapper.selectByExample(getExample(taxDocumentDto)); List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(getExample(taxDocumentDto));
DidiFileIUploadParam fileParam = new DidiFileIUploadParam(); return taxDocuments;
fileParam.setUuids(dataList.stream()
.map(o -> o.getFileUploadId()).collect(Collectors.toList()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
Map<String,String> urlMap = null;
if(CollectionUtils.isNotEmpty(uploadDetail.getList())){
urlMap = uploadDetail.getList().stream().collect(Collectors.toMap(DidiFileUploadDetailResult::getUid, didiFileUploadDetailResult -> didiFileUploadDetailResult.getViewHttpUrl()));
}
if(urlMap!=null){
for(TaxDocument data:dataList){
data.setFilePositionUrl(urlMap.get(data.getFileUploadId()));
}
}
return dataList;
} }
/** /**
* 根据条件查询 * 根据条件查询
* *
...@@ -165,24 +134,8 @@ public class TaxDocumentServiceImpl { ...@@ -165,24 +134,8 @@ public class TaxDocumentServiceImpl {
} }
@Transactional @Transactional
public synchronized boolean addTaxDocumentList(MultipartFile file, TaxDocument taxDocument) { public synchronized boolean addTaxDocumentList(TaxDocument taxDocument) {
try { try {
//上传文件
if(StringUtils.isBlank(taxDocument.getFileUploadId())){
FileUpload fileUpload = didiFileUploadService.uploadFile(file,file.getOriginalFilename(), FileUploadEnum.BizSource.RECORD_UPLOAD.name());
taxDocument.setFileUploadId(fileUpload.getUid());
taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl());
if(ReportFileUploadEnum.ReportType.MAPPING.containsKey(taxDocument.getFileType())){
ReportFileUpload reportFileUpload = new ReportFileUpload();
reportFileUpload.setOrgId(taxDocument.getCompanyId());
reportFileUpload.setSourceType(ReportFileUploadEnum.SuorceType.RECORD.name());
String period = String.valueOf(taxDocument.getOwnTime()).substring(0,6);
reportFileUpload.setPeriod(Integer.valueOf(period));
reportFileUpload.setFileUploadId(fileUpload.getUid());
reportFileUpload.setReportType(taxDocument.getFileType());
reportFileUploadService.saveData(file,reportFileUpload);
}
}
//设置创建人 创建时间信息 设置年份区分 //设置创建人 创建时间信息 设置年份区分
taxDocument.setCreateTime(new Date()); taxDocument.setCreateTime(new Date());
taxDocument.setUpdateTime(new Date()); taxDocument.setUpdateTime(new Date());
...@@ -190,12 +143,12 @@ public class TaxDocumentServiceImpl { ...@@ -190,12 +143,12 @@ public class TaxDocumentServiceImpl {
taxDocument.setCreatorId(authUserHelper.getCurrentUserId()); taxDocument.setCreatorId(authUserHelper.getCurrentUserId());
taxDocument.setUploadTime(new Date()); taxDocument.setUploadTime(new Date());
taxDocument.setYearRedundancy(Calendar.getInstance().get(Calendar.YEAR)); taxDocument.setYearRedundancy(Calendar.getInstance().get(Calendar.YEAR));
int num = taxDocumentMapper.insert(taxDocument);
//根据公司Id 设置业务线 //根据公司Id 设置业务线
String businessLine = organizationService.queryBusinessByCompanyId(taxDocument.getCompanyId()); String businessLine = organizationService.queryBusinessByCompanyId(taxDocument.getCompanyId());
if (StringUtils.isNotBlank(businessLine)) { if (StringUtils.isNotBlank(businessLine)) {
taxDocument.setBusinessLine(businessLine); taxDocument.setBusinessLine(businessLine);
} }
int num = taxDocumentMapper.insert(taxDocument);
if (num > 0) { if (num > 0) {
OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument(); OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument();
actionEntity.setId(taxDocument.getId().toString()); actionEntity.setId(taxDocument.getId().toString());
...@@ -218,8 +171,7 @@ public class TaxDocumentServiceImpl { ...@@ -218,8 +171,7 @@ public class TaxDocumentServiceImpl {
public boolean deleteTaxDocument(Long id) { public boolean deleteTaxDocument(Long id) {
try { try {
// log.warn("删除的内容:" + taxDocumentMapper.selectByPrimaryKey(id).toString()); //逻辑删除
// int num = taxDocumentMapper.deleteByPrimaryKey(id);
int num = taxDocumentMapper.updateEnableToF(id); int num = taxDocumentMapper.updateEnableToF(id);
if (num > 0) { if (num > 0) {
OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument(); OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument();
...@@ -280,8 +232,8 @@ public class TaxDocumentServiceImpl { ...@@ -280,8 +232,8 @@ public class TaxDocumentServiceImpl {
if (num > 0) { if (num > 0) {
OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument(); OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument();
actionEntity.setOperationAction("修改"); actionEntity.setOperationAction("修改");
actionEntity.setId(taxDocument.getId().toString());
//设置更新值 //设置更新值
actionEntity.setOriginalState(taxDocumentMapper.selectByPrimaryKey(taxDocument.getId()).toString());
actionEntity.setUpdateState(taxDocument.toString()); actionEntity.setUpdateState(taxDocument.toString());
boolean result = operationLogTaxDocService.addTaxDocumentList(actionEntity); boolean result = operationLogTaxDocService.addTaxDocumentList(actionEntity);
if (result) { if (result) {
...@@ -346,6 +298,7 @@ public class TaxDocumentServiceImpl { ...@@ -346,6 +298,7 @@ public class TaxDocumentServiceImpl {
return false; return false;
} }
} }
public void downloadAllFile(HttpServletResponse response, List<Long> ids) { public void downloadAllFile(HttpServletResponse response, List<Long> ids) {
String downloadName = "多选附件.zip"; String downloadName = "多选附件.zip";
try { try {
......
...@@ -392,8 +392,9 @@ public class ReportServiceImpl extends BaseService { ...@@ -392,8 +392,9 @@ public class ReportServiceImpl extends BaseService {
if (cell == null) { if (cell == null) {
continue;//todo cell == null 如何处理 continue;//todo cell == null 如何处理
} }
if (r <= addRowIndex) { if (r <= addRowIndex+1) {
Long cellTemplateId = distributedIdService.nextId(); String cellId = projectId+template.getId()+period+r+c;
Long cellTemplateId = Long.valueOf(cellId.hashCode());
PeriodCellTemplate cellTemplate = new PeriodCellTemplate(); PeriodCellTemplate cellTemplate = new PeriodCellTemplate();
cellTemplate.setPeriod(period); cellTemplate.setPeriod(period);
cellTemplate.setRowName(POIUtil.getCellFormulaString(cell)); cellTemplate.setRowName(POIUtil.getCellFormulaString(cell));
...@@ -430,7 +431,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -430,7 +431,7 @@ public class ReportServiceImpl extends BaseService {
fixedAccountCode(periodCellTemplateConfig); fixedAccountCode(periodCellTemplateConfig);
cellTemplateConfigList.add(periodCellTemplateConfig); cellTemplateConfigList.add(periodCellTemplateConfig);
} }
if (r>0&&hasHandDatas.contains(c)) { if (r>0&&r<=addRowIndex&&hasHandDatas.contains(c)) {
addManualConfig(cellTemplate, cell, now, cellTemplateConfigList); addManualConfig(cellTemplate, cell, now, cellTemplateConfigList);
} }
} else { } else {
...@@ -722,7 +723,11 @@ public class ReportServiceImpl extends BaseService { ...@@ -722,7 +723,11 @@ public class ReportServiceImpl extends BaseService {
} }
public Workbook assembleTaxWorkBook(Template template, Workbook tWorkbook, String projectId, Integer period) { public Workbook assembleTaxWorkBook(Template template, Workbook tWorkbook, String projectId, Integer period) {
Sheet sheet = tWorkbook.getSheetAt(0); Sheet sheet = tWorkbook.getSheetAt(0);
Project project = projectMapper.selectByPrimaryKey(projectId);
RevenueConfigExample example = new RevenueConfigExample(); RevenueConfigExample example = new RevenueConfigExample();
String queryDate = project.getYear()+"-"+(period>=10?period:("0"+period));
example.createCriteria().andOrgIdEqualTo(project.getOrganizationId()).
andStartDateLessThanOrEqualTo(queryDate).andEndDateGreaterThanOrEqualTo(queryDate).andStatusEqualTo(1);
List<RevenueConfig> dataList = revenueConfigMapper.selectByExample(example); List<RevenueConfig> dataList = revenueConfigMapper.selectByExample(example);
//合计项map //合计项map
Map<Integer,List<String>> sumMap = new HashMap<>(); Map<Integer,List<String>> sumMap = new HashMap<>();
...@@ -732,7 +737,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -732,7 +737,7 @@ public class ReportServiceImpl extends BaseService {
sumMap.put(TaxesCalculateReportEnum.Column.Column_8.getIndex(),new ArrayList<>()); sumMap.put(TaxesCalculateReportEnum.Column.Column_8.getIndex(),new ArrayList<>());
sumMap.put(TaxesCalculateReportEnum.Column.Column_10.getIndex(),new ArrayList<>()); sumMap.put(TaxesCalculateReportEnum.Column.Column_10.getIndex(),new ArrayList<>());
if (CollectionUtils.isNotEmpty(dataList)) { if (CollectionUtils.isNotEmpty(dataList)) {
Project project = projectMapper.selectByPrimaryKey(projectId);
int rowIndex = 1; int rowIndex = 1;
Row sourceRow = sheet.getRow(3); Row sourceRow = sheet.getRow(3);
for (RevenueConfig config : dataList) { for (RevenueConfig config : dataList) {
...@@ -771,24 +776,41 @@ public class ReportServiceImpl extends BaseService { ...@@ -771,24 +776,41 @@ public class ReportServiceImpl extends BaseService {
row.getCell(TaxesCalculateReportEnum.Column.Column_8.getIndex()).setCellValue(""); row.getCell(TaxesCalculateReportEnum.Column.Column_8.getIndex()).setCellValue("");
} }
row.getCell(TaxesCalculateReportEnum.Column.Column_9.getIndex()).setCellValue(config.getTaxRate().multiply(new BigDecimal(100)).intValue() + "%"); row.getCell(TaxesCalculateReportEnum.Column.Column_9.getIndex()).setCellValue(config.getTaxRate().multiply(new BigDecimal(100)).intValue() + "%");
row.getCell(TaxesCalculateReportEnum.Column.Column_10.getIndex()).setCellValue("WPNAME(\"VAT020\",\"B\",\""+config.getName()+"\",\"E\")*" row.getCell(TaxesCalculateReportEnum.Column.Column_10.getIndex()).setCellValue("WPNAME(\"VAT020\",\"B\",\""+config.getName()+"\",\"H\")*"
+"WPNAME(\"VAT020\",\"B\",\""+config.getName()+"\",\"I\")"); +"WPNAME(\"VAT020\",\"B\",\""+config.getName()+"\",\"I\")");
row.getCell(TaxesCalculateReportEnum.Column.Column_11.getIndex()).setCellValue(RevenueConfEnum.RevenueType.MAPPING.get(config.getRevenueType())); 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())); row.getCell(TaxesCalculateReportEnum.Column.Column_12.getIndex()).setCellValue(RevenueConfEnum.TaxType.MAPPING.get(config.getTaxType()));
rowIndex++;
//组装合计项 //组装合计项
sumMap.get(TaxesCalculateReportEnum.Column.Column_5.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_5.getIndex()+1,"")+rowIndex); sumMap.get(TaxesCalculateReportEnum.Column.Column_5.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_5.getIndex()+1,"")+rowIndex);
sumMap.get(TaxesCalculateReportEnum.Column.Column_6.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_6.getIndex()+1,"")+rowIndex); sumMap.get(TaxesCalculateReportEnum.Column.Column_6.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_6.getIndex()+1,"")+rowIndex);
sumMap.get(TaxesCalculateReportEnum.Column.Column_7.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_7.getIndex()+1,"")+rowIndex); sumMap.get(TaxesCalculateReportEnum.Column.Column_7.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_7.getIndex()+1,"")+rowIndex);
sumMap.get(TaxesCalculateReportEnum.Column.Column_8.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_8.getIndex()+1,"")+rowIndex); sumMap.get(TaxesCalculateReportEnum.Column.Column_8.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_8.getIndex()+1,"")+rowIndex);
sumMap.get(TaxesCalculateReportEnum.Column.Column_10.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_10.getIndex()+1,"")+rowIndex); sumMap.get(TaxesCalculateReportEnum.Column.Column_10.getIndex()).add(transNumber(TaxesCalculateReportEnum.Column.Column_10.getIndex()+1,"")+rowIndex);
rowIndex++;
} }
//组装合计项数据
assembleSumRow(sheet.getRow(rowIndex),sumMap);
} }
assemblePeriodTemplate(template, tWorkbook, projectId, period, dataList.size()); assemblePeriodTemplate(template, tWorkbook, projectId, period, dataList.size());
return tWorkbook; return tWorkbook;
} }
public void assembleSumRow(Row sumRow,Map<Integer,List<String>> sumMap){
Iterator<Map.Entry<Integer,List<String>>> iterator = sumMap.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry<Integer,List<String>> entry = iterator.next();
String sumStr = "Sum(";
for(String cellNum : entry.getValue()){
sumStr+=cellNum+",";
}
sumStr+=")";
sumStr = sumStr.replace(",)",")");
sumRow.getCell(entry.getKey()).setCellValue(sumStr);
}
}
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();
......
...@@ -44,7 +44,19 @@ public class DFFS extends FunctionBase implements FreeRefFunction { ...@@ -44,7 +44,19 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
if(!(args[4] instanceof MissingArgEval)){ if(!(args[4] instanceof MissingArgEval)){
segment6 = getStringParam(args[5], ec);//产品代码 segment6 = getStringParam(args[5], ec);//产品代码
} }
String formulaExpression = "DFFS(\"" + code + "\"," + year + "," + period + "," + sourceDataType + ",\"" + segment5 + "\",\"" + segment6 + "\")"; String formulaExpression = "DFFS(\"" + code + "\"," + year + "," + period + ","
+ sourceDataType ;
if(segment5!=null){
formulaExpression+=",\""+segment5+"\"";
}else{
formulaExpression+=",";
}
if(segment6!=null){
formulaExpression+=",\""+segment6+"\"";
}else{
formulaExpression+=",";
}
formulaExpression+=")";
logger.debug(formulaExpression); logger.debug(formulaExpression);
year = getYear(year); year = getYear(year);
......
...@@ -230,7 +230,7 @@ public class FunctionBase { ...@@ -230,7 +230,7 @@ public class FunctionBase {
evalStr = evalStr.replace("%",""); evalStr = evalStr.replace("%","");
try { try {
BigDecimal bigDecimal = new BigDecimal(evalStr); BigDecimal bigDecimal = new BigDecimal(evalStr);
bigDecimal.divide(new BigDecimal(100)); bigDecimal = bigDecimal.divide(new BigDecimal(100));
if (!dss.isEmpty()) { if (!dss.isEmpty()) {
return bigDecimal.add(dss.get(0).getAmount()); return bigDecimal.add(dss.get(0).getAmount());
} else { } else {
......
...@@ -36,16 +36,28 @@ public class JFFS extends FunctionBase implements FreeRefFunction { ...@@ -36,16 +36,28 @@ public class JFFS extends FunctionBase implements FreeRefFunction {
int year = getIntParam(args[1], ec); int year = getIntParam(args[1], ec);
int period = getIntParam(args[2], ec); int period = getIntParam(args[2], ec);
int sourceDataType = getIntParam(args[3], ec);//取值数据源 int sourceDataType = getIntParam(args[3], ec);//取值数据源
String segment5 = null; String segment5 = "";
if(!(args[4] instanceof MissingArgEval)){ if(!(args[4] instanceof MissingArgEval)){
segment5 = getStringParam(args[4], ec);//利润中心代码 segment5 = getStringParam(args[4], ec);//利润中心代码
} }
String segment6 = null; String segment6 = "";
if(!(args[4] instanceof MissingArgEval)){ if(!(args[4] instanceof MissingArgEval)){
segment6 = getStringParam(args[5], ec);//产品代码 segment6 = getStringParam(args[5], ec);//产品代码
} }
String formulaExpression = "JFFS(\"" + code + "\"," + year + "," + period + "," + sourceDataType + ",\"" + segment5 + "\",\"" + segment6 + "\")"; String formulaExpression = "JFFS(\"" + code + "\"," + year + "," + period + ","
+ sourceDataType ;
if(segment5!=null){
formulaExpression+=",\""+segment5+"\"";
}else{
formulaExpression+=",";
}
if(segment6!=null){
formulaExpression+=",\""+segment6+"\"";
}else{
formulaExpression+=",";
}
formulaExpression+=")";
logger.debug(formulaExpression); logger.debug(formulaExpression);
year = getYear(year); year = getYear(year);
......
...@@ -41,7 +41,7 @@ public interface FileTypesMapper extends MyMapper { ...@@ -41,7 +41,7 @@ public interface FileTypesMapper extends MyMapper {
* *
* @mbg.generated * @mbg.generated
*/ */
Long insert(FileTypes record); int insert(FileTypes record);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
......
...@@ -403,5 +403,6 @@ ...@@ -403,5 +403,6 @@
SELECT SELECT
id,file_attr, file_type id,file_attr, file_type
FROM file_types FROM file_types
ORDER BY file_attr
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -403,6 +403,6 @@ ...@@ -403,6 +403,6 @@
"WordLibraryTitle": "字库", "WordLibraryTitle": "字库",
"notAllowDisableMessage": "机构中已关联,不允许停用", "notAllowDisableMessage": "机构中已关联,不允许停用",
"UnSave": "未点击保存按钮!", "UnSave": "未点击保存按钮!",
"addFileType": "增加档案类型",
"~MustBeEndOneApp": "I Must be the End One, please!" "~MustBeEndOneApp": "I Must be the End One, please!"
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ taxDocumentManageModule.factory('taxDocumentListService', ...@@ -14,7 +14,7 @@ taxDocumentManageModule.factory('taxDocumentListService',
var defer = $q.defer(); var defer = $q.defer();
window.$.ajax({ window.$.ajax({
type: 'POST', type: 'POST',
url: apiInterceptor.webApiHostUrl + '/v1/taxDoc/add', url: apiInterceptor.webApiHostUrl + '/taxDoc/add',
data: params, data: params,
dataType: "json", dataType: "json",
beforeSend: function(request) { beforeSend: function(request) {
...@@ -40,7 +40,7 @@ taxDocumentManageModule.factory('taxDocumentListService', ...@@ -40,7 +40,7 @@ taxDocumentManageModule.factory('taxDocumentListService',
var defer = $q.defer(); var defer = $q.defer();
window.$.ajax({ window.$.ajax({
type: 'POST', type: 'POST',
url: apiInterceptor.webApiHostUrl + '/v1/taxDoc/edit', url: apiInterceptor.webApiHostUrl + '/taxDoc/edit',
data: params, data: params,
dataType: "json", dataType: "json",
beforeSend: function(request) { beforeSend: function(request) {
......
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