Commit e5e32fcf authored by neo.wang's avatar neo.wang

Merge branch 'dev_neo' into 'dev'

Dev neo

See merge request root/atms!51
parents 6edf0b16 6970a45b
......@@ -162,11 +162,7 @@
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.2.jre7</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
......@@ -255,6 +251,7 @@
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
......@@ -300,11 +297,13 @@
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>1.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>1.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.javaaxp</groupId>
......@@ -323,17 +322,17 @@
<artifactId>lombok</artifactId>
<version>1.18.0</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.eclipse.jetty.aggregate</groupId>-->
<!--<artifactId>jetty-all</artifactId>-->
<!--<version>9.4.10.v20180503</version>-->
<!--<type>pom</type>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.eclipse.jetty</groupId>-->
<!--<artifactId>apache-jsp</artifactId>-->
<!--<version>9.4.10.v20180503</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
<version>9.4.10.v20180503</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<version>9.4.10.v20180503</version>
</dependency>
</dependencies>
<profiles>
......
package pwc.taxtech.atms.common.datasource;
import com.alibaba.druid.pool.DruidDataSource;
import com.beust.jcommander.ParameterException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.pool2.KeyedPooledObjectFactory;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.impl.DefaultPooledObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.exception.ParameterException;
public class DataSourceFactory implements KeyedPooledObjectFactory<String, DruidDataSource> {
private static final Logger logger = LoggerFactory.getLogger(DataSourceFactory.class);
......
......@@ -26,11 +26,11 @@ public final class Constant {
public static final String UPLOAD_FOLDER_NAME = "Upload";
public static final String CURRENT_USER_HOME = "~";
public static final String CURRENT_USER_UPLOAD_FOLDER = CURRENT_USER_HOME + File.separator + UPLOAD_FOLDER_NAME;
public static final String CURRENT_IMAGE_PATH=CURRENT_USER_HOME+File.separator+"Resource"+File.separator+"Images";
public static final String IMAGE_PATH_INFORMATION=CURRENT_IMAGE_PATH+File.separator+"information.png";
public static final String IMAGE_PATH_ERROR=CURRENT_IMAGE_PATH+File.separator+"error.png";
public static final String IMAGE_PATH_SUCCESS=CURRENT_IMAGE_PATH+File.separator+"success.png";
public static final String IMAGE_PATH_WARN=CURRENT_IMAGE_PATH+File.separator+"warning1.png";
public static final String CURRENT_IMAGE_PATH = CURRENT_USER_HOME + File.separator + "Resource" + File.separator + "Images";
public static final String IMAGE_PATH_INFORMATION = CURRENT_IMAGE_PATH + File.separator + "information.png";
public static final String IMAGE_PATH_ERROR = CURRENT_IMAGE_PATH + File.separator + "error.png";
public static final String IMAGE_PATH_SUCCESS = CURRENT_IMAGE_PATH + File.separator + "success.png";
public static final String IMAGE_PATH_WARN = CURRENT_IMAGE_PATH + File.separator + "warning1.png";
public static final boolean DEFAULT_RESULT = true;
......@@ -41,4 +41,5 @@ public final class Constant {
public static final boolean DEFAULT_HAS_HEADER = true;
public static final String IMAGE_FORMART_ = "png";
public static final String EMPTY = "";
}
\ No newline at end of file
......@@ -2,7 +2,6 @@ package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
......@@ -31,6 +30,9 @@ import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
import static javax.servlet.http.HttpServletResponse.SC_OK;
@RestController
@RequestMapping(value = "api/v1/CustomsInvoice")
public class CustomsInvoiceController {
......@@ -84,9 +86,9 @@ public class CustomsInvoiceController {
int count = getDownloadFilePath(filter, os);
if (count == 0) {
response.setStatus(HttpStatus.SC_NO_CONTENT);
response.setStatus(SC_NO_CONTENT);
} else {
response.setStatus(HttpStatus.SC_OK);
response.setStatus(SC_OK);
}
} catch (IOException e) {
e.printStackTrace();
......
package pwc.taxtech.atms.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import pwc.taxtech.atms.constant.enums.EnumModule;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceDto;
import pwc.taxtech.atms.vat.service.impl.FileUploadAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.Response;
import static pwc.taxtech.atms.constant.Constant.USER_ID_FOR_UPLOAD;
@RestController
......@@ -28,6 +20,6 @@ public class FileUploadController {
@RequestMapping(value = "NewFile", method = RequestMethod.POST, produces = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity getInputInvoiceTreeViewData(MultipartHttpServletRequest request) {
return fileUploadAdapter.upload(request,EnumModule.TrailBalance, USER_ID_FOR_UPLOAD);
return fileUploadAdapter.upload(request, EnumModule.TrailBalance, USER_ID_FOR_UPLOAD);
}
}
package pwc.taxtech.atms.controller;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
......@@ -28,6 +27,9 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
import static javax.servlet.http.HttpServletResponse.SC_OK;
@RestController
@RequestMapping(value = "api/v1/inputInvoiceImport")
public class InputInvoiceImportController {
......@@ -52,9 +54,9 @@ public class InputInvoiceImportController {
int count = getDownloadFilePath(paras, os);
if (count == 0) {
response.setStatus(HttpStatus.SC_NO_CONTENT);
response.setStatus(SC_NO_CONTENT);
} else {
response.setStatus(HttpStatus.SC_OK);
response.setStatus(SC_OK);
}
} catch (IOException e) {
e.printStackTrace();
......
package pwc.taxtech.atms.controller;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
......@@ -24,6 +23,9 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
import static javax.servlet.http.HttpServletResponse.SC_OK;
@RestController
@RequestMapping(value = "api/v1/outputInvoiceImport")
public class OutputInvoiceController {
......@@ -48,9 +50,9 @@ public class OutputInvoiceController {
int count = getDownloadFilePath(paras, os);
if (count == 0) {
response.setStatus(HttpStatus.SC_NO_CONTENT);
response.setStatus(SC_NO_CONTENT);
} else {
response.setStatus(HttpStatus.SC_OK);
response.setStatus(SC_OK);
}
} catch (IOException e) {
e.printStackTrace();
......
......@@ -3,7 +3,6 @@ package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
......@@ -14,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.util.NPOIHelper;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.BalanceSubTotalDto;
import pwc.taxtech.atms.dto.vatdto.BalanceWithSubTotalsResultDto;
......@@ -27,7 +27,6 @@ import pwc.taxtech.atms.dto.vatdto.VatEnterpriseAccountDto;
import pwc.taxtech.atms.service.ICitTBDataImportService;
import pwc.taxtech.atms.service.IdentityService;
import pwc.taxtech.atms.service.impl.DataImportServiceImpl;
import pwc.taxtech.atms.common.util.NPOIHelper;
import pwc.taxtech.atms.vat.dao.DataImportModel;
import pwc.taxtech.atms.vat.service.TBDataImportService;
import pwc.taxtech.atms.vat.service.impl.FileUploadAdapter;
......@@ -44,6 +43,7 @@ import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static pwc.taxtech.atms.constant.Constant.DEFAULT_HAS_HEADER;
import static pwc.taxtech.atms.constant.Constant.HEADER_ROW_INDEX;
......@@ -478,10 +478,10 @@ public class TBDataImportController {
return ResponseEntity.ok(dataImportModel);
} catch (FileNotFoundException e) {//TODO: replace exception filter (neo)
e.printStackTrace();
return ResponseEntity.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).build();
return ResponseEntity.status(SC_INTERNAL_SERVER_ERROR).build();
} catch (IOException e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).build();
return ResponseEntity.status(SC_INTERNAL_SERVER_ERROR).build();
}
} else {
return ResponseEntity.ok().build();
......
package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaAgent;
import pwc.taxtech.atms.vat.service.impl.FormulaAgent;
import java.util.ArrayList;
import java.util.List;
......
package pwc.taxtech.atms.exception;
public class NotSupportedException extends ApplicationException {
public NotSupportedException() {
}
public NotSupportedException(String message) {
super(message);
}
}
package pwc.taxtech.atms.exception;
public class ParameterException extends ApplicationException{
public ParameterException() {
super();
}
public ParameterException(String message) {
super(message);
}
}
package pwc.taxtech.atms.service.impl;
import com.alibaba.druid.pool.DruidDataSource;
import com.beust.jcommander.ParameterException;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
......@@ -19,6 +18,7 @@ import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.datasource.DataSourceConfig;
import pwc.taxtech.atms.common.datasource.DataSourceFactory;
import pwc.taxtech.atms.common.datasource.ShardingContextHolder;
import pwc.taxtech.atms.exception.ParameterException;
import javax.annotation.PostConstruct;
import javax.sql.DataSource;
......
package pwc.taxtech.atms.service.impl;
import com.beust.jcommander.internal.Lists;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.jdbc.ScriptRunner;
import org.apache.ibatis.session.SqlSession;
......
package pwc.taxtech.atms.vat.service.impl.report.functions;
package pwc.taxtech.atms.vat.service.impl;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.FormulaAdminMapper;
import pwc.taxtech.atms.dto.GroupId;
import pwc.taxtech.atms.dto.vatdto.CellTemplatePerGroupDto;
import pwc.taxtech.atms.entitiy.ProjectServiceType;
import pwc.taxtech.atms.entitiy.ProjectServiceTypeExample;
import pwc.taxtech.atms.vat.dao.CellDataMapper;
import pwc.taxtech.atms.vat.dao.FormulaProjectMapper;
import pwc.taxtech.atms.vat.dao.ReportMapper;
import pwc.taxtech.atms.vat.entity.CellData;
import pwc.taxtech.atms.vat.entity.CellDataExample;
import pwc.taxtech.atms.vat.entity.Report;
......@@ -16,32 +20,33 @@ import java.util.List;
import static pwc.taxtech.atms.constant.Constant.FIRST_OR_DEFAULT;
@Service
public class FormulaAgent {
// @Autowired
// public FormulaAdminMapper formulaAdminMapper;
// @Autowired
// public FormulaProjectMapper projectMp;
// @Autowired
// public ReportMapper reportMapper;
// @Autowired
// public CellDataMapper cellDataMapper;
@Repository
public class FormulaAgent extends VatAbstractService {
@Autowired
public FormulaAdminMapper adminMp;
@Autowired
public FormulaProjectMapper projectMp;
@Autowired
public ReportMapper reportMapper;
@Autowired
public CellDataMapper cellDataMapper;
public List<CellTemplatePerGroupDto> getCellTemplateGroupDto(Long templateGroupId, String projectId) {
ProjectServiceTypeExample pst = new ProjectServiceTypeExample();
pst.createCriteria().andTemplateGroupIDEqualTo(Long.valueOf(templateGroupId))
.andServiceTypeIDEqualTo(EnumServiceType.VAT.getCode() + "");
List<ProjectServiceType> pstReult = SpringContextUtil.projectServiceTypeMapper.selectByExample(pst);
List<ProjectServiceType> pstReult = projectServiceTypeMapper.selectByExample(pst);
List<CellTemplatePerGroupDto> cellTemplates = SpringContextUtil.formulaAdminMapper.getCellTemplatePerGroupDto(templateGroupId);
List<CellTemplatePerGroupDto> cellTemplates = adminMp.getCellTemplatePerGroupDto(templateGroupId);
if (pstReult == null || pstReult.isEmpty()) {
List<GroupId> groupIds = SpringContextUtil.formulaAdminMapper.getTemplateGroupId(projectId);
List<GroupId> groupIds = adminMp.getTemplateGroupId(projectId);
GroupId groupId;
if (groupIds.size() > 0) {
groupId = groupIds.stream().filter(m -> m.isDefault != 1).findFirst().get();
if (groupId == null) groupId = groupIds.get(0);
cellTemplates.addAll(SpringContextUtil.formulaAdminMapper.getCellTemplatePerGroupDto(groupId.groupId));
cellTemplates.addAll(adminMp.getCellTemplatePerGroupDto(groupId.groupId));
}
}
return cellTemplates;
......@@ -51,7 +56,7 @@ public class FormulaAgent {
ReportExample example = new ReportExample();
example.createCriteria().andTemplateIdEqualTo(Long.valueOf(templateId))
.andPeriodEqualTo(periodId);
List<Report> reports = SpringContextUtil.reportMapper.selectByExample(example);
List<Report> reports = reportMapper.selectByExample(example);
if (reports != null || !reports.isEmpty()) return reports.get(FIRST_OR_DEFAULT);
return null;
......@@ -60,9 +65,10 @@ public class FormulaAgent {
public CellData getCellDataListByTemplate(String templateId, Long reportId) {
CellDataExample dataExample = new CellDataExample();
dataExample.createCriteria().andCellTemplateIdEqualTo(Long.valueOf(templateId));
List<CellData> cellDataList = SpringContextUtil.cellDataMapper.selectByExample(dataExample);
List<CellData> cellDataList = cellDataMapper.selectByExample(dataExample);
if (cellDataList != null || !cellDataList.isEmpty()) return cellDataList.get(FIRST_OR_DEFAULT);
return null;
}
}
......@@ -18,7 +18,6 @@ import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.entity.CellData;
import pwc.taxtech.atms.vat.entity.Report;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaAgent;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaContext;
import java.math.BigDecimal;
......
package pwc.taxtech.atms.vat.service.impl;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.apache.poi.ss.formula.udf.AggregatingUDFFinder;
import org.apache.poi.ss.formula.udf.DefaultUDFFinder;
import org.apache.poi.ss.formula.udf.UDFFinder;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
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.ss.usermodel.WorkbookFactory;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -15,17 +19,38 @@ import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import pwc.taxtech.atms.service.impl.DistributedIDService;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.dao.CellDataMapper;
import pwc.taxtech.atms.vat.dao.PeriodCellTemplateConfigMapper;
import pwc.taxtech.atms.vat.dao.PeriodCellTemplateMapper;
import pwc.taxtech.atms.vat.dao.PeriodTemplateMapper;
import pwc.taxtech.atms.vat.dao.ReportMapper;
import pwc.taxtech.atms.vat.entity.CellData;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplate;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfigExample;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplateExample;
import pwc.taxtech.atms.vat.entity.PeriodTemplate;
import pwc.taxtech.atms.vat.entity.PeriodTemplateExample;
import pwc.taxtech.atms.vat.entity.Report;
import pwc.taxtech.atms.vat.service.ReportGenerator;
import pwc.taxtech.atms.vat.service.impl.report.functions.*;
import pwc.taxtech.atms.vat.service.impl.report.functions.FSJZ;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaContext;
import pwc.taxtech.atms.vat.service.impl.report.functions.ND;
import pwc.taxtech.atms.vat.service.impl.report.functions.SGSR;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import static pwc.taxtech.atms.constant.Constant.EMPTY;
@Service
public class ReportGeneratorImpl implements ReportGenerator {
@Autowired
......@@ -55,7 +80,7 @@ public class ReportGeneratorImpl implements ReportGenerator {
List<PeriodTemplate> periodTemplateList = periodTemplateMapper.selectByExample(periodTemplateExample);
List<Long> periodTemplateIDList = periodTemplateList.stream().map(PeriodTemplate::getTemplateId).collect(Collectors.toList());
Long templateGroupID = periodTemplateList.size()>0?periodTemplateList.get(0).getTemplateGroupId():0;
Long templateGroupID = periodTemplateList.size() > 0 ? periodTemplateList.get(0).getTemplateGroupId() : 0;
PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample();
periodCellTemplateExample.createCriteria().andReportTemplateIdIn(periodTemplateIDList);
......@@ -74,10 +99,7 @@ public class ReportGeneratorImpl implements ReportGenerator {
Workbook newWorkbook = workbook.get();
addFunctionsToWorkbook(newWorkbook,templateGroupID);
addFunctionsToWorkbook(newWorkbook, templateGroupID);
int sheetCount = newWorkbook.getNumberOfSheets();
for (int i = 0; i < sheetCount; i++) {
Sheet sheet = newWorkbook.getSheetAt(i);
......@@ -119,7 +141,7 @@ public class ReportGeneratorImpl implements ReportGenerator {
cell = row.getCell(k.getColumnIndex());
//todo:后面单独处理kv的公式
if(!v.getFormula().contains("@")) {
if (!v.getFormula().contains("@")) {
cell.setCellFormula(v.getFormula());
}
});
......@@ -157,21 +179,20 @@ public class ReportGeneratorImpl implements ReportGenerator {
List<PeriodCellTemplateConfig> periodCellTemplateConfigs = periodCellTemplateConfigList.stream().filter(a -> a.getReportTemplateId().equals(templateID)).collect(Collectors.toList());
for (PeriodCellTemplateConfig periodCellTemplateConfig : periodCellTemplateConfigs) {
Optional<PeriodCellTemplate> tempPeriodCellTemplate = periodCellTemplateList.stream().filter(a->a.getCellTemplateId().equals(periodCellTemplateConfig.getCellTemplateId())).findFirst();
if (tempPeriodCellTemplate!=null){
Optional<PeriodCellTemplate> tempPeriodCellTemplate = periodCellTemplateList.stream().filter(a -> a.getCellTemplateId().equals(periodCellTemplateConfig.getCellTemplateId())).findFirst();
if (tempPeriodCellTemplate != null) {
CellData cellData = new CellData();
cellData.setId(distributedIDService.nextId());
cellData.setReportId(reportID);
cellData.setCellTemplateId(tempPeriodCellTemplate.get().getCellTemplateId());
String data;
if(sheet.getRow(tempPeriodCellTemplate.get().getRowIndex())!=null&&sheet.getRow(tempPeriodCellTemplate.get().getRowIndex()).getCell(tempPeriodCellTemplate.get().getColumnIndex())!=null){
data =Double.toString(sheet.getRow(tempPeriodCellTemplate.get().getRowIndex()).getCell(tempPeriodCellTemplate.get().getColumnIndex()).getNumericCellValue());
}
else{
data = StringUtils.EMPTY;
if (sheet.getRow(tempPeriodCellTemplate.get().getRowIndex()) != null && sheet.getRow(tempPeriodCellTemplate.get().getRowIndex()).getCell(tempPeriodCellTemplate.get().getColumnIndex()) != null) {
data = Double.toString(sheet.getRow(tempPeriodCellTemplate.get().getRowIndex()).getCell(tempPeriodCellTemplate.get().getColumnIndex()).getNumericCellValue());
} else {
data = EMPTY;
}
cellData.setData(data);
cellData.setFormulaExp(StringUtils.EMPTY);
cellData.setFormulaExp(EMPTY);
cellData.setCreateBy("Admin");
cellData.setCreateTime(createTime);
cellData.setUpdateBy("Admin");
......@@ -236,15 +257,15 @@ public class ReportGeneratorImpl implements ReportGenerator {
*
* @param workbook 工作簿
*/
private void addFunctionsToWorkbook(Workbook workbook,Long templateGroupID) {
String[] functionNames = {"SGSR","FSJZ","ND"};
private void addFunctionsToWorkbook(Workbook workbook, Long templateGroupID) {
String[] functionNames = {"SGSR", "FSJZ", "ND"};
FormulaContext formulaContext = new FormulaContext();
formulaContext.setFormulaAgent(formulaAgent);
formulaContext.setPeriod(6);//todo: assign value later
formulaContext.setReportTemplateGroupID(templateGroupID);
FreeRefFunction[] functionImpls = {new SGSR(formulaContext),new FSJZ(formulaContext),new ND(formulaContext)};
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functionNames, functionImpls);
UDFFinder udfToolpack = new AggregatingUDFFinder(udfs);
workbook.addToolPack(udfToolpack);
}
}
}
......@@ -8,14 +8,19 @@ import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.CellTemplateReferenceDto;
import pwc.taxtech.atms.dto.vatdto.ReportDto;
import pwc.taxtech.atms.entitiy.*;
import pwc.taxtech.atms.exception.NotSupportedException;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplate;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig;
import pwc.taxtech.atms.vat.entity.PeriodTemplate;
import pwc.taxtech.atms.vat.entity.PeriodTemplateExample;
import pwc.taxtech.atms.vat.service.ReportService;
import javax.ws.rs.NotSupportedException;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
@Service
......@@ -81,7 +86,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
}
@Override
public OperationResultDto updateConfig(String projectId, Integer period,Boolean ifDeleteManualDataSource, String generator) {
public OperationResultDto updateConfig(String projectId, Integer period, Boolean ifDeleteManualDataSource, String generator) {
OperationResultDto result = new OperationResultDto();
if (period == null) {
......@@ -112,7 +117,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSourceMapper.clearTaxPayerReportWithPeriod(period);
dataSourceMapper.clearDataSourceWithPeriod(period);
dataSourceMapper.clearDataSourceDetailWithPeriod(period);
dataSourceMapper.clearCellDataWithPeriod( strExceptTemplateIDs);
dataSourceMapper.clearCellDataWithPeriod(strExceptTemplateIDs);
// 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample example = new TemplateExample();
......
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.service.impl.report.functions;
import lombok.Getter;
import lombok.Setter;
import pwc.taxtech.atms.vat.service.impl.FormulaAgent;
@Setter
@Getter
......
......@@ -74,13 +74,14 @@
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="txPointcut2" expression="execution(public * pwc.taxtech.atms..*.*(..)) &amp;&amp; @target(org.springframework.stereotype.Service)" />
<aop:config proxy-target-class="true">
<aop:pointcut id="txPointcut2" expression="execution(public * pwc.taxtech.atms..*.*(..)) &amp;&amp; @target(org.springframework.stereotype.Service)
and !execution(* pwc.taxtech.atms.vat.service.impl.FormulaAgent.*(..))" />
<aop:advisor pointcut-ref="txPointcut2" advice-ref="txAdvice" />
</aop:config>
<aop:aspectj-autoproxy />
<tx:annotation-driven proxy-target-class="true" />
</beans>
\ 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