Commit 778dfe62 authored by sherlock's avatar sherlock

merge

parents aa4d1dc9 f8eba103
......@@ -367,6 +367,25 @@
<artifactId>activiti-rest</artifactId>
<version>${activiti.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.grapecity.documents/gcexcel -->
<dependency>
<groupId>com.grapecity.documents</groupId>
<artifactId>gcexcel</artifactId>
<version>2.0.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.12</version>
</dependency>
</dependencies>
<profiles>
......
kill -9 `ps -ef |grep java | grep atms-api | awk '{print $2}'`
export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n"
rm -f nohup.out
nohup mvn clean tomcat7:run -Dmaven.test.skip=true -f pom.xml &
......@@ -41,4 +41,12 @@ public class MyAsserts {
public static void assertEmpty(Collection obj, ApiException exception) {
if (obj != null && !obj.isEmpty()) throw exception;
}
public static <T,S> void assertEq(T t,S s,ApiException exception){
if(s != t) throw exception;
}
public static <T,S> void assertNotEq(T t,S s,ApiException exception){
if(s == t) throw exception;
}
}
......@@ -3,12 +3,14 @@ package pwc.taxtech.atms.controller;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig;
import pwc.taxtech.atms.vat.entity.PeriodJob;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccount;
import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl;
......@@ -21,27 +23,32 @@ public class ReportController {
@Autowired
ReportServiceImpl reportService;
@RequestMapping(value = "export", method = RequestMethod.POST)
public ResponseEntity getExportFile(ReportExportDto report) {
return ResponseEntity.ok(reportService.export(report.getReportData(), "~"));
}
@RequestMapping(value = "template/{projectId}/{serviceType}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<List<ReportDto>> getTemplate(@PathVariable String projectId, @PathVariable int serviceType, @PathVariable Integer period) {
return reportService.getReportTemplate(projectId, EnumServiceType.getEnumByCode(serviceType), period);
}
@RequestMapping(value = "updateConfig/{projectId}/{ifDeleteManualDataSource}/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto updateConfig(@PathVariable String projectId,
@PathVariable Boolean ifDeleteManualDataSource,
@PathVariable Integer period,
@RequestParam String generator,
@RequestParam Boolean mergeManual) {
return reportService.updateConfig(projectId, period, ifDeleteManualDataSource, generator, mergeManual);
// OperationResultDto operationResultDto = new OperationResultDto();
// operationResultDto.setResult(true);
// return operationResultDto;
@RequestMapping(value = "generateByTotal/{projectId}/{mergeManual}/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto generateAllData(@PathVariable String projectId, @PathVariable Integer period, @RequestParam Optional<String> generator,
@PathVariable Boolean mergeManual) {
return reportService.generateData(projectId, EnumServiceType.VAT, mergeManual, period, null, generator);
}
@RequestMapping(value = "getRunningJob/{projectId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
public PeriodJob getRunningJob(@PathVariable String projectId, @PathVariable Integer period) {
return reportService.getRunningJob(projectId, period);
}
@RequestMapping(value = "generateByTotal/{projectId}/{ifDeleteManualDataSource}/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto generateAllData(@PathVariable String projectId, @PathVariable Boolean ifDeleteManualDataSource,
@PathVariable Integer period, @RequestParam Optional<String> generator) {
return reportService.generateData(projectId, EnumServiceType.VAT, ifDeleteManualDataSource, period, null, generator);
@RequestMapping(value = "getJobStatus/{projectId}//{period}/{jobId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
public PeriodJob getJobStatus(@PathVariable String projectId, @PathVariable Integer period, @PathVariable String jobId) {
return reportService.getJobStatus(projectId, period, jobId);
}
@RequestMapping(value = "templateReferences/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
......@@ -128,7 +135,9 @@ public class ReportController {
}
@RequestMapping(value = "hasManualDataSource/{projectId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Boolean hasManualDataSource(@PathVariable String projectId, @PathVariable Integer period) {
return reportService.hasManualDataSource(projectId,period);
public Boolean hasManualDataSource(@PathVariable String projectId, @PathVariable Integer period) {
return reportService.hasManualDataSource(projectId, period);
}
}
\ No newline at end of file
package pwc.taxtech.atms.dto.vatdto;
import lombok.Getter;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.TemplateGroup;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.service.impl.Message;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplate;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig;
import pwc.taxtech.atms.vat.entity.PeriodTemplate;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Getter
public class PeriodResources {
Project project;
List<PeriodTemplate> periodTemplates = new ArrayList<>();
List<PeriodCellTemplate> periodCellTemplates = new ArrayList<>();
List<PeriodCellTemplateConfig> periodCellTemplateConfigs = new ArrayList<>();
public void setProject(Project project) {
this.project = project;
}
public void putAllTemplate(List<PeriodTemplate> periodTemplates) {
this.periodTemplates.addAll(periodTemplates);
}
public List<Long> getTemolateIds() {
MyAsserts.assertNotEmpty(periodTemplates, Exceptions.NOT_FOUND_TEMPLATE_EXCEPTION);
return periodTemplates.stream()
.map(PeriodTemplate::getTemplateId)
.collect(Collectors.toList());
}
public void putAllCellTemplate(List<PeriodCellTemplate> periodCellTemplates) {
this.periodCellTemplates.addAll(periodCellTemplates);
}
public void putAllCellTemplateConfig(List<PeriodCellTemplateConfig> periodCellTemplateConfigs) {
this.periodCellTemplateConfigs.addAll(periodCellTemplateConfigs);
}
public Long getTemplateGroupId(){
return periodTemplates.get(0).getTemplateGroupId();
}
}
package pwc.taxtech.atms.dto.vatdto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class ReportExportDto {
@JsonProperty("ReportType")
private String reportType;
@JsonProperty("ReportData")
private String reportData;
}
package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.Template;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.entity.PeriodJob;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
public class WrapPeriodJobDto {
public static final String STATUS_BEGIN = "Begin";
public static final String STATUS_CANCEL = "Cancel";
public static final String STATUS_ERROR = "Error";
public static final String STATUS_END = "End";
public static final String STEP_UPDATE_CONFIG = "UpdateConfig";
public static PeriodJob createReportGenJob(String projectId, Integer period, List<Template> templates) {
MyAsserts.assertNotEmpty(templates, Exceptions.NOT_FOUND_TEMPLATE_EXCEPTION);
PeriodJob job = new PeriodJob();
job.setCreateTime(new Date());
job.setName("Gen All Report");
job.setProjectId(projectId);
job.setPeriod(period);
job.setId(UUID.randomUUID().toString());
job.setStatus(STATUS_BEGIN);
job.setCurrentStep(STEP_UPDATE_CONFIG);
StringBuilder builder = new StringBuilder(STEP_UPDATE_CONFIG);
templates.forEach(m -> {
builder.append(",").append(m.getCode());
});
job.setStepsCode(builder.toString());
return job;
}
}
package pwc.taxtech.atms.exception;
import org.springframework.http.ResponseEntity;
import javax.net.ssl.SSLEngineResult;
import static org.springframework.http.HttpStatus.CONFLICT;
public class ConflictException extends ApiException {
public ConflictException() {
super();
}
public ConflictException(String message) {
super(message);
}
public ConflictException(String message, Throwable cause) {
super(message, cause);
}
public ConflictException(Throwable cause) {
super(cause);
}
@Override
public <Object> ResponseEntity handle() {
return ResponseEntity.status(CONFLICT).build();
}
}
......@@ -10,6 +10,12 @@ public class Exceptions {
public static final ApiException EMPTY_PROJECT_PARAM = new BadParameterException("project is empty");
public static final ApiException EMPTY_PRIODDATE_PARAM = new BadParameterException("period data is empty");
public static final ApiException NOT_FOUND_REPORT_EXCEPTION = new NotFoundException("not found report");
public static final ApiException NOT_FOUND_TEMPLATE_EXCEPTION = new NotFoundException("not found template");
public static final ApiException REPORT_HAS_COMMIT_EXCEPTION = new AlreadyExistsException("report approval has commit");
public static final ApiException SERVER_ERROR_EXCEPTION= new ServerErrorException("server error exception");
public static final ApiException SERVER_ERROR_EXCEPTION = new ServerErrorException("server error exception");
public static final ApiException TASK_HAS_BEGINNING = new ConflictException("task has beginning ..");
public static final ApiException PROJECT_EMPTY_EXCEPTION = new BadParameterException("projectId is empty");
public static final ApiException PROJECT_PROJECT_EXCEPTION = new NotFoundException("not found project");
public static final ApiException NOT_FOUND_TEMPLATE_GROUP_EXCEPTION = new NotFoundException("not found template group");
public static final ApiException NOT_FOUND_EXCEPTION = new NotFoundException("not found resources");
}
......@@ -20,7 +20,9 @@ import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.dto.vatdto.PeriodResources;
import pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.service.impl.HttpFileService;
import pwc.taxtech.atms.vat.dao.*;
......@@ -63,134 +65,33 @@ public class ReportGeneratorImpl {
private PeriodTemplateMapper periodTemplateMapper;
@Autowired
private DistributedIdService distributedIdService;
@Autowired
private PeriodJobMapper periodJobMapper;
public String generateData(String projectId, List<Long> templateIds, Boolean ifDeleteManualDataSource,
List<String> exceptCellTemplates, Integer periodParam, Optional<String> generator) {
Date createTime = new Date();
int period = periodParam != null ? periodParam : 0;
Project project = projectMapper.selectByPrimaryKey(projectId);
if (templateIds.isEmpty()) templateIds.add(Long.MAX_VALUE);
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andIdIn(templateIds);
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;
PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample();
if (periodTemplateIdList.isEmpty()) periodTemplateIdList.add(Long.MAX_VALUE);
periodCellTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period);
List<PeriodCellTemplate> periodCellTemplateList = periodCellTemplateMapper.selectByExample(periodCellTemplateExample);
PeriodCellTemplateConfigExample periodCellTemplateConfigExample = new PeriodCellTemplateConfigExample();
// only get formula config
periodCellTemplateConfigExample.createCriteria().andProjectIdEqualTo(projectId).andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period);
List<PeriodCellTemplateConfig> periodCellTemplateConfigList =
periodCellTemplateConfigMapper.selectByExample(periodCellTemplateConfigExample);
//Map<String, String> templateCodeAndPath = new HashMap<>();
//periodTemplateList.forEach(a -> templateCodeAndPath.put(a.getCode(), getTemplatePath(a.getPath())));
Optional<Workbook> workbook = createWorkBookWithExcelFileList(periodTemplateList);
if (workbook.isPresent()) {
Workbook newWorkbook = workbook.get();
FormulaContext formulaContext = new FormulaContext();
formulaContext.setFormulaAgent(formulaAgent);
formulaContext.setPeriod(period);
formulaContext.setReportTemplateGroupId(templateGroupId);
formulaContext.setProjectId(project.getId());
formulaContext.setYear(project.getYear());
formulaContext.setIsYear(period == 0);
formulaContext.setIfRound(true);
formulaContext.setOrganizationId(project.getOrganizationId());
formulaContext.setIfRound(true);
addFunctionsToWorkbook(newWorkbook, formulaContext);
int sheetCount = newWorkbook.getNumberOfSheets();
List<Cell> otherFormulaCells = new ArrayList<>();
List<Cell> bbFormulaCells = new ArrayList<>();
for (int i = 0; i < sheetCount; i++) {
Sheet sheet = newWorkbook.getSheetAt(i);
String code = sheet.getSheetName();
Optional<PeriodTemplate> periodTemplate = periodTemplateList.stream()
.filter(a -> a.getCode().equals(code))
.findFirst();
Long templateId;
if (periodTemplate.isPresent()) {
templateId = periodTemplate.get().getTemplateId();
} else {
templateId = 0L;
}
if (templateId > 0) {
//get cell template and cell template config with templateId
Map<PeriodCellTemplate, PeriodCellTemplateConfig> cellTemplatePeriodCellTemplateConfigMap = new HashMap<>();
List<PeriodCellTemplate> tempPeriodCellTemplateList = periodCellTemplateList.stream()
.filter(a -> a.getReportTemplateId().equals(templateId))
.collect(Collectors.toList());
tempPeriodCellTemplateList.forEach(a -> {
Optional<PeriodCellTemplateConfig> tempCellTemplateConfig = periodCellTemplateConfigList.stream()
.filter(item -> item.getCellTemplateId().equals(a.getCellTemplateId())
&& item.getDataSourceType().equals(CellDataSourceType.Formula.getCode()))
.findFirst();
tempCellTemplateConfig.ifPresent(periodCellTemplateConfig ->
cellTemplatePeriodCellTemplateConfigMap.put(a, periodCellTemplateConfig));
});
public FormulaContext initContext(PeriodResources resources, Integer period) {
return FormulaContext.extractContextFromProject(resources.getProject()).fixedFormula(period, resources.getTemplateGroupId(),
formulaAgent);
}
cellTemplatePeriodCellTemplateConfigMap.forEach((k, v) -> {
Row row = sheet.getRow(k.getRowIndex());
if (null == row) {
sheet.createRow(k.getRowIndex());
}
row = sheet.getRow(k.getRowIndex());
public PeriodResources getPeriodResources(String projectId, Integer period, List<Long> templateIds) {
PeriodResources periodResources = new PeriodResources();
periodResources.putAllTemplate(queryPeriodTemplates(projectId, period, templateIds));
periodResources.putAllCellTemplate(queryPeriodCellTemplates(projectId, period, periodResources.getTemolateIds()));
periodResources.putAllCellTemplateConfig(queryPeriodCellTemplateConfigs(projectId, period, periodResources.getTemolateIds()));
periodResources.setProject(projectMapper.selectByPrimaryKey(projectId));
return periodResources;
}
Cell cell = row.getCell(k.getColumnIndex());
if (null == cell) {
row.createCell(k.getColumnIndex());
}
cell = row.getCell(k.getColumnIndex());
//todo:后面单独处理kv的公式
if (StringUtils.isNotBlank(v.getFormula()) && !v.getFormula().contains("@")) {
cell.setCellFormula(v.getFormula());
logger.debug("formula:" + v.getFormula());
if (v.getFormula().startsWith("BB(")) {
bbFormulaCells.add(cell);
} else {
otherFormulaCells.add(cell);
}
//kv 公式处理
} else if (v.getFormula().contains("@")) {
if (StringUtils.isNotBlank(v.getKeyValueParsedFormula())) {
cell.setCellFormula(v.getKeyValueParsedFormula());
logger.debug("formula:" + v.getKeyValueParsedFormula());
otherFormulaCells.add(cell);
}
}
});
}
}
FormulaEvaluator evaluator = newWorkbook.getCreationHelper().createFormulaEvaluator();
otherFormulaCells.stream().forEach(m -> {
evaluator.evaluateFormulaCellEnum(m);
});
bbFormulaCells.stream().forEach(n -> {
evaluator.evaluateFormulaCellEnum(n);
});
public void updateWorkbookCaclsValueToDb(String projectId, Integer period, Workbook workbook, PeriodResources resources, PeriodJob job) {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
String code = sheet.getSheetName();
Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream()
.filter(a -> a.getCode().equals(code))
.findFirst();
try {
//todo:loop all the cell which existing in the cellTemplateConfig, save the data to DB
for (int i = 0; i < sheetCount; i++) {
Sheet sheet = newWorkbook.getSheetAt(i);
String code = sheet.getSheetName();
Optional<PeriodTemplate> periodTemplate = periodTemplateList.stream()
.filter(a -> a.getCode().equals(code))
.findFirst();
Long templateId;
if (periodTemplate.isPresent()) {
templateId = periodTemplate.get().getTemplateId();
......@@ -199,7 +100,6 @@ public class ReportGeneratorImpl {
}
if (templateId > 0) {
//todo: create report into DB
PeriodReport report = new PeriodReport();
Long reportId = distributedIdService.nextId();
report.setId(reportId);
......@@ -207,17 +107,17 @@ public class ReportGeneratorImpl {
report.setPeriod(period);
report.setProjectId(projectId);
report.setCreateBy("Admin");
report.setCreateTime(createTime);
report.setCreateTime(new Date());
report.setUpdateBy("Admin");
report.setUpdateTime(createTime);
report.setUpdateTime(new Date());
report.setProjectId(projectId);
reportMapper.insertSelective(report);
List<PeriodCellTemplateConfig> periodCellTemplateConfigs = periodCellTemplateConfigList.stream()
List<PeriodCellTemplateConfig> periodCellTemplateConfigs = resources.getPeriodCellTemplateConfigs().stream()
.filter(a -> a.getReportTemplateId().equals(templateId) && a.getDataSourceType().equals(CellDataSourceType.Formula.getCode()))
.collect(Collectors.toList());
List<PeriodCellTemplateConfig> keyInCellTemplateConfigs = periodCellTemplateConfigList.stream()
List<PeriodCellTemplateConfig> keyInCellTemplateConfigs = resources.getPeriodCellTemplateConfigs().stream()
.filter(a -> a.getReportTemplateId().equals(templateId) && a.getDataSourceType().equals(CellDataSourceType.KeyIn.getCode()))
.collect(Collectors.toList());
......@@ -237,8 +137,8 @@ public class ReportGeneratorImpl {
dataSource.setAmount(new BigDecimal("0"));
dataSource.setName("ManualDataSource");
dataSource.setDescription("ManualDataSource");
dataSource.setCreateTime(createTime);
dataSource.setUpdateTime(createTime);
dataSource.setCreateTime(new Date());
dataSource.setUpdateTime(new Date());
dataSource.setCreateBy("Admin");
dataSource.setUpdateBy("Admin");
dataSource.setPeriod(period);
......@@ -330,8 +230,8 @@ public class ReportGeneratorImpl {
}
dataSource.setName("ReportDataSource");
dataSource.setDescription(findStr);
dataSource.setCreateTime(createTime);
dataSource.setUpdateTime(createTime);
dataSource.setCreateTime(new Date());
dataSource.setUpdateTime(new Date());
dataSource.setCreateBy("Admin");
dataSource.setUpdateBy("Admin");
dataSource.setPeriod(period);
......@@ -349,7 +249,7 @@ public class ReportGeneratorImpl {
}
}
Optional<PeriodCellTemplate> tempPeriodCellTemplate = periodCellTemplateList.stream()
Optional<PeriodCellTemplate> tempPeriodCellTemplate = resources.getPeriodCellTemplates().stream()
.filter(a -> a.getCellTemplateId().equals(periodCellTemplateConfig.getCellTemplateId()))
.findFirst();
if (tempPeriodCellTemplate.isPresent()) {
......@@ -404,9 +304,9 @@ public class ReportGeneratorImpl {
// cellData.setFormulaExp(EMPTY);
// }
cellData.setCreateBy("Admin");
cellData.setCreateTime(createTime);
cellData.setCreateTime(new Date());
cellData.setUpdateBy("Admin");
cellData.setUpdateTime(createTime);
cellData.setUpdateTime(new Date());
cellData.setProjectId(projectId);
cellData.setPeriod(period);
periodCellDataMapper.insertSelective(cellData);
......@@ -423,8 +323,8 @@ public class ReportGeneratorImpl {
cellDataSource.setCellTemplateId(tempPeriodCellTemplate.get().getCellTemplateId());
cellDataSource.setCellDataId(cellDataId);
cellDataSource.setDataSourceId(dataSource.getId());
cellDataSource.setCreateTime(createTime);
cellDataSource.setUpdateTime(createTime);
cellDataSource.setCreateTime(new Date());
cellDataSource.setUpdateTime(new Date());
cellDataSource.setPeriod(period);
cellDataSource.setProjectId(projectId);
SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource);
......@@ -432,13 +332,132 @@ public class ReportGeneratorImpl {
}
}
}
} catch (Exception e) {
e.printStackTrace();
job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("cacals report for code "+code +" failed");
}finally {
job.setCurrentStep(code);
periodJobMapper.updateByPrimaryKey(job);
}
return "generate report successful";
} else {
return "GenerateReport failed";
}
}
private List<PeriodReport> createReportsByTemplates(Workbook workbook, List<PeriodTemplate> periodTemplateList, String projectId, Integer period) {
List<PeriodReport> reports = new ArrayList<>();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
String code = sheet.getSheetName();
Optional<PeriodTemplate> periodTemplate = periodTemplateList.stream()
.filter(a -> a.getCode().equals(code))
.findFirst();
Long templateId;
if (periodTemplate.isPresent()) {
templateId = periodTemplate.get().getTemplateId();
} else {
templateId = 0L;
}
if (templateId > 0) {
PeriodReport report = new PeriodReport();
Long reportId = distributedIdService.nextId();
report.setId(reportId);
report.setTemplateId(templateId);
report.setPeriod(period);
report.setProjectId(projectId);
report.setCreateBy("Admin");
report.setCreateTime(new Date());
report.setUpdateBy("Admin");
report.setUpdateTime(new Date());
report.setProjectId(projectId);
reportMapper.insertSelective(report);
reports.add(report);
}
}
return reports;
}
public void setConfigAndDataToWorkBook(Workbook workbook, PeriodResources resources) {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
String code = sheet.getSheetName();
Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream()
.filter(a -> a.getCode().equals(code))
.findFirst();
Long templateId;
if (periodTemplate.isPresent()) {
templateId = periodTemplate.get().getTemplateId();
} else {
templateId = 0L;
}
if (templateId > 0) {
//get cell template and cell template config with templateId
Map<PeriodCellTemplate, PeriodCellTemplateConfig> cellTemplatePeriodCellTemplateConfigMap = new HashMap<>();
List<PeriodCellTemplate> tempPeriodCellTemplateList = resources.getPeriodCellTemplates().stream()
.filter(a -> a.getReportTemplateId().equals(templateId))
.collect(Collectors.toList());
tempPeriodCellTemplateList.forEach(a -> {
Optional<PeriodCellTemplateConfig> tempCellTemplateConfig = resources.getPeriodCellTemplateConfigs().stream()
.filter(item -> item.getCellTemplateId().equals(a.getCellTemplateId())
&& item.getDataSourceType().equals(CellDataSourceType.Formula.getCode()))
.findFirst();
tempCellTemplateConfig.ifPresent(periodCellTemplateConfig ->
cellTemplatePeriodCellTemplateConfigMap.put(a, periodCellTemplateConfig));
});
cellTemplatePeriodCellTemplateConfigMap.forEach((k, v) -> {
Row row = sheet.getRow(k.getRowIndex());
if (null == row) {
sheet.createRow(k.getRowIndex());
}
row = sheet.getRow(k.getRowIndex());
Cell cell = row.getCell(k.getColumnIndex());
if (null == cell) {
row.createCell(k.getColumnIndex());
}
cell = row.getCell(k.getColumnIndex());
//todo:后面单独处理kv的公式
if (StringUtils.isNotBlank(v.getFormula()) && !v.getFormula().contains("@")) {
cell.setCellFormula(v.getFormula());
logger.debug("formula:" + v.getFormula());
//kv 公式处理
} else if (v.getFormula().contains("@")) {
if (StringUtils.isNotBlank(v.getKeyValueParsedFormula())) {
cell.setCellFormula(v.getKeyValueParsedFormula());
logger.debug("formula:" + v.getKeyValueParsedFormula());
}
}
});
}
}
}
private List<PeriodTemplate> queryPeriodTemplates(String projectId, Integer period, List<Long> templateIds) {
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andTemplateIdIn(templateIds);
return periodTemplateMapper.selectByExample(periodTemplateExample);
}
private List<PeriodCellTemplate> queryPeriodCellTemplates(String projectId, Integer period, List<Long> periodTemplateIdList) {
PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample();
if (periodTemplateIdList.isEmpty()) periodTemplateIdList.add(Long.MAX_VALUE);
periodCellTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period);
return periodCellTemplateMapper.selectByExample(periodCellTemplateExample);
}
private List<PeriodCellTemplateConfig> queryPeriodCellTemplateConfigs(String projectId, Integer period, List<Long> periodTemplateIdList) {
PeriodCellTemplateConfigExample periodCellTemplateConfigExample = new PeriodCellTemplateConfigExample();
periodCellTemplateConfigExample.createCriteria().andProjectIdEqualTo(projectId).andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period);
return periodCellTemplateConfigMapper.selectByExample(periodCellTemplateConfigExample);
}
private String getTemplatePath(String path) {
String result;
String PREFIX_VALUE = "~";
......@@ -456,7 +475,7 @@ public class ReportGeneratorImpl {
* @param templates 模板code和模板路径 键值对
* @return 工作簿workbook
*/
private Optional<Workbook> createWorkBookWithExcelFileList(List<PeriodTemplate> templates) {
public Workbook createWorkBookByPeriodTemplate(List<PeriodTemplate> templates, PeriodJob periodJob) {
Workbook workbook = new XSSFWorkbook();
try {
String filePath = this.getClass().getResource("").toURI().getPath();
......@@ -492,11 +511,14 @@ public class ReportGeneratorImpl {
}
POIUtil.cloneSheet(tWorkbook.getSheetAt(0), workbook.createSheet(a.getCode()));
});
return Optional.of(workbook);
return workbook;
} catch (Exception e) {
logger.error("createWorkBookWithExcelFileList error.", e);
logger.error("createWorkBookByPeriodTemplate error.", e);
periodJob.setStatus(WrapPeriodJobDto.STATUS_ERROR);
periodJob.setErrorMsg("error for gen excel , redo it later!!1");
periodJobMapper.updateByPrimaryKey(periodJob);
throw Exceptions.SERVER_ERROR_EXCEPTION;
}
return Optional.empty();
}
/**
......@@ -504,12 +526,11 @@ public class ReportGeneratorImpl {
*
* @param workbook 工作簿
*/
private void addFunctionsToWorkbook(Workbook workbook, FormulaContext formulaContext) {
String[] functionNames = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "ProjectContext", "JXFPMX", "JXFP"};
public void addFunctionsAndContext(Workbook workbook, String[] functions, FormulaContext formulaContext) {
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext),
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new ProjectContext(formulaContext)
, new JXFPMX(formulaContext), new JXFP(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functionNames, functionImpls);
UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls);
UDFFinder udfToolpack = new AggregatingUDFFinder(udfs);
workbook.addToolPack(udfToolpack);
}
......
......@@ -3,21 +3,24 @@ package pwc.taxtech.atms.vat.service.impl;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Workbook;
import org.reflections.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pwc.taxtech.atms.common.CommonUtils;
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.enums.*;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.NotSupportedException;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.NotFoundException;
import pwc.taxtech.atms.service.impl.CellConfigTranslater;
import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.vat.dao.*;
......@@ -25,10 +28,14 @@ import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto;
import pwc.taxtech.atms.vat.dpo.DataSourceExtendDto;
import pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaContext;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper;
import java.io.File;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
......@@ -36,6 +43,8 @@ import java.util.stream.Collectors;
@Component
public class ReportServiceImpl {
private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>();
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "ProjectContext", "JXFPMX", "JXFP"};
@Autowired
private ReportGeneratorImpl reportGenerator;
......@@ -89,6 +98,8 @@ public class ReportServiceImpl {
private ProjectMapper projectMapper;
@Autowired
private DistributedIdService distributedIdService;
@Autowired
private PeriodJobMapper periodJobMapper;
public OperationResultDto<List<ReportDto>> getReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) {
int period = periodParam != null ? periodParam : 0;
......@@ -248,226 +259,207 @@ public class ReportServiceImpl {
}
public OperationResultDto updateConfig(String projectId, Integer period, Boolean ifDeleteManualDataSource,
String generator, Boolean isMergeManualData) {
OperationResultDto result = new OperationResultDto();
private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) {
try {
if (period == null) {
result.setResultMsg("peirod is null");
return result;
}
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
Project project = projectMapper.selectByPrimaryKey(projectId);
copyTemplateAndConfigFromAdmin(projectId, templates, period);
} catch (Exception ex) {
job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("error update config with projectId " + projectId + " period" + period);
periodJobMapper.updateByPrimaryKey(job);
logger.error(ex.getMessage(), ex);
}
}
if (project == null) {
result.setResultMsg("NoProject");
return result;
}
private List<Template> getTemplatesByProjectId(String projectId) {
MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_PROJECT_EXCEPTION);
Project project = projectMapper.selectByPrimaryKey(projectId);
MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION);
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
// String strExceptTemplateIds = StringUtils.EMPTY;
// if (exceptTemplateIds != null && exceptTemplateIds.size() > 0) {
// strExceptTemplateIds = StringUtils.join(exceptTemplateIds, ",");
// } else {
// strExceptTemplateIds = "''";
// }
//todo: according to projectId get the templateGroupId
Long templateGroupId = projectMapper.getTemplateGroupIdByProject(projectId, EnumServiceType.VAT.getCode());
if (templateGroupId != null && templateGroupId != 0) {
// 先进行数据清理,包括period开头的所有报表配置表 条件Period
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
// 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample example = new TemplateExample();
example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId);
List<Template> templates = templateMapper.selectByExample(example);
List<PeriodTemplate> periodTemplateList = new ArrayList<>();
int i = 0;
Long startTimeOut = System.currentTimeMillis();
logger.debug("templates copy start: " + startTimeOut);
for (Template template : templates) {
i++;
Long startTime = System.currentTimeMillis();
logger.debug("template copy start: " + startTime);
PeriodTemplate periodTemplate = new PeriodTemplate();
CommonUtils.copyProperties(template, periodTemplate);
periodTemplate.setId(distributedIdService.nextId());
periodTemplate.setPeriod(period);
periodTemplate.setName(template.getName());
periodTemplate.setCode(template.getCode());
periodTemplate.setPath(template.getPath());
periodTemplate.setReportType(template.getReportType());
periodTemplate.setTemplateGroupId(template.getTemplateGroupId());
periodTemplate.setOrderIndex(template.getOrderIndex());
periodTemplate.setCreateTime(template.getCreateTime());
periodTemplate.setUpdateTime(template.getUpdateTime());
periodTemplate.setIsSystemType(template.getIsSystemType());
periodTemplate.setIsActiveAssociation(template.getIsActiveAssociation());
periodTemplate.setParentId(Utils.isEmpty(template.getParentId()) ? null : template.getParentId());
periodTemplate.setTemplateId(template.getId());
periodTemplate.setCreateBy(Utils.isEmpty(template.getCreateBy()) ? "admin" : template.getCreateBy());
periodTemplate.setUpdateBy(Utils.isEmpty(template.getUpdateBy()) ? "admin" : template.getUpdateBy());
periodTemplate.setProjectId(projectId);
periodTemplateList.add(periodTemplate);
logger.debug("template copy end,used time: " + (System.currentTimeMillis() - startTime) + " ms");
}
logger.debug("templates copy end,used: " + (System.currentTimeMillis() - startTimeOut) + " ms, copy: " + i + " items");
List<Long> templateIdList = periodTemplateList.stream().map(PeriodTemplate::getTemplateId).collect(Collectors.toList());
CellTemplateExample cellTemplateExample = new CellTemplateExample();
cellTemplateExample.createCriteria().andReportTemplateIdIn(templateIdList);
List<CellTemplate> cellTemplateList = cellTemplateMapper.selectByExample(cellTemplateExample);
List<PeriodCellTemplate> periodCellTemplateList = new ArrayList<>();
i = 0;
startTimeOut = System.currentTimeMillis();
logger.debug("cellTemplates copy start: " + startTimeOut);
for (CellTemplate cellTemplate : cellTemplateList) {
i++;
Long startTime = System.currentTimeMillis();
//logger.debug("celltemplate copy start: " + startTime);
PeriodCellTemplate periodCellTemplate = new PeriodCellTemplate();
CommonUtils.copyProperties(cellTemplate, periodCellTemplate);
periodCellTemplate.setId(distributedIdService.nextId());
periodCellTemplate.setPeriod(period);
periodCellTemplate.setReportTemplateId(cellTemplate.getReportTemplateId());
periodCellTemplate.setRowIndex(cellTemplate.getRowIndex());
periodCellTemplate.setRowName(cellTemplate.getRowName());
periodCellTemplate.setColumnIndex(cellTemplate.getColumnIndex());
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(Utils.isEmpty(cellTemplate.getCreateBy()) ? "admin" : cellTemplate.getCreateBy());
periodCellTemplate.setUpdateBy(Utils.isEmpty(cellTemplate.getUpdateBy()) ? "admin" : cellTemplate.getUpdateBy());
periodCellTemplate.setProjectId(projectId);
periodCellTemplateList.add(periodCellTemplate);
//logger.debug("celltemplate copy end,used time: " + (System.currentTimeMillis() - startTime) + " ms");
Long templateGroupId = projectMapper.getTemplateGroupIdByProject(projectId, EnumServiceType.VAT.getCode());
MyAsserts.assertNotNull(templateGroupId, Exceptions.NOT_FOUND_TEMPLATE_GROUP_EXCEPTION);
List<Template> templates = queryTemplateByGroup(templateGroupId);
MyAsserts.assertNotEmpty(templates, Exceptions.NOT_FOUND_TEMPLATE_EXCEPTION);
templates.sort(Comparator.comparing(Template::getOrderIndex));
return templates;
}
private void copyPeriodConfigFromCellTemplateConfig(String projectId, Long templateId, Integer period) {
CellTemplateConfigExample cellTemplateConfigExample = new CellTemplateConfigExample();
cellTemplateConfigExample.createCriteria().andReportTemplateIdEqualTo(templateId);
List<CellTemplateConfig> cellTemplateConfigList = cellTemplateConfigMapper.selectByExample(cellTemplateConfigExample);
if (cellTemplateConfigList.isEmpty()) return;
List<PeriodCellTemplateConfig> periodCellTemplateConfigList = new ArrayList<>();
for (CellTemplateConfig cellTemplateConfig : cellTemplateConfigList) {
PeriodCellTemplateConfig periodCellTemplateConfig = new PeriodCellTemplateConfig();
CommonUtils.copyProperties(cellTemplateConfig, periodCellTemplateConfig);
periodCellTemplateConfig.setId(distributedIdService.nextId());
periodCellTemplateConfig.setPeriod(period);
periodCellTemplateConfig.setCellTemplateId(cellTemplateConfig.getCellTemplateId());
periodCellTemplateConfig.setReportTemplateId(templateId);
periodCellTemplateConfig.setDataSourceType(cellTemplateConfig.getDataSourceType());
periodCellTemplateConfig.setFormula(Utils.isEmpty(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(Utils.isEmpty(cellTemplateConfig.getCreateBy()) ? "admin" : cellTemplateConfig.getCreateBy());
periodCellTemplateConfig.setCreateTime(cellTemplateConfig.getCreateTime());
periodCellTemplateConfig.setUpdateBy(Utils.isEmpty(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);
periodCellTemplateConfigList.add(periodCellTemplateConfig);
}
periodCellTemplateConfigMapper.batchInsert(periodCellTemplateConfigList);
}
private void fixedAccountCode(PeriodCellTemplateConfig pctc) {
if (StringUtils.isNotBlank(pctc.getAccountCodes())) {
String[] acctCodes = pctc.getAccountCodes().split(",");
EnterpriseAccountExample enterpriseAccountExample = new EnterpriseAccountExample();
enterpriseAccountExample.createCriteria().andStdCodeIn(Arrays.asList(acctCodes));
List<EnterpriseAccount> enterpriseAccounts = enterpriseAccountMapper.selectByExample(enterpriseAccountExample);
if (!enterpriseAccounts.isEmpty()) {
List<String> acctCodeList = enterpriseAccounts.stream().map(EnterpriseAccount::getCode).collect(Collectors.toList());
StringBuilder codes = new StringBuilder();
for (String code : acctCodeList) {
codes.append(code).append(",");
}
logger.debug("templates copy end,used: " + (System.currentTimeMillis() - startTimeOut) + " ms, copy: " + i + " items");
List<Long> cellTemplateIdList = periodCellTemplateList.stream().map(PeriodCellTemplate::getCellTemplateId).collect(Collectors.toList());
CellTemplateConfigExample cellTemplateConfigExample = new CellTemplateConfigExample();
List<List<Long>> lists = CommonUtils.subListWithLen(cellTemplateIdList,1000);
CellTemplateConfigExample.Criteria c = cellTemplateConfigExample.createCriteria();
c.andReportTemplateIdIn(templateIdList).andCellTemplateIdIn(lists.get(0));
List<CellTemplateConfig> cellTemplateConfigList = cellTemplateConfigMapper.selectByExample(cellTemplateConfigExample);
for(int j = 1; j < lists.size(); j++){
CellTemplateConfigExample cellTemplateConfigExample1 = new CellTemplateConfigExample();
CellTemplateConfigExample.Criteria c1 = cellTemplateConfigExample1.createCriteria();
c.andReportTemplateIdIn(templateIdList).andCellTemplateIdIn(lists.get(j));
cellTemplateConfigList.addAll(cellTemplateConfigMapper.selectByExample(cellTemplateConfigExample1));
pctc.setAccountCodes(StringUtils.removeEnd(codes.toString(), ","));
}
}
}
private void fixedParsedFormula(PeriodCellTemplateConfig pctc) {
if (pctc.getFormula() != null && pctc.getFormula().contains("@")) {
String regex = "@[0-9A-Z.]+";
Pattern pp = Pattern.compile(regex);
Matcher mm = pp.matcher(pctc.getFormula());
String replace_result = pctc.getFormula();
Boolean replace = true;
while (mm.find()) {
KeyValueConfigExample keyValueConfigExample = new KeyValueConfigExample();
keyValueConfigExample.createCriteria().andKeyCodeEqualTo(StringUtils.removeStart(mm.group(), "@"));
Optional<KeyValueConfig> keyValueConfig = keyValueConfigMapper.selectByExample(keyValueConfigExample).stream().findFirst();
if (keyValueConfig.isPresent() && StringUtils.isNotBlank(keyValueConfig.get().getFormula())) {
replace_result = replace_result.replace(mm.group(), keyValueConfig.get().getFormula());
} else {
replace = false;
}
// List<CellTemplateConfig> cellTemplateConfigList = cellTemplateConfigMapper.selectByExample(cellTemplateConfigExample);
List<PeriodCellTemplateConfig> periodCellTemplateConfigList = new ArrayList<>();
i = 0;
startTimeOut = System.currentTimeMillis();
logger.debug("cellTemplateConfigs copy start:" + startTimeOut);
for (CellTemplateConfig cellTemplateConfig : cellTemplateConfigList) {
i++;
Long startTime = System.currentTimeMillis();
//logger.debug("cellTemplateConfig copy start: " + startTime);
PeriodCellTemplateConfig periodCellTemplateConfig = new PeriodCellTemplateConfig();
CommonUtils.copyProperties(cellTemplateConfig, periodCellTemplateConfig);
periodCellTemplateConfig.setId(distributedIdService.nextId());
periodCellTemplateConfig.setPeriod(period);
periodCellTemplateConfig.setCellTemplateId(cellTemplateConfig.getCellTemplateId());
periodCellTemplateConfig.setReportTemplateId(cellTemplateConfig.getReportTemplateId());
periodCellTemplateConfig.setDataSourceType(cellTemplateConfig.getDataSourceType());
periodCellTemplateConfig.setFormula(Utils.isEmpty(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(Utils.isEmpty(cellTemplateConfig.getCreateBy()) ? "admin" : cellTemplateConfig.getCreateBy());
periodCellTemplateConfig.setCreateTime(cellTemplateConfig.getCreateTime());
periodCellTemplateConfig.setUpdateBy(Utils.isEmpty(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);
if (cellTemplateConfig.getFormula() != null && cellTemplateConfig.getFormula().contains("@")) {
String regex = "@[0-9A-Z.]+";
Pattern pp = Pattern.compile(regex);
Matcher mm = pp.matcher(cellTemplateConfig.getFormula());
String replace_result = cellTemplateConfig.getFormula();
Boolean replace = true;
while (mm.find()) {
KeyValueConfigExample keyValueConfigExample = new KeyValueConfigExample();
keyValueConfigExample.createCriteria().andKeyCodeEqualTo(StringUtils.removeStart(mm.group(), "@"));
Optional<KeyValueConfig> keyValueConfig = keyValueConfigMapper.selectByExample(keyValueConfigExample).stream().findFirst();
if (keyValueConfig.isPresent() && StringUtils.isNotBlank(keyValueConfig.get().getFormula())) {
replace_result = replace_result.replace(mm.group(), keyValueConfig.get().getFormula());
} else {
replace = false;
}
}
}
if (replace) {
periodCellTemplateConfig.setKeyValueParsedFormula(replace_result);
}
//todo: get the keyvalue from table add to keyvalue parsed formula
// KeyValueConfigExample keyValueConfigExample = new KeyValueConfigExample();
if (replace) {
pctc.setKeyValueParsedFormula(replace_result);
}
//todo: get the keyvalue from table add to keyvalue parsed formula
// KeyValueConfigExample skeyValueConfigExample = new KeyValueConfigExample();
// keyValueConfigExample.createCriteria().andKeyCodeEqualTo(StringUtils.removeStart(cellTemplateConfig.getFormula(), "@"));
// Optional<KeyValueConfig> keyValueConfig = keyValueConfigMapper.selectByExample(keyValueConfigExample).stream().findFirst();
// if (keyValueConfig.isPresent()) {
// periodCellTemplateConfig.setKeyValueParsedFormula(keyValueConfig.get().getFormula());
// }
}
periodCellTemplateConfigList.add(periodCellTemplateConfig);
//logger.debug("cellTemplateConfig copy end,used time: " + (System.currentTimeMillis() - startTime) + " ms");
}
logger.debug("cellTemplateConfigs copy end,used: " + (System.currentTimeMillis() - startTimeOut) + " ms, copy: " + i + " items");
if (periodCellTemplateConfigList != null) {
periodCellTemplateConfigList.forEach(a -> {
if (StringUtils.isNotBlank(a.getAccountCodes())) {
String[] acctCodes = a.getAccountCodes().split(",");
EnterpriseAccountExample enterpriseAccountExample = new EnterpriseAccountExample();
enterpriseAccountExample.createCriteria().andStdCodeIn(Arrays.asList(acctCodes));
List<EnterpriseAccount> enterpriseAccounts = enterpriseAccountMapper.selectByExample(enterpriseAccountExample);
if (!enterpriseAccounts.isEmpty()) {
List<String> acctCodeList = enterpriseAccounts.stream().map(EnterpriseAccount::getCode).collect(Collectors.toList());
StringBuilder codes = new StringBuilder();
for (String code : acctCodeList) {
codes.append(code).append(",");
}
a.setAccountCodes(StringUtils.removeEnd(codes.toString(), ","));
}
}
});
}
}
}
//todo: save config data to DB
periodTemplateMapper.batchInsert(periodTemplateList);
periodCellTemplateMapper.batchInsert(periodCellTemplateList);
periodCellTemplateConfigMapper.batchInsert(periodCellTemplateConfigList);
} else {
result.setResult(true);
result.setResultMsg("there is no templateGroup");
return result;
}
result.setResult(true);
} catch (Exception ex) {
result.setResult(false);
logger.error(ex.getMessage(), ex);
private void copyPeriodCellTemplateFromCellTemplate(String projectId, Long templateId, Integer period) {
CellTemplateExample cellTemplateExample = new CellTemplateExample();
cellTemplateExample.createCriteria().andReportTemplateIdEqualTo(templateId);
List<CellTemplate> cellTemplateList = cellTemplateMapper.selectByExample(cellTemplateExample);
List<PeriodCellTemplate> periodCellTemplateList = new ArrayList<>();
for (CellTemplate cellTemplate : cellTemplateList) {
PeriodCellTemplate periodCellTemplate = new PeriodCellTemplate();
CommonUtils.copyProperties(cellTemplate, periodCellTemplate);
periodCellTemplate.setId(distributedIdService.nextId());
periodCellTemplate.setPeriod(period);
periodCellTemplate.setReportTemplateId(templateId);
periodCellTemplate.setRowIndex(cellTemplate.getRowIndex());
periodCellTemplate.setRowName(cellTemplate.getRowName());
periodCellTemplate.setColumnIndex(cellTemplate.getColumnIndex());
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(Utils.isEmpty(cellTemplate.getCreateBy()) ? "admin" : cellTemplate.getCreateBy());
periodCellTemplate.setUpdateBy(Utils.isEmpty(cellTemplate.getUpdateBy()) ? "admin" : cellTemplate.getUpdateBy());
periodCellTemplate.setProjectId(projectId);
periodCellTemplateList.add(periodCellTemplate);
}
periodCellTemplateMapper.batchInsert(periodCellTemplateList);
}
private List<Template> queryTemplateByGroup(Long templateGroupId) {
TemplateExample example = new TemplateExample();
example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId).andIsActiveAssociationEqualTo(true);
return templateMapper.selectByExample(example);
}
private void copyTemplateAndConfigFromAdmin(String projectId, List<Template> templates, Integer period) {
List<PeriodTemplate> periodTemplateList = new ArrayList<>();
for (Template template : templates) {
Long startTime = System.currentTimeMillis();
logger.debug("template copy start: " + startTime);
PeriodTemplate periodTemplate = new PeriodTemplate();
CommonUtils.copyProperties(template, periodTemplate);
periodTemplate.setId(distributedIdService.nextId());
periodTemplate.setPeriod(period);
periodTemplate.setName(template.getName());
periodTemplate.setCode(template.getCode());
periodTemplate.setPath(template.getPath());
periodTemplate.setReportType(template.getReportType());
periodTemplate.setTemplateGroupId(template.getTemplateGroupId());
periodTemplate.setOrderIndex(template.getOrderIndex());
periodTemplate.setCreateTime(template.getCreateTime());
periodTemplate.setUpdateTime(template.getUpdateTime());
periodTemplate.setIsSystemType(template.getIsSystemType());
periodTemplate.setIsActiveAssociation(template.getIsActiveAssociation());
periodTemplate.setParentId(Utils.isEmpty(template.getParentId()) ? null : template.getParentId());
periodTemplate.setTemplateId(template.getId());
periodTemplate.setCreateBy(Utils.isEmpty(template.getCreateBy()) ? "admin" : template.getCreateBy());
periodTemplate.setUpdateBy(Utils.isEmpty(template.getUpdateBy()) ? "admin" : template.getUpdateBy());
periodTemplate.setProjectId(projectId);
periodTemplateList.add(periodTemplate);
copyPeriodCellTemplateFromCellTemplate(projectId, template.getId(), period);
copyPeriodConfigFromCellTemplateConfig(projectId, template.getId(), period);
}
return result;
periodTemplateMapper.batchInsert(periodTemplateList);
}
public OperationResultDto generateData(String projectId, EnumServiceType serviceType, Boolean ifDeleteManualDataSource,
public OperationResultDto generateData(String projectId, EnumServiceType serviceType, Boolean isMergeManualData,
Integer periodParam, Integer reportType, Optional<String> generator) {
OperationResultDto operationResultDto = new OperationResultDto();
try {
......@@ -476,46 +468,39 @@ public class ReportServiceImpl {
return operationResultDto;
}
if (serviceType != EnumServiceType.VAT) {
// 暂不支持非CIT/VAT service批量后端生成报表
throw new NotSupportedException();
}
MyAsserts.assertEq(serviceType, EnumServiceType.VAT, new NotFoundException());
PeriodJobExample example = new PeriodJobExample();
example.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(periodParam)
.andStatusEqualTo(WrapPeriodJobDto.STATUS_BEGIN);
MyAsserts.assertEmpty(periodJobMapper.selectByExample(example), Exceptions.TASK_HAS_BEGINNING);
int period = periodParam;
String serviceTypeStr = serviceType.getCode().toString();
ProjectServiceTypeExample projectServiceTypeExample = new ProjectServiceTypeExample();
projectServiceTypeExample.createCriteria().andServiceTypeIdEqualTo(serviceTypeStr).andProjectIdEqualTo(projectId);
Optional<Long> templateGroupId = projectServiceTypeMapper.selectByExample(projectServiceTypeExample).stream()
.map(ProjectServiceType::getTemplateGroupId).findFirst();
if (templateGroupId == null) {
operationResultDto.setResultMsg("TemplateGroupNotExist");
return operationResultDto;
}
List<Template> templates = getTemplatesByProjectId(projectId);
List<Long> templateIds;
if (reportType != null) {
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria()
.andTemplateGroupIdEqualTo(templateGroupId.get())
.andProjectIdEqualTo(projectId)
.andPeriodEqualTo(period)
.andIsActiveAssociationEqualTo(true)
.andReportTypeEqualTo(reportType);
templateIds = periodTemplateMapper.selectByExample(periodTemplateExample).stream().map(PeriodTemplate::getId).collect(Collectors.toList());
} else {
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andTemplateGroupIdEqualTo(templateGroupId.get())
.andProjectIdEqualTo(projectId)
.andPeriodEqualTo(period).andIsActiveAssociationEqualTo(true);
templateIds = periodTemplateMapper.selectByExample(periodTemplateExample).stream().map(PeriodTemplate::getId).collect(Collectors.toList());
}
PeriodJob genJob = WrapPeriodJobDto.createReportGenJob(projectId, periodParam, templates);
periodJobMapper.insert(genJob);
new Thread(new Runnable() {
@Override
public void run() {
updateConfig(projectId, periodParam, isMergeManualData, templates, genJob);
String rslt = reportGenerator.generateData(projectId, templateIds, ifDeleteManualDataSource, null, periodParam, generator);
if (StringUtils.isBlank(rslt)) {
operationResultDto.setResultMsg("ReportGenerateFailed!");
return operationResultDto;
}
PeriodResources resources = reportGenerator.getPeriodResources(projectId, periodParam,
templates.stream().map(Template::getId).collect(Collectors.toList()));
Workbook workbook = reportGenerator.createWorkBookByPeriodTemplate(resources.getPeriodTemplates(), genJob);
reportGenerator.addFunctionsAndContext(workbook, functions, reportGenerator.initContext(resources, periodParam));
reportGenerator.setConfigAndDataToWorkBook(workbook, resources);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, genJob);
genJob.setStatus(WrapPeriodJobDto.STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob);
}
}).start();
operationResultDto.setData(genJob);
operationResultDto.setResult(true);
} catch (Exception ex) {
operationResultDto.setResult(false);
......@@ -1229,4 +1214,27 @@ public class ReportServiceImpl {
public Boolean hasManualDataSource(String projectId, Integer period) {
return periodReportMapper.hasManualDataSource(projectId, period) > 0;
}
public String export(String reportData, String serverPath) {
String filePath = String.format("GeneratedReports\tt_{0}.xlsx", UUID.randomUUID().toString());
String fullFilePath = combine(serverPath, filePath);
com.grapecity.documents.excel.Workbook workbook = new com.grapecity.documents.excel.Workbook();
workbook.fromJson(reportData);
workbook.save(fullFilePath);
return filePath;
}
private String combine(String parent, String child) {
return String.format("%s" + File.separator + "%s", parent, child);
}
public PeriodJob getRunningJob(String projectId, Integer period) {
return periodJobMapper.getRunningJob(projectId, period);
}
public PeriodJob getJobStatus(String projectId, Integer period, String jobId) {
PeriodJob job = periodJobMapper.getJobStatus(projectId, period, jobId);
MyAsserts.assertNotNull(job, Exceptions.NOT_FOUND_EXCEPTION);
return job;
}
}
......@@ -2,10 +2,7 @@ package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.WorkbookEvaluator;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.StringEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.eval.*;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -40,8 +37,8 @@ public class BB extends FunctionBase implements FreeRefFunction {
} catch (Exception e) {
if (e instanceof FormulaException)
LOGGER.warn("Formula Exception || {}", e.getMessage());
else
e.printStackTrace();
e.printStackTrace();
return defaultEval;
}
}
......@@ -95,10 +92,18 @@ public class BB extends FunctionBase implements FreeRefFunction {
Field evaluatorField = OperationEvaluationContext.class.getDeclaredField("_bookEvaluator");
evaluatorField.setAccessible(true);
WorkbookEvaluator evaluator = (WorkbookEvaluator) evaluatorField.get(ec);
ValueEval eval = evaluator.evaluate(ec.getWorkbook().getSheet(ec.getWorkbook().getSheetIndex(bo.getReportCode()))
int index = ec.getWorkbook().getSheetIndex(bo.getReportCode());
if (index < 0) logger.warn("not found sheet code {}", bo.getReportCode());
ValueEval eval = evaluator.evaluate(ec.getWorkbook().getSheet(index)
.getCell(bo.getRowIndex() - 1, bo.getColumnIndex() - 1));
bo.putPeriodCellTempate(formulaContext.getPeriod(), Long.parseLong(cellTemplateData.getCellTemplateId()));
if (eval instanceof ErrorEval) {
LOGGER.warn("error eval for bb {} and error code {} and error String {}", bo.toString(),
((ErrorEval) eval).getErrorCode(), ((ErrorEval) eval).getErrorString());
}
cellValue = new BigDecimal(OperandResolver.coerceValueToDouble(eval));
nullCellDto.extractFromGroup(bo, formulaContext.getPeriod(), formulaContext.getYear(), cellTemplateData);
......
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.service.impl.report.functions;
import lombok.Getter;
import lombok.Setter;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.vat.service.impl.FormulaAgent;
@Setter
......@@ -36,4 +37,22 @@ public class FormulaContext {
private FormulaAgent formulaAgent;
//private Map<String, FormulaResult> replaceSpecialCellFormulaDic;
public static FormulaContext extractContextFromProject(Project project){
FormulaContext formulaContext = new FormulaContext();
formulaContext.setProjectId(project.getId());
formulaContext.setYear(project.getYear());
formulaContext.setIfRound(true);
formulaContext.setOrganizationId(project.getOrganizationId());
formulaContext.setIfRound(true);
return formulaContext;
}
public FormulaContext fixedFormula(Integer period,Long reportTemplateGroupId,FormulaAgent agent){
this.period=period;
this.formulaAgent=agent;
this.reportTemplateGroupId=reportTemplateGroupId;
this.isYear=(period==0);
return this;
}
}
......@@ -228,5 +228,11 @@
<columnOverride column="YEAR" javaType="java.lang.Integer" />
</table>
<table tableName="PERIOD_JOB" schema="tax_admin" domainObjectName="PeriodJob">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
<columnOverride column="PERIOD" javaType="java.lang.Integer" />
</table>
</context>
</generatorConfiguration>
\ No newline at end of file
package pwc.taxtech.atms.vat.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.PeriodJob;
import pwc.taxtech.atms.vat.entity.PeriodJobExample;
@Mapper
public interface PeriodJobMapper extends MyVatMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
long countByExample(PeriodJobExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
int deleteByExample(PeriodJobExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
int deleteByPrimaryKey(String id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
int insert(PeriodJob record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
int insertSelective(PeriodJob record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
List<PeriodJob> selectByExampleWithRowbounds(PeriodJobExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
List<PeriodJob> selectByExample(PeriodJobExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
PeriodJob selectByPrimaryKey(String id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") PeriodJob record, @Param("example") PeriodJobExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
int updateByExample(@Param("record") PeriodJob record, @Param("example") PeriodJobExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(PeriodJob record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
int updateByPrimaryKey(PeriodJob record);
@Select("SELECT " +
" ID AS id, " +
" NAME AS name, " +
" CURRENT_STEP AS currentStep, " +
" PROJECT_ID AS projectId, " +
" PERIOD AS period, " +
" STEPS_CODE AS stepsCode, " +
" CREATE_TIME AS createTime, " +
" STATUS AS status, " +
" ERROR_MSG AS errorMsg " +
"FROM " +
" PERIOD_JOB " +
"WHERE " +
" STATUS = 'Begin' " +
" AND PROJECT_ID = #{projectId} " +
" AND PERIOD =#{period}")
PeriodJob getRunningJob(@Param("projectId") String projectId, @Param("period") Integer period);
@Select("SELECT " +
" ID AS id, " +
" NAME AS name, " +
" CURRENT_STEP AS currentStep, " +
" PROJECT_ID AS projectId, " +
" PERIOD AS period, " +
" STEPS_CODE AS stepsCode, " +
" CREATE_TIME AS createTime, " +
" STATUS AS status, " +
" ERROR_MSG AS errorMsg " +
"FROM " +
" PERIOD_JOB " +
"WHERE " +
" PROJECT_ID = #{projectId} " +
" AND PERIOD =#{period} " +
" AND ID = #{id}")
PeriodJob getJobStatus(@Param("projectId") String projectId, @Param("period") Integer period,@Param("id") String id);
}
\ No newline at end of file
package pwc.taxtech.atms.vat.entity;
import java.io.Serializable;
import java.util.Date;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated do_not_delete_during_merge
*/
public class PeriodJob implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_JOB.ID
*
* @mbg.generated
*/
private String id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_JOB.NAME
*
* @mbg.generated
*/
private String name;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_JOB.CURRENT_STEP
*
* @mbg.generated
*/
private String currentStep;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_JOB.PROJECT_ID
*
* @mbg.generated
*/
private String projectId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_JOB.PERIOD
*
* @mbg.generated
*/
private Integer period;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_JOB.STEPS_CODE
*
* @mbg.generated
*/
private String stepsCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_JOB.CREATE_TIME
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_JOB.STATUS
*
* @mbg.generated
*/
private String status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_JOB.ERROR_MSG
*
* @mbg.generated
*/
private String errorMsg;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_JOB.ID
*
* @return the value of TAX_ADMIN.PERIOD_JOB.ID
*
* @mbg.generated
*/
public String getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_JOB.ID
*
* @param id the value for TAX_ADMIN.PERIOD_JOB.ID
*
* @mbg.generated
*/
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_JOB.NAME
*
* @return the value of TAX_ADMIN.PERIOD_JOB.NAME
*
* @mbg.generated
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_JOB.NAME
*
* @param name the value for TAX_ADMIN.PERIOD_JOB.NAME
*
* @mbg.generated
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_JOB.CURRENT_STEP
*
* @return the value of TAX_ADMIN.PERIOD_JOB.CURRENT_STEP
*
* @mbg.generated
*/
public String getCurrentStep() {
return currentStep;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_JOB.CURRENT_STEP
*
* @param currentStep the value for TAX_ADMIN.PERIOD_JOB.CURRENT_STEP
*
* @mbg.generated
*/
public void setCurrentStep(String currentStep) {
this.currentStep = currentStep == null ? null : currentStep.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_JOB.PROJECT_ID
*
* @return the value of TAX_ADMIN.PERIOD_JOB.PROJECT_ID
*
* @mbg.generated
*/
public String getProjectId() {
return projectId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_JOB.PROJECT_ID
*
* @param projectId the value for TAX_ADMIN.PERIOD_JOB.PROJECT_ID
*
* @mbg.generated
*/
public void setProjectId(String projectId) {
this.projectId = projectId == null ? null : projectId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_JOB.PERIOD
*
* @return the value of TAX_ADMIN.PERIOD_JOB.PERIOD
*
* @mbg.generated
*/
public Integer getPeriod() {
return period;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_JOB.PERIOD
*
* @param period the value for TAX_ADMIN.PERIOD_JOB.PERIOD
*
* @mbg.generated
*/
public void setPeriod(Integer period) {
this.period = period;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_JOB.STEPS_CODE
*
* @return the value of TAX_ADMIN.PERIOD_JOB.STEPS_CODE
*
* @mbg.generated
*/
public String getStepsCode() {
return stepsCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_JOB.STEPS_CODE
*
* @param stepsCode the value for TAX_ADMIN.PERIOD_JOB.STEPS_CODE
*
* @mbg.generated
*/
public void setStepsCode(String stepsCode) {
this.stepsCode = stepsCode == null ? null : stepsCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_JOB.CREATE_TIME
*
* @return the value of TAX_ADMIN.PERIOD_JOB.CREATE_TIME
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_JOB.CREATE_TIME
*
* @param createTime the value for TAX_ADMIN.PERIOD_JOB.CREATE_TIME
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_JOB.STATUS
*
* @return the value of TAX_ADMIN.PERIOD_JOB.STATUS
*
* @mbg.generated
*/
public String getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_JOB.STATUS
*
* @param status the value for TAX_ADMIN.PERIOD_JOB.STATUS
*
* @mbg.generated
*/
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_JOB.ERROR_MSG
*
* @return the value of TAX_ADMIN.PERIOD_JOB.ERROR_MSG
*
* @mbg.generated
*/
public String getErrorMsg() {
return errorMsg;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_JOB.ERROR_MSG
*
* @param errorMsg the value for TAX_ADMIN.PERIOD_JOB.ERROR_MSG
*
* @mbg.generated
*/
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg == null ? null : errorMsg.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", currentStep=").append(currentStep);
sb.append(", projectId=").append(projectId);
sb.append(", period=").append(period);
sb.append(", stepsCode=").append(stepsCode);
sb.append(", createTime=").append(createTime);
sb.append(", status=").append(status);
sb.append(", errorMsg=").append(errorMsg);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package pwc.taxtech.atms.vat.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class PeriodJobExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public PeriodJobExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("ID is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("ID is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("ID =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("ID <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("ID >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("ID >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("ID <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("ID <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("ID like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("ID not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("ID in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("ID not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("ID between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("ID not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("\"NAME\" is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("\"NAME\" is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("\"NAME\" =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("\"NAME\" <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("\"NAME\" >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("\"NAME\" >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("\"NAME\" <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("\"NAME\" <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("\"NAME\" like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("\"NAME\" not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("\"NAME\" in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("\"NAME\" not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("\"NAME\" between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("\"NAME\" not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andCurrentStepIsNull() {
addCriterion("CURRENT_STEP is null");
return (Criteria) this;
}
public Criteria andCurrentStepIsNotNull() {
addCriterion("CURRENT_STEP is not null");
return (Criteria) this;
}
public Criteria andCurrentStepEqualTo(String value) {
addCriterion("CURRENT_STEP =", value, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepNotEqualTo(String value) {
addCriterion("CURRENT_STEP <>", value, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepGreaterThan(String value) {
addCriterion("CURRENT_STEP >", value, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepGreaterThanOrEqualTo(String value) {
addCriterion("CURRENT_STEP >=", value, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepLessThan(String value) {
addCriterion("CURRENT_STEP <", value, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepLessThanOrEqualTo(String value) {
addCriterion("CURRENT_STEP <=", value, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepLike(String value) {
addCriterion("CURRENT_STEP like", value, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepNotLike(String value) {
addCriterion("CURRENT_STEP not like", value, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepIn(List<String> values) {
addCriterion("CURRENT_STEP in", values, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepNotIn(List<String> values) {
addCriterion("CURRENT_STEP not in", values, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepBetween(String value1, String value2) {
addCriterion("CURRENT_STEP between", value1, value2, "currentStep");
return (Criteria) this;
}
public Criteria andCurrentStepNotBetween(String value1, String value2) {
addCriterion("CURRENT_STEP not between", value1, value2, "currentStep");
return (Criteria) this;
}
public Criteria andProjectIdIsNull() {
addCriterion("PROJECT_ID is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("PROJECT_ID is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("PROJECT_ID =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("PROJECT_ID <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("PROJECT_ID >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("PROJECT_ID >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("PROJECT_ID <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("PROJECT_ID <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("PROJECT_ID like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("PROJECT_ID not like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("PROJECT_ID in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("PROJECT_ID not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("PROJECT_ID between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("PROJECT_ID not between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andPeriodIsNull() {
addCriterion("PERIOD is null");
return (Criteria) this;
}
public Criteria andPeriodIsNotNull() {
addCriterion("PERIOD is not null");
return (Criteria) this;
}
public Criteria andPeriodEqualTo(Integer value) {
addCriterion("PERIOD =", value, "period");
return (Criteria) this;
}
public Criteria andPeriodNotEqualTo(Integer value) {
addCriterion("PERIOD <>", value, "period");
return (Criteria) this;
}
public Criteria andPeriodGreaterThan(Integer value) {
addCriterion("PERIOD >", value, "period");
return (Criteria) this;
}
public Criteria andPeriodGreaterThanOrEqualTo(Integer value) {
addCriterion("PERIOD >=", value, "period");
return (Criteria) this;
}
public Criteria andPeriodLessThan(Integer value) {
addCriterion("PERIOD <", value, "period");
return (Criteria) this;
}
public Criteria andPeriodLessThanOrEqualTo(Integer value) {
addCriterion("PERIOD <=", value, "period");
return (Criteria) this;
}
public Criteria andPeriodIn(List<Integer> values) {
addCriterion("PERIOD in", values, "period");
return (Criteria) this;
}
public Criteria andPeriodNotIn(List<Integer> values) {
addCriterion("PERIOD not in", values, "period");
return (Criteria) this;
}
public Criteria andPeriodBetween(Integer value1, Integer value2) {
addCriterion("PERIOD between", value1, value2, "period");
return (Criteria) this;
}
public Criteria andPeriodNotBetween(Integer value1, Integer value2) {
addCriterion("PERIOD not between", value1, value2, "period");
return (Criteria) this;
}
public Criteria andStepsCodeIsNull() {
addCriterion("STEPS_CODE is null");
return (Criteria) this;
}
public Criteria andStepsCodeIsNotNull() {
addCriterion("STEPS_CODE is not null");
return (Criteria) this;
}
public Criteria andStepsCodeEqualTo(String value) {
addCriterion("STEPS_CODE =", value, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeNotEqualTo(String value) {
addCriterion("STEPS_CODE <>", value, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeGreaterThan(String value) {
addCriterion("STEPS_CODE >", value, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeGreaterThanOrEqualTo(String value) {
addCriterion("STEPS_CODE >=", value, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeLessThan(String value) {
addCriterion("STEPS_CODE <", value, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeLessThanOrEqualTo(String value) {
addCriterion("STEPS_CODE <=", value, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeLike(String value) {
addCriterion("STEPS_CODE like", value, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeNotLike(String value) {
addCriterion("STEPS_CODE not like", value, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeIn(List<String> values) {
addCriterion("STEPS_CODE in", values, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeNotIn(List<String> values) {
addCriterion("STEPS_CODE not in", values, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeBetween(String value1, String value2) {
addCriterion("STEPS_CODE between", value1, value2, "stepsCode");
return (Criteria) this;
}
public Criteria andStepsCodeNotBetween(String value1, String value2) {
addCriterion("STEPS_CODE not between", value1, value2, "stepsCode");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("CREATE_TIME is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("CREATE_TIME is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("CREATE_TIME =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("CREATE_TIME <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("CREATE_TIME >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("CREATE_TIME >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("CREATE_TIME <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("CREATE_TIME <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("CREATE_TIME in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("CREATE_TIME not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("CREATE_TIME between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("CREATE_TIME not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("\"STATUS\" is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("\"STATUS\" is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("\"STATUS\" =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("\"STATUS\" <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("\"STATUS\" >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("\"STATUS\" >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("\"STATUS\" <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("\"STATUS\" <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("\"STATUS\" like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("\"STATUS\" not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("\"STATUS\" in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("\"STATUS\" not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("\"STATUS\" between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("\"STATUS\" not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andErrorMsgIsNull() {
addCriterion("ERROR_MSG is null");
return (Criteria) this;
}
public Criteria andErrorMsgIsNotNull() {
addCriterion("ERROR_MSG is not null");
return (Criteria) this;
}
public Criteria andErrorMsgEqualTo(String value) {
addCriterion("ERROR_MSG =", value, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgNotEqualTo(String value) {
addCriterion("ERROR_MSG <>", value, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgGreaterThan(String value) {
addCriterion("ERROR_MSG >", value, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgGreaterThanOrEqualTo(String value) {
addCriterion("ERROR_MSG >=", value, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgLessThan(String value) {
addCriterion("ERROR_MSG <", value, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgLessThanOrEqualTo(String value) {
addCriterion("ERROR_MSG <=", value, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgLike(String value) {
addCriterion("ERROR_MSG like", value, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgNotLike(String value) {
addCriterion("ERROR_MSG not like", value, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgIn(List<String> values) {
addCriterion("ERROR_MSG in", values, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgNotIn(List<String> values) {
addCriterion("ERROR_MSG not in", values, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgBetween(String value1, String value2) {
addCriterion("ERROR_MSG between", value1, value2, "errorMsg");
return (Criteria) this;
}
public Criteria andErrorMsgNotBetween(String value1, String value2) {
addCriterion("ERROR_MSG not between", value1, value2, "errorMsg");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table TAX_ADMIN.PERIOD_JOB
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.PeriodJobMapper">
<resultMap id="BaseResultMap" type="pwc.taxtech.atms.vat.entity.PeriodJob">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="ID" jdbcType="VARCHAR" property="id" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="CURRENT_STEP" jdbcType="VARCHAR" property="currentStep" />
<result column="PROJECT_ID" jdbcType="VARCHAR" property="projectId" />
<result column="PERIOD" jdbcType="DECIMAL" property="period" />
<result column="STEPS_CODE" jdbcType="VARCHAR" property="stepsCode" />
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
<result column="STATUS" jdbcType="VARCHAR" property="status" />
<result column="ERROR_MSG" jdbcType="VARCHAR" property="errorMsg" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
ID, "NAME", CURRENT_STEP, PROJECT_ID, PERIOD, STEPS_CODE, CREATE_TIME, "STATUS",
ERROR_MSG
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodJobExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from PERIOD_JOB
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from PERIOD_JOB
where ID = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from PERIOD_JOB
where ID = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodJobExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from PERIOD_JOB
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="pwc.taxtech.atms.vat.entity.PeriodJob">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into PERIOD_JOB (ID, "NAME", CURRENT_STEP,
PROJECT_ID, PERIOD, STEPS_CODE,
CREATE_TIME, "STATUS", ERROR_MSG
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{currentStep,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{period,jdbcType=DECIMAL}, #{stepsCode,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR}, #{errorMsg,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.PeriodJob">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into PERIOD_JOB
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="name != null">
"NAME",
</if>
<if test="currentStep != null">
CURRENT_STEP,
</if>
<if test="projectId != null">
PROJECT_ID,
</if>
<if test="period != null">
PERIOD,
</if>
<if test="stepsCode != null">
STEPS_CODE,
</if>
<if test="createTime != null">
CREATE_TIME,
</if>
<if test="status != null">
"STATUS",
</if>
<if test="errorMsg != null">
ERROR_MSG,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="currentStep != null">
#{currentStep,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="period != null">
#{period,jdbcType=DECIMAL},
</if>
<if test="stepsCode != null">
#{stepsCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="errorMsg != null">
#{errorMsg,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodJobExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from PERIOD_JOB
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update PERIOD_JOB
<set>
<if test="record.id != null">
ID = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
"NAME" = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.currentStep != null">
CURRENT_STEP = #{record.currentStep,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
PROJECT_ID = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.period != null">
PERIOD = #{record.period,jdbcType=DECIMAL},
</if>
<if test="record.stepsCode != null">
STEPS_CODE = #{record.stepsCode,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null">
"STATUS" = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.errorMsg != null">
ERROR_MSG = #{record.errorMsg,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update PERIOD_JOB
set ID = #{record.id,jdbcType=VARCHAR},
"NAME" = #{record.name,jdbcType=VARCHAR},
CURRENT_STEP = #{record.currentStep,jdbcType=VARCHAR},
PROJECT_ID = #{record.projectId,jdbcType=VARCHAR},
PERIOD = #{record.period,jdbcType=DECIMAL},
STEPS_CODE = #{record.stepsCode,jdbcType=VARCHAR},
CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
"STATUS" = #{record.status,jdbcType=VARCHAR},
ERROR_MSG = #{record.errorMsg,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.vat.entity.PeriodJob">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update PERIOD_JOB
<set>
<if test="name != null">
"NAME" = #{name,jdbcType=VARCHAR},
</if>
<if test="currentStep != null">
CURRENT_STEP = #{currentStep,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
PROJECT_ID = #{projectId,jdbcType=VARCHAR},
</if>
<if test="period != null">
PERIOD = #{period,jdbcType=DECIMAL},
</if>
<if test="stepsCode != null">
STEPS_CODE = #{stepsCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
"STATUS" = #{status,jdbcType=VARCHAR},
</if>
<if test="errorMsg != null">
ERROR_MSG = #{errorMsg,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.vat.entity.PeriodJob">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update PERIOD_JOB
set "NAME" = #{name,jdbcType=VARCHAR},
CURRENT_STEP = #{currentStep,jdbcType=VARCHAR},
PROJECT_ID = #{projectId,jdbcType=VARCHAR},
PERIOD = #{period,jdbcType=DECIMAL},
STEPS_CODE = #{stepsCode,jdbcType=VARCHAR},
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
"STATUS" = #{status,jdbcType=VARCHAR},
ERROR_MSG = #{errorMsg,jdbcType=VARCHAR}
where ID = #{id,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.PeriodJobExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from PERIOD_JOB
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
</mapper>
\ No newline at end of file
kill -9 `ps -ef |grep java | grep atms-invoice | awk '{print $2}'`
nohup mvn clean spring-boot:run &
kill -9 `ps -ef |grep java | grep atms-web | awk '{print $2}'`
nohup mvn clean tomcat7:run -Dmaven.test.skip=true -f pom.xml &
......@@ -1016,17 +1016,17 @@
function exportSpread(exportReportData) {
$scope.exportReportData = exportReportData;
$timeout(function () {
var mainSpread = new GcSpread.Sheets.Spread(document.getElementById("export"), {sheetCount: 1});
var mainSpread = new GC.Spread.Sheets.Workbook(document.getElementById("export"), {sheetCount: 1});
mainSpread.isPaintSuspended(true);
mainSpread.sheets.pop();
for (var index = 0; index < $scope.spreads.length; index++) {
var currentSheet = $scope.spreads[index].getActiveSheet();
currentSheet.setIsProtected(false);
currentSheet.options.isProtected=false;
for (var rowIndex = 0; rowIndex < currentSheet.getRowCount(); rowIndex++) {
for (var columnIndex = 0; columnIndex < currentSheet.getColumnCount(); columnIndex++) {
var cellStyle = currentSheet.getActualStyle(rowIndex, columnIndex, GcSpread.Sheets.SheetArea.viewport, true);
currentSheet.setStyle(rowIndex, columnIndex, cellStyle, GcSpread.Sheets.SheetArea.viewport);
var cellStyle = currentSheet.getActualStyle(rowIndex, columnIndex, GC.Spread.Sheets.SheetArea.viewport, true);
currentSheet.setStyle(rowIndex, columnIndex, cellStyle, GC.Spread.Sheets.SheetArea.viewport);
}
}
......
......@@ -48,9 +48,15 @@
generate: function (projectId, templateId, ifDeleteManualDataSource, period, generator) {
return $http.post('/Report/generate/' + projectId + '/' + templateId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
generateAll: function (projectId, ifDeleteManualDataSource, period, generator) {
return $http.post('/Report/generateByTotal/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator , {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
generateAll: function (projectId, isMergeManualDataSource, period, generator) {
return $http.post('/Report/generateByTotal/' + projectId + '/' + isMergeManualDataSource + '/' + period + '?generator=' + generator , {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
getRunningJob: function (projectId, period) {
return $http.get('/Report/getRunningJob/' + projectId+'/'+period, apiConfig.createVat());
},
getJobStatus: function (projectId, period, jobId) {
return $http.get('/Report/getJobStatus/' + projectId+'/'+period+'/'+jobId, apiConfig.createVat({ignoreLoadingBar: true}));
},
getReportData: function (reportId) {
return $http.get('/Report/reportData/' + reportId, apiConfig.createVat());
},
......
......@@ -22,17 +22,73 @@
autoExpandAll:true,
columns: [
{ dataField: 'typeName', caption: $translate.instant('IncomeType') },
{ dataField: 'description', caption: $translate.instant('Description') },
{ dataField: 'amount', caption: $translate.instant('Amount'), format: { type: 'fixedPoint', precision: 2 } }
{ dataField: 'description', caption: "栏次" },
{ dataField: 'amount', caption: "税务系统", format: { type: 'fixedPoint', precision: 2 } }
],
selection: {
mode: "single"
},
onRowPrepared: function (info) {
if (info.rowType != 'header') {
if (info.data.head_ID === "0") {
info.rowElement.addClass('top-category');
}
}
}
},
reasonOptions: {
height: '600px',
bindingOptions: {
dataSource: 'reasonList'
},
keyExpr: "id",
parentIdExpr: "head_ID",
expandedRowKeys: [1],
showBorders: false,
showColumnLines: false,
showRowLines: false,
columnAutoWidth: true,
autoExpandAll: true,
columns: [
{ dataField: 'name', caption: "会计科目" },
{ dataField: 'desc', caption: "明细字段" },
{ dataField: 'amount', caption: $translate.instant('Amount'), format: { type: 'fixedPoint', precision: 2 } },
{ dataField: 'desc', caption: $translate.instant('Description') },
{ dataField: 'name', caption: $translate.instant('DifferenceReason') }
],
onRowPrepared: function (info) {
if (info.rowType != 'header') {
if (info.data.head_ID==="0") {
info.rowElement.addClass('top-category');
}
if (info.data.id === 'total') {
info.rowElement.addClass('table-summary');
}
}
}
}
};
$scope.toggleAllMasterRows = function ($event) {
var expand = "dx-datagrid-group-closed";
var collapse = "dx-datagrid-group-opened";
if ($($event.target).hasClass(expand)) {
$scope.gridInstance.expandAll(-1);
$($event.target).removeClass(expand);
$($event.target).addClass(collapse);
} else {
$scope.gridInstance.collapseAll(-1);
$($event.target).removeClass(collapse);
$($event.target).addClass(expand);
}
};
var initData = function () {
$scope.differenceList = [];
$scope.reasonList = [];
// getService.getDifferenceList();
// getService.getReasonList();
};
......
......@@ -2,33 +2,16 @@
<div class="content">
<div class="col-lg-12 col-md-12" style="margin-top:10px;">
</div>
<div class="col-lg-24 col-md-24 fit-height">
<table border="1" width="95%" style="margin: auto">
<thead>
<tr class="th">
<th>会计科目</th>
<th>明细字段</th>
<th>金额</th>
<th>差异</th>
<th>差异原因</th>
</tr>
</thead>
<tbody >
<tr ng-repeat="x in list">
<td>{{}}</td>
<td>{{}}</td>
<td>{{}}</td>
<td>{{}}</td>
<td>{{}}</td>
</tr>
</tbody>
</table>
<div class="col-lg-12 col-md-12 fit-height">
<div class="col-lg-4 col-md-4">
<div dx-tree-list="grid.differenceOptions" dx-item-alias="item">
</div>
</div>
<div class="col-lg-8 col-md-8">
<div dx-tree-list="grid.reasonOptions" id="reason"></div>
</div>
</div>
</div>
<style>
.th>th{
width : 15%;
text-align: center;
}
</style>
</div>
......@@ -11,6 +11,7 @@
$scope.totalTaxAmount = 0;
var minDate = [1, vatSessionService.project.year];
// var minDate = moment().startOf('month').subtract(0, 'months');
var maxDate = [12, vatSessionService.project.year];
var setDate = [
[vatSessionService.month, vatSessionService.project.year],
......@@ -108,6 +109,7 @@
vatPreviewService.queryInputInvoiceList($scope.queryParams).success(function (data) {
if (data) {
// minDate = data.
var index = 1;
data.list.forEach(function (v) {
v.index = index++;
......
......@@ -8,7 +8,7 @@
data-templateurl="/app/vat/preview/vat-preview-input-invoice/vat-preview-input-invoice-search.html">
<i class="fa fa-filter" aria-hidden="true"></i>
</button>-->
<div></div><div></div>
<span translate="IncomeInvoiceTitle" class="text-bold"></span> &nbsp;&nbsp;|&nbsp;&nbsp;<span class="text-bold" translate="InvoiceQJ"></span>
<input type="text" class="form-control input-width-middle" style="position: relative; top: -33px; left: 160px;" id="input-invoice-period-picker" />
......
vatModule.controller('vatCaculateDataController', ['$scope', '$log', '$timeout', '$q', '$translate', 'loginContext',
vatModule.controller('vatCaculateDataController', ['$scope', '$log', '$timeout','$interval', '$q', '$translate', 'loginContext',
'apiInterceptor', 'Upload', 'dataImportService', 'SweetAlert', 'vatReductionService', 'vatSessionService', 'uiGridConstants',
'enums', 'modelConfigurationService', 'vatReportService', 'vatCommonService', 'BSPLService', 'vatOperationLogService',
'vatWorkflowService',
function ($scope, $log, $timeout, $q, $translate, loginContext, apiInterceptor, Upload, dataImportService, SweetAlert,
function ($scope, $log, $timeout, $interval, $q, $translate, loginContext, apiInterceptor, Upload, dataImportService, SweetAlert,
vatReductionService, vatSessionService, uiGridConstants, enums, modelConfigurationService, vatReportService, vatCommonService
, BSPLService, vatOperationLogService, vatWorkflowService) {
'use strict';
......@@ -11,17 +11,16 @@
var taskList = [];
var fixedRef = [];
$scope.period = vatSessionService.month;
$scope.isMergeManualDataSource = false;
$scope.moduleid = enums.vatModuleEnum.Import_CalculateData;
var initTasks = function () {
var task = function (id, status, name) {
var task = function (id, status, name,code) {
this.id = id;
this.name = _.isEmpty(name) ? $translate.instant(id) : name;
this.status = status;
this.text = $translate.instant(status);
this.code = code;
};
task.prototype.doTask = function () {
var _this = this;
......@@ -118,12 +117,12 @@
//}, function () {
// taskError(_this);
//});
vatReportService.updateConfig(vatSessionService.project.id, true, vatSessionService.month,
vatSessionService.logUser.id ? vatSessionService.logUser.id : "",
$scope.isMergeManualDataSource ).success(function (data) {
var data = {result: true};
updateProgress(data, _this);
// //});
// vatReportService.updateConfig(vatSessionService.project.id, true, vatSessionService.month,
// vatSessionService.logUser.id ? vatSessionService.logUser.id : "",
// $scope.isMergeManualDataSource ).success(function (data) {
// var data = {result: true};
// updateProgress(data, _this);
//vatReportService.getTemplateReferences(vatSessionService.month).then(function (refData) {
// if (refData && refData.data) {
// // 初始化resolve列表
......@@ -143,10 +142,10 @@
//}).then(function () {
// updateProgress(data, _this);
//});
}).error(function () {
taskError(_this);
});
// }).error(function () {
//
// taskError(_this);
// });
break;
case 'CalculateKeyValue':
//$q.all().then(function () {
......@@ -197,6 +196,7 @@
task.prototype.id = null;
task.prototype.status = null;
task.prototype.text = null;
task.prototype.code =null;
vatReportService.getTemplate(vatSessionService.project.id, constant.serviceType.VAT, vatSessionService.month).then(function (report) {
var result = [];
......@@ -212,7 +212,7 @@
name: $translate.instant('GenerateReport'),
isReportTask: true,
items: _.map(report.data.data, function (x) {
return new task(x.templateId, 'unstarted', x.templateName);
return new task(x.templateId, 'unstarted', x.templateName, x.templateCode);
})
});
......@@ -240,11 +240,12 @@
});
$scope.tasks = result;
getInitTaskStatus();
});
};
function doStartCaculate(isMergeManualDataSource) {
$scope.isMergeManualDataSource = isMergeManualDataSource;
$scope.readonly = true;
$scope.resolveRef.length = 0;
$scope.resolveRef.push({
......@@ -276,6 +277,27 @@
// });
}
function doStartCaculate2(isMergeManualDataSource) {
vatReportService.generateAll(vatSessionService.project.id, isMergeManualDataSource, vatSessionService.month, vatSessionService.logUser.id ? vatSessionService.logUser.id : "").success(function (data) {
if(data && data.result)
updateTasksStatus(data.data);
if(data.data.status=='Begin'){
$scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,data.data.id).then(function(result){
if(result.data && result.status == 200){
updateTasksStatus(result.data);
}
});
},1000);
}
}).error(function () {
$log.debug("generate all report may be some error");
// taskError(_this);
});
}
var startCaculate = function () {
if (vatSessionService.project.projectStatusList[vatSessionService.month] >= constant.ProjectStatusEnum.Generated) {
swal({
......@@ -326,6 +348,57 @@
}
};
var startCaculate2 = function () {
if (vatSessionService.project.projectStatusList[vatSessionService.month] >= constant.ProjectStatusEnum.Generated) {
swal({
title: "warning!",
text: $translate.instant('IsConfirmReCalcuate').formatObj({status: vatCommonService.getProjectStautsEnumDesc(vatSessionService.project.projectStatusList[vatSessionService.month])}),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
vatReportService.hasManualDataSource(vatSessionService.project.id,vatSessionService.month).then(function (hasManual) {
if(hasManual){
swal({
title: "warning!",
text: "是否保留手工数据!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
doStartCaculate2(true);
}else{
doStartCaculate2(false);
}
});
}else{
doStartCaculate2(false);
}
});
}
else {
swal.close();
}
});
}
else {
doStartCaculate2(false);
}
};
var caculateProgress = function (task) {
var completedCnt = taskList.filter(function (t) {
......@@ -464,9 +537,68 @@
logDto.OperationType = enums.vatLogOperationTypeEnum.CalculateData;
logDto.UpdateState = status == null ? '' : status;
vatOperationLogService.addOperationLog(logDto);
};
var updateTasksStatus = function(job){
if(job.currentStep == 'UpdateConfig'){
$scope.tasks[0].items[0].status = 'processing';
$scope.tasks[0].items[0].text= $translate.instant('processing');
}else{
$scope.tasks[0].items[0].status = 'completed';
$scope.tasks[0].items[0].text= $translate.instant('completed');
var items = $scope.tasks[1].items;
var currentIndex = 0;
items.forEach(function(item,index){
if((job).currentStep == item.code){
currentIndex = index;
}
});
items.forEach(function(item,index){
if(index < currentIndex){
item.status ='completed';
}else if(index == currentIndex){
if(job.status == 'Error'){
item.status = 'error';
}else if(job.status == 'End'){
item.status = 'completed';
if($scope.timer){
$interval.cancel($scope.timer);
}
}else if(job.status == 'Begin'){
item.status = 'processing';
}
}
item.text = $translate.instant(item.status);
});
}
}
var getInitTaskStatus = function(){
vatReportService.getRunningJob(vatSessionService.project.id,vatSessionService.month).then(function (result) {
if(result.data && result.status == 200){
updateTasksStatus(result.data);
if(result.data.status=='Begin'){
$scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,result.data.id).then(function(result){
if(result.data && result.status == 200){
updateTasksStatus(result.data);
}
});
},1000);
}
}else{
$log.debug("not running job");
}
});
}
var sendMessage = function (task) {
var msgDto = {};
msgDto.projectId = vatSessionService.project.id;
......@@ -494,6 +626,7 @@
$scope.resolveRef = [];
initTasks();
$scope.startCaculate = startCaculate;
$scope.startCaculate2 = startCaculate2;
})();
}
......
......@@ -2,7 +2,8 @@
<div class="vat-caculate-data-title" ng-if="tasks.length > 0">
<!--<span translate="vatCaculateDataDesc"></span>-->
<button class="btn btn-vat-primary" translate="startCaculateData" ng-disabled="readonly" ng-click="startCaculate()"></button>
<!--<button class="btn btn-vat-primary" translate="startCaculateData" ng-disabled="readonly" ng-click="startCaculate()"></button>-->
<button class="btn btn-vat-primary" translate="startCaculateData" ng-disabled="readonly" ng-click="startCaculate2()"></button>
<span ng-click="showOperateLogPop()"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'Remarks' | translate}}</span>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment