Commit accba4a0 authored by sherlock's avatar sherlock

Merge remote-tracking branch 'origin/dev_oracle' into dev_oracle_sherlock

# Conflicts:
#	atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
parents 4116029a 26c6c131
...@@ -3,13 +3,10 @@ package pwc.taxtech.atms.controller; ...@@ -3,13 +3,10 @@ package pwc.taxtech.atms.controller;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.ProjectStatusManageDto; import pwc.taxtech.atms.dto.taxadmin.ProjectStatusManageDto;
import pwc.taxtech.atms.entity.ProjectStatusManage;
import pwc.taxtech.atms.service.impl.IdentityServiceImpl; import pwc.taxtech.atms.service.impl.IdentityServiceImpl;
import pwc.taxtech.atms.service.impl.ProjectStatusManageServiceImpl; import pwc.taxtech.atms.service.impl.ProjectStatusManageServiceImpl;
...@@ -42,4 +39,12 @@ public class ProjectStatusManageController { ...@@ -42,4 +39,12 @@ public class ProjectStatusManageController {
@PathVariable Integer periodId) { @PathVariable Integer periodId) {
return projectStatusManageService.getProjectStatus(projectId, periodId); return projectStatusManageService.getProjectStatus(projectId, periodId);
} }
@RequestMapping(value = {"isProjectStatusExisted/{projectId}/{periodId}"}, method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
public OperationResultDto<ProjectStatusManage> isProjectStatusExisted(@PathVariable String projectId,
@PathVariable int periodId) {
return projectStatusManageService.isProjectStatusExisted(projectId, periodId);
}
} }
...@@ -30,15 +30,17 @@ public class ReportController { ...@@ -30,15 +30,17 @@ public class ReportController {
public OperationResultDto updateConfig(@PathVariable String projectId, public OperationResultDto updateConfig(@PathVariable String projectId,
@PathVariable Boolean ifDeleteManualDataSource, @PathVariable Boolean ifDeleteManualDataSource,
@PathVariable Integer period, @PathVariable Integer period,
@RequestParam String generator) { @RequestParam String generator,
return reportService.updateConfig(projectId, period, ifDeleteManualDataSource, generator); @RequestParam Boolean mergeManual) {
return reportService.updateConfig(projectId, period, ifDeleteManualDataSource, generator, mergeManual);
// OperationResultDto operationResultDto = new OperationResultDto(); // OperationResultDto operationResultDto = new OperationResultDto();
// operationResultDto.setResult(true); // operationResultDto.setResult(true);
// return operationResultDto; // return operationResultDto;
} }
@RequestMapping(value = "generateByTotal/{projectId}/{ifDeleteManualDataSource}/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @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) { 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); return reportService.generateData(projectId, EnumServiceType.VAT, ifDeleteManualDataSource, period, null, generator);
} }
...@@ -124,4 +126,9 @@ public class ReportController { ...@@ -124,4 +126,9 @@ public class ReportController {
public OperationResultDto<String> getDataSourceDetailList(@PathVariable Long dataSourceId) { public OperationResultDto<String> getDataSourceDetailList(@PathVariable Long dataSourceId) {
return reportService.getDataSourceDetailList(dataSourceId); return reportService.getDataSourceDetailList(dataSourceId);
} }
@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);
}
} }
\ No newline at end of file
package pwc.taxtech.atms.dto.vatdto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import java.util.HashMap;
import java.util.Map;
@Getter
@Setter
public class CellTemplateConfigGroupDto {
Integer columnIndex;
Integer rowIndex;
String columnName;
String rowName;
Integer dataType;
Boolean isReadOnly;
@JsonProperty("cellTemplateID")
Long cellTemplateId;
@JsonProperty("reportTemplateID")
Long reportTemplateId;
String comment;
public CellTemplateConfigGroupDto(Integer columnIndex, Integer rowIndex
, String columnName, String rowName, Integer dataType, Boolean isReadOnly
, Long cellTemplateId, Long reportTemplateId, String comment) {
this.columnIndex = columnIndex;
this.rowIndex = rowIndex;
this.columnName = columnName;
this.rowName = rowName;
this.dataType = dataType;
this.isReadOnly = isReadOnly;
this.cellTemplateId = cellTemplateId;
this.reportTemplateId = reportTemplateId;
this.comment = comment;
}
public Map<String, Map<String, Object>> toStr() {
StringBuilder sb = new StringBuilder();
sb.append(this.getColumnIndex());
sb.append(this.getRowIndex());
sb.append(this.getColumnName());
sb.append(this.getRowName());
sb.append(this.getDataType());
sb.append(this.getIsReadOnly());
sb.append(this.getCellTemplateId());
sb.append(this.getReportTemplateId());
sb.append(this.getComment());
Map<String, Map<String, Object>> result = new HashMap<>();
Map<String, Object> map = new HashMap<>();
map.put("columnIndex", this.getColumnIndex());
map.put("rowIndex", this.getRowIndex());
map.put("columnName", this.getColumnName());
map.put("rowName", this.getRowName());
map.put("dataType", this.getDataType());
map.put("isReadOnly", this.getIsReadOnly());
map.put("cellTemplateId", this.getCellTemplateId());
map.put("reportTemplateId", this.getReportTemplateId());
map.put("comment", this.getComment());
result.put(sb.toString(), map);
return result;
}
}
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -124,4 +125,15 @@ public class ProjectStatusManageServiceImpl { ...@@ -124,4 +125,15 @@ public class ProjectStatusManageServiceImpl {
} }
} }
public OperationResultDto<ProjectStatusManage> isProjectStatusExisted(String projectId, int periodId) {
ProjectStatusManageExample example = new ProjectStatusManageExample();
example.createCriteria().andProjectIdEqualTo(projectId).andPeriodIdEqualTo(periodId);
List<ProjectStatusManage> manage = projectStatusManageMapper.selectByExample(example);
OperationResultDto<ProjectStatusManage> dto = new OperationResultDto();
dto.setResult(true);
dto.setResultMsg(StringUtils.EMPTY);
dto.setData(manage.isEmpty() ? null : manage.get(0));
return dto;
}
} }
...@@ -136,8 +136,6 @@ public class RuleEngineeConfigServiceImpl extends AbstractService { ...@@ -136,8 +136,6 @@ public class RuleEngineeConfigServiceImpl extends AbstractService {
if ("Add".equals(tprrdo.getAction())) { if ("Add".equals(tprrdo.getAction())) {
taxPayerReportRule.setId(distributedIdService.nextId()); taxPayerReportRule.setId(distributedIdService.nextId());
taxPayerReportRuleMapper.insert(taxPayerReportRule); taxPayerReportRuleMapper.insert(taxPayerReportRule);
// operationService.addDataAddLog(taxPayerReportRule, OperationModule.RuleEngineConfig, authUserHelper.getCurrentUserId(),
// "AddRuleEngineConfiguration", "纳税类型", "纳税类型添加特殊机构", OperateLogType.OperationLogRuleEngine);
} else if ("Update".equals(tprrdo.getAction())) { } else if ("Update".equals(tprrdo.getAction())) {
TaxPayerReportRule old = taxPayerReportRuleMapper.selectByPrimaryKey(Long.parseLong(reportDto.getId())); TaxPayerReportRule old = taxPayerReportRuleMapper.selectByPrimaryKey(Long.parseLong(reportDto.getId()));
TaxPayerReportRule original = new TaxPayerReportRule(); TaxPayerReportRule original = new TaxPayerReportRule();
......
...@@ -20,7 +20,6 @@ import pwc.taxtech.atms.constant.enums.CellDataSourceType; ...@@ -20,7 +20,6 @@ import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dao.ProjectMapper; import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto; import pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto;
import pwc.taxtech.atms.dto.vatdto.CellTemplateConfigGroupDto;
import pwc.taxtech.atms.entity.Project; import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.service.impl.DistributedIdService; import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.service.impl.HttpFileService; import pwc.taxtech.atms.service.impl.HttpFileService;
...@@ -338,6 +337,7 @@ public class ReportGeneratorImpl { ...@@ -338,6 +337,7 @@ public class ReportGeneratorImpl {
dataSource.setPeriod(period); dataSource.setPeriod(period);
dataSource.setCellTemplateId(periodCellTemplateConfig.getCellTemplateId()); dataSource.setCellTemplateId(periodCellTemplateConfig.getCellTemplateId());
dataSource.setType(FormulaDataSourceType.Report.getCode()); dataSource.setType(FormulaDataSourceType.Report.getCode());
dataSource.setProjectId(projectId);
periodDataSourceMapper.insertSelective(dataSource); periodDataSourceMapper.insertSelective(dataSource);
//这里有个问题就是DataSource的数据有了,但是celldatasource的数据没有,后面无法关联celldata和DataSource //这里有个问题就是DataSource的数据有了,但是celldatasource的数据没有,后面无法关联celldata和DataSource
//解决办法就是 在存DataSource的时候就先把celldata的数据加好 //解决办法就是 在存DataSource的时候就先把celldata的数据加好
...@@ -526,32 +526,33 @@ public class ReportGeneratorImpl { ...@@ -526,32 +526,33 @@ public class ReportGeneratorImpl {
fixedPCTParsedFormula(periodCellTemplateConfigExtendDtos, projectId, period); fixedPCTParsedFormula(periodCellTemplateConfigExtendDtos, projectId, period);
List<CellCalcInfoDto> cellCalcInfoDtos = new ArrayList<>(); List<CellCalcInfoDto> cellCalcInfoDtos = new ArrayList<>();
periodCellTemplateConfigExtendDtos.stream().collect(Collectors.groupingBy(a -> Map<String, List<PeriodCellTemplateConfigExtendDto>> myStream = new HashMap<>();
new CellTemplateConfigGroupDto(a.getColumnIndex(), a.getRowIndex() for (PeriodCellTemplateConfigExtendDto pctce : periodCellTemplateConfigExtendDtos) {
, a.getColumnName(), a.getRowName(), a.getDataType(), a.getReadOnly() String key = pctce.getRowIndex() + "_" + pctce.getColumnIndex() + "_" + pctce.getReportTemplateId();
, a.getCellTemplateId(), a.getReportTemplateId(), a.getComment()).toStr())).forEach((x, y) -> { if (!myStream.containsKey(key)) myStream.put(key, new ArrayList<>());
Optional<Map<String, Object>> result = x.values().stream().findFirst(); myStream.get(key).add(pctce);
if (result.isPresent()) { }
CellCalcInfoDto cellCalcInfoDto = new CellCalcInfoDto();
cellCalcInfoDto.setColumnIndex(Integer.parseInt(result.get().get("columnIndex").toString())); myStream.keySet().forEach(m -> {
cellCalcInfoDto.setColumnName(result.get().get("columnName") == null ? "" : result.get().get("columnName").toString()); PeriodCellTemplateConfigExtendDto first = myStream.get(m).get(0);
cellCalcInfoDto.setRowIndex(Integer.parseInt(result.get().get("rowIndex").toString())); CellCalcInfoDto cellCalcInfoDto = new CellCalcInfoDto();
cellCalcInfoDto.setRowName(result.get().get("rowName") == null ? "" : result.get().get("rowName").toString()); cellCalcInfoDto.setColumnIndex(first.getColumnIndex());
cellCalcInfoDto.setFormula(convertListToString(y.stream() cellCalcInfoDto.setColumnName(first.getColumnName());
.map(PeriodCellTemplateConfig::getFormula).collect(Collectors.toList()))); cellCalcInfoDto.setRowIndex(first.getRowIndex());
cellCalcInfoDto.setParsedFormula(convertListToString(y.stream() cellCalcInfoDto.setRowName(first.getRowName());
.map(PeriodCellTemplateConfig::getParsedFormula).collect(Collectors.toList()))); cellCalcInfoDto.setFormula(convertListToString(myStream.get(m).stream()
//todo: add validation at here later .map(PeriodCellTemplateConfig::getFormula).collect(Collectors.toList())));
cellCalcInfoDto.setCellTemplateId(result.get().get("cellTemplateId").toString()); cellCalcInfoDto.setParsedFormula(convertListToString(myStream.get(m).stream()
cellCalcInfoDto.setReportTemplateId(Long.parseLong(result.get().get("reportTemplateId").toString())); .map(PeriodCellTemplateConfig::getParsedFormula).collect(Collectors.toList())));
cellCalcInfoDto.setDataType(Integer.parseInt(result.get().get("dataType").toString())); //todo: add validation at here later
cellCalcInfoDto.setIsReadOnly(Boolean.valueOf(result.get().get("isReadOnly").toString())); cellCalcInfoDto.setCellTemplateId(first.getCellTemplateId() + "");
cellCalcInfoDto.setComment(result.get().get("comment") == null ? "" : result.get().get("comment").toString()); cellCalcInfoDto.setReportTemplateId(first.getReportTemplateId());
cellCalcInfoDto.setConfigList(y.stream() cellCalcInfoDto.setDataType(first.getDataType());
.map(PeriodCellTemplateConfigExtendDto::getPeriodCellTemplateConfig) cellCalcInfoDto.setIsReadOnly(first.getReadOnly());
.collect(Collectors.toList())); cellCalcInfoDto.setComment(first.getComment());
cellCalcInfoDtos.add(cellCalcInfoDto); cellCalcInfoDto.setConfigList(myStream.get(m).stream()
} .map(PeriodCellTemplateConfigExtendDto::getPeriodCellTemplateConfig).collect(Collectors.toList()));
cellCalcInfoDtos.add(cellCalcInfoDto);
}); });
return cellCalcInfoDtos; return cellCalcInfoDtos;
} }
......
...@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.*; import pwc.taxtech.atms.constant.enums.*;
import pwc.taxtech.atms.dao.*; import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dpo.ReportDto; import pwc.taxtech.atms.dpo.ReportDto;
...@@ -156,7 +157,7 @@ public class ReportServiceImpl { ...@@ -156,7 +157,7 @@ public class ReportServiceImpl {
return operationResult; return operationResult;
} }
private void clearPeriodData(String projectId, Integer period, List<Long> templateIds) { private void clearPeriodData(String projectId, Integer period, List<Long> templateIds, boolean isMergeManualData) {
if (templateIds.isEmpty()) templateIds.add(Long.MAX_VALUE); if (templateIds.isEmpty()) templateIds.add(Long.MAX_VALUE);
PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample(); PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample();
periodFormulaBlockExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period); periodFormulaBlockExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
...@@ -183,10 +184,35 @@ public class ReportServiceImpl { ...@@ -183,10 +184,35 @@ public class ReportServiceImpl {
periodTaxPayerReportRuleMapper.deleteByExample(periodTaxPayerReportRuleExample); periodTaxPayerReportRuleMapper.deleteByExample(periodTaxPayerReportRuleExample);
PeriodDataSourceExample periodDataSourceExample = new PeriodDataSourceExample(); PeriodDataSourceExample periodDataSourceExample = new PeriodDataSourceExample();
periodDataSourceExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period); periodDataSourceExample.createCriteria().andProjectIdEqualTo(projectId)
.andPeriodEqualTo(period);
List<PeriodDataSource> periodDataSources = periodDataSourceMapper.selectByExample(periodDataSourceExample); List<PeriodDataSource> periodDataSources = periodDataSourceMapper.selectByExample(periodDataSourceExample);
List<Long> periodDsIds = Lists.newArrayList(Long.MAX_VALUE); List<Long> periodDsIds = Lists.newArrayList(Long.MAX_VALUE);
periodDsIds.addAll(periodDataSources.stream().map(m -> m.getId()).collect(Collectors.toList())); List<Long> periodManualDsIds = new ArrayList<>();
List<Long> periodManualCellDataIds = new ArrayList<>();
if (isMergeManualData) {
periodDataSources.forEach(m -> {
if (m.getType().intValue() != FormulaDataSourceType.KeyInSource.getCode().intValue()) {
periodDsIds.add(m.getId());
} else {
periodManualDsIds.add(m.getId());
}
});
if (!periodManualDsIds.isEmpty()) {
PeriodCellDataSourceExample periodCellDataSourceExample = new PeriodCellDataSourceExample();
periodCellDataSourceExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period)
.andDataSourceIdIn(periodManualDsIds);
List<PeriodCellDataSource> manualCellDataSource = periodCellDataSourceMapper.selectByExample(periodCellDataSourceExample);
if (!manualCellDataSource.isEmpty())
periodManualCellDataIds.addAll(manualCellDataSource.stream().map(PeriodCellDataSource::getCellDataId)
.collect(Collectors.toList()));
}
} else {
periodDsIds.addAll(periodDataSources.stream().map(m -> m.getId()).collect(Collectors.toList()));
}
PeriodDataSourceDetailExample periodDataSourceDetailExample = new PeriodDataSourceDetailExample(); PeriodDataSourceDetailExample periodDataSourceDetailExample = new PeriodDataSourceDetailExample();
periodDataSourceDetailExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period) periodDataSourceDetailExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period)
.andDataSourceIdIn(periodDsIds); .andDataSourceIdIn(periodDsIds);
...@@ -197,7 +223,10 @@ public class ReportServiceImpl { ...@@ -197,7 +223,10 @@ public class ReportServiceImpl {
.andDataSourceIdIn(periodDsIds); .andDataSourceIdIn(periodDsIds);
periodCellDataSourceMapper.deleteByExample(periodCellDataSourceExample); periodCellDataSourceMapper.deleteByExample(periodCellDataSourceExample);
periodDataSourceMapper.deleteByExample(periodDataSourceExample);
PeriodDataSourceExample periodDataSourceDeleteExample = new PeriodDataSourceExample();
periodDataSourceDeleteExample.createCriteria().andIdIn(periodDsIds);
periodDataSourceMapper.deleteByExample(periodDataSourceDeleteExample);
PeriodReportExample periodReportExample = new PeriodReportExample(); PeriodReportExample periodReportExample = new PeriodReportExample();
periodReportExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period); periodReportExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
...@@ -206,14 +235,21 @@ public class ReportServiceImpl { ...@@ -206,14 +235,21 @@ public class ReportServiceImpl {
List<Long> reportIds = Lists.newArrayList(Long.MAX_VALUE); List<Long> reportIds = Lists.newArrayList(Long.MAX_VALUE);
reportIds.addAll(reports.stream().map(m -> m.getId()).collect(Collectors.toList())); reportIds.addAll(reports.stream().map(m -> m.getId()).collect(Collectors.toList()));
PeriodCellDataExample periodCellDataExample = new PeriodCellDataExample(); PeriodCellDataExample periodCellDataExample = new PeriodCellDataExample();
periodCellDataExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andReportIdIn(
reportIds); if (!periodManualCellDataIds.isEmpty()) {
periodCellDataExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andReportIdIn(
reportIds).andIdNotIn(periodManualCellDataIds);
} else {
periodCellDataExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andReportIdIn(
reportIds);
}
periodCellDataMapper.deleteByExample(periodCellDataExample); periodCellDataMapper.deleteByExample(periodCellDataExample);
periodReportMapper.deleteByExample(periodReportExample); periodReportMapper.deleteByExample(periodReportExample);
} }
public OperationResultDto updateConfig(String projectId, Integer period, Boolean ifDeleteManualDataSource, String generator) { public OperationResultDto updateConfig(String projectId, Integer period, Boolean ifDeleteManualDataSource,
String generator, Boolean isMergeManualData) {
OperationResultDto result = new OperationResultDto(); OperationResultDto result = new OperationResultDto();
try { try {
if (period == null) { if (period == null) {
...@@ -240,7 +276,7 @@ public class ReportServiceImpl { ...@@ -240,7 +276,7 @@ public class ReportServiceImpl {
Long templateGroupId = projectMapper.getTemplateGroupIdByProject(projectId, EnumServiceType.VAT.getCode()); Long templateGroupId = projectMapper.getTemplateGroupIdByProject(projectId, EnumServiceType.VAT.getCode());
if (templateGroupId != null && templateGroupId != 0) { if (templateGroupId != null && templateGroupId != 0) {
// 先进行数据清理,包括period开头的所有报表配置表 条件Period // 先进行数据清理,包括period开头的所有报表配置表 条件Period
clearPeriodData(projectId, period, exceptTemplateIds); clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
// 根据templategroupid 把 template 插入到 periodTemplate // 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample example = new TemplateExample(); TemplateExample example = new TemplateExample();
example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId); example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId);
...@@ -854,8 +890,8 @@ public class ReportServiceImpl { ...@@ -854,8 +890,8 @@ public class ReportServiceImpl {
dataSourceModel.setId(cellDataSourceId); dataSourceModel.setId(cellDataSourceId);
dataSourceModel.setType(FormulaDataSourceType.KeyInSource.getCode()); dataSourceModel.setType(FormulaDataSourceType.KeyInSource.getCode());
dataSourceModel.setName(data.getName()); dataSourceModel.setName(data.getName());
dataSourceModel.setCellTemplateId(Long.parseLong(data.getCellTemplateId()));
dataSourceModel.setDescription(data.getDescription()); dataSourceModel.setDescription(data.getDescription());
dataSourceModel.setCellTemplateId(Long.parseLong(data.getCellTemplateId()));
dataSourceModel.setAmount(data.getAmount()); dataSourceModel.setAmount(data.getAmount());
if (periodCellTemplate.isPresent()) { if (periodCellTemplate.isPresent()) {
dataSourceModel.setRowIndex(periodCellTemplate.get().getRowIndex()); dataSourceModel.setRowIndex(periodCellTemplate.get().getRowIndex());
...@@ -865,6 +901,7 @@ public class ReportServiceImpl { ...@@ -865,6 +901,7 @@ public class ReportServiceImpl {
dataSourceModel.setUpdateTime(new Date()); dataSourceModel.setUpdateTime(new Date());
dataSourceModel.setCreateBy("admin"); dataSourceModel.setCreateBy("admin");
dataSourceModel.setUpdateBy("admin"); dataSourceModel.setUpdateBy("admin");
dataSourceModel.setProjectId(projectId);
dataSourceModel.setPeriod(data.getPeriod()); dataSourceModel.setPeriod(data.getPeriod());
PeriodCellDataSource cellDataSource = new PeriodCellDataSource(); PeriodCellDataSource cellDataSource = new PeriodCellDataSource();
...@@ -1179,4 +1216,8 @@ public class ReportServiceImpl { ...@@ -1179,4 +1216,8 @@ public class ReportServiceImpl {
return ""; return "";
} }
} }
public Boolean hasManualDataSource(String projectId, Integer period) {
return periodReportMapper.hasManualDataSource(projectId, period) > 0;
}
} }
...@@ -109,7 +109,7 @@ public interface CellTemplateConfigMapper extends MyMapper { ...@@ -109,7 +109,7 @@ public interface CellTemplateConfigMapper extends MyMapper {
List<CellTemplateConfig> getCellTemplateConfigByTemplateId(@Param("templateId") Long templateId); List<CellTemplateConfig> getCellTemplateConfigByTemplateId(@Param("templateId") Long templateId);
int deleteCellTemplateConfigByCellTemplate(@Param("templateDbId") Long templateDbId); int deleteCellTemplateConfigByCellTemplate(@Param("templateId") Long templateId);
void batchInsert(List<CellTemplateConfig> list); void batchInsert(List<CellTemplateConfig> list);
......
...@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.dao; ...@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.dao;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.PeriodReport; import pwc.taxtech.atms.vat.entity.PeriodReport;
...@@ -105,4 +106,16 @@ public interface PeriodReportMapper extends MyVatMapper { ...@@ -105,4 +106,16 @@ public interface PeriodReportMapper extends MyVatMapper {
* @mbg.generated * @mbg.generated
*/ */
int updateByPrimaryKey(PeriodReport record); int updateByPrimaryKey(PeriodReport record);
@Select("" +
"SELECT " +
" COUNT( 1 ) " +
"FROM " +
" PERIOD_DATA_SOURCE pds " +
"WHERE " +
" pds.PROJECT_ID = #{projectId} " +
" AND pds.TYPE = 10 " +
" AND pds.PERIOD = #{period}" +
"")
int hasManualDataSource(@Param("projectId") String projectId, @Param("period") Integer period);
} }
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<insert id="batchInsert" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig"> <insert id="batchInsert" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig">
INSERT ALL INSERT ALL
<foreach collection="list" item="item"> <foreach collection="list" item="item">
INTO TAX_ADMIN.CELL_TEMPLATE_CONFIG VALUES INTO CELL_TEMPLATE_CONFIG VALUES
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<choose> <choose>
<when test="item.id != null"> <when test="item.id != null">
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
<insert id="batchInsert2" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig"> <insert id="batchInsert2" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig">
INSERT ALL INSERT ALL
<foreach collection="list" item="item" > <foreach collection="list" item="item" >
INTO TAX_ADMIN.CELL_TEMPLATE_CONFIG VALUES INTO CELL_TEMPLATE_CONFIG VALUES
(#{item.id,jdbcType=INTEGER}, #{item.cellTemplateId,jdbcType=INTEGER}, (#{item.id,jdbcType=INTEGER}, #{item.cellTemplateId,jdbcType=INTEGER},
#{item.reportTemplateId,jdbcType=INTEGER}, #{item.reportTemplateId,jdbcType=INTEGER},
#{item.dataSourceType,jdbcType=INTEGER}, #{item.formula,jdbcType=VARCHAR}, #{item.dataSourceType,jdbcType=INTEGER}, #{item.formula,jdbcType=VARCHAR},
......
...@@ -289,20 +289,20 @@ ...@@ -289,20 +289,20 @@
</association> </association>
<association property="cellDataSource" javaType="pwc.taxtech.atms.vat.entity.CellDataSource"> <association property="cellDataSource" javaType="pwc.taxtech.atms.vat.entity.CellDataSource">
<id column="CELL_DATA_SOURCE_ID" jdbcType="BIGINT" property="id"/> <id column="CELL_DATA_SOURCE_ID" jdbcType="BIGINT" property="id"/>
<result column="CELL_DATA_SOURCE_OPERATION_TYPE" property="operationType" javaType="java.lang.Integer" <result column="OPERATION_TYPE" property="operationType" javaType="java.lang.Integer"
jdbcType="INTEGER"/> jdbcType="INTEGER"/>
</association> </association>
</resultMap> </resultMap>
<select id="getManualDataSource2" parameterType="java.lang.Long" resultMap="dataSourceCellDataDto"> <select id="getManualDataSource2" parameterType="java.lang.Long" resultMap="dataSourceCellDataDto">
SELECT SELECT
CELL_DATA_SOURCE.ID AS ID, CELLDATASOURCE.ID AS ID,
CELLDATA.ID AS CELL_DATA_ID, CELLDATA.ID AS CELL_DATA_ID,
CELLDATA.DATA AS CELL_DATA_DATA, CELLDATA.DATA AS CELL_DATA_DATA,
CELLDATA.CELL_TEMPLATE_ID AS CELL_DATA_TEMPLATE_ID, CELLDATA.CELL_TEMPLATE_ID AS CELL_DATA_TEMPLATE_ID,
CELLDATA.REPORT_ID AS CELL_DATA_REPORT_ID, CELLDATA.REPORT_ID AS CELL_DATA_REPORT_ID,
CELLDATASOURCE.ID AS CELL_DATA_SOURCE_ID, CELLDATASOURCE.ID AS CELL_DATA_SOURCE_ID,
CELLDATASOURCE.OPERATION_TYPE AS CELL_DATA_SOURCE_OPERATION_TYPE CELLDATASOURCE.OPERATION_TYPE AS OPERATION_TYPE
FROM FROM
CELL_DATA CELLDATA CELL_DATA CELLDATA
JOIN JOIN
...@@ -310,7 +310,7 @@ ...@@ -310,7 +310,7 @@
ON ON
CELLDATA.ID = CELLDATASOURCE.CELL_DATA_ID CELLDATA.ID = CELLDATASOURCE.CELL_DATA_ID
WHERE WHERE
CELLDATASOURCE.DATA_SOURCE_ID = #{dataSourceID,jdbcType=BIGINT} LIMIT 1 CELLDATASOURCE.DATA_SOURCE_ID = #{dataSourceID,jdbcType=BIGINT} AND ROWNUM = 1
</select> </select>
<!--DELETE FROM period_tax_rule_setting WHERE period=#{period,jdbcType=INTEGER};--> <!--DELETE FROM period_tax_rule_setting WHERE period=#{period,jdbcType=INTEGER};-->
......
...@@ -106,13 +106,13 @@ ...@@ -106,13 +106,13 @@
FROM FROM
PERIOD_CELL_TEMPLATE CT PERIOD_CELL_TEMPLATE CT
JOIN JOIN
REPORT R PERIOD_REPORT R
ON ON
CT.REPORT_TEMPLATE_ID = R.TEMPLATE_ID CT.REPORT_TEMPLATE_ID = R.TEMPLATE_ID
AND CT.PERIOD = R.PERIOD AND CT.PERIOD = R.PERIOD
WHERE WHERE
CT.CELL_TEMPLATE_ID = #{cellTemplateId,jdbcType=BIGINT} CT.CELL_TEMPLATE_ID = #{cellTemplateId,jdbcType=BIGINT}
AND R.ID = #{reportId,jdbcType=BIGINT} LIMIT 1 AND R.ID = #{reportId,jdbcType=BIGINT} AND ROWNUM = 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -306,7 +306,7 @@ ...@@ -306,7 +306,7 @@
AND CDS.CELL_DATA_ID = #{cellDataID,jdbcType=BIGINT} AND CDS.CELL_DATA_ID = #{cellDataID,jdbcType=BIGINT}
</select> </select>
<resultMap id="dataSourceCellDataDto" type="pwc.taxtech.atms.dto.vatdto.DataSourceCellDataDto"> <resultMap id="dataSourceCellDataDto" type="pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto">
<id column="ID" jdbcType="BIGINT" property="id"/> <id column="ID" jdbcType="BIGINT" property="id"/>
<association property="cellData" javaType="pwc.taxtech.atms.vat.entity.CellData"> <association property="cellData" javaType="pwc.taxtech.atms.vat.entity.CellData">
<id column="CELL_DATA_ID" jdbcType="BIGINT" property="id"/> <id column="CELL_DATA_ID" jdbcType="BIGINT" property="id"/>
...@@ -316,19 +316,19 @@ ...@@ -316,19 +316,19 @@
</association> </association>
<association property="cellDataSource" javaType="pwc.taxtech.atms.vat.entity.CellDataSource"> <association property="cellDataSource" javaType="pwc.taxtech.atms.vat.entity.CellDataSource">
<id column="CELL_DATA_SOURCE_ID" jdbcType="BIGINT" property="id"/> <id column="CELL_DATA_SOURCE_ID" jdbcType="BIGINT" property="id"/>
<result column="CELL_DATA_SOURCE_OPERATION_TYPE" property="operationType" javaType="java.lang.Integer" jdbcType="INTEGER"/> <result column="OPERATION_TYPE" property="operationType" javaType="java.lang.Integer" jdbcType="INTEGER"/>
</association> </association>
</resultMap> </resultMap>
<select id="getManualDataSource2" parameterType="java.lang.Long" resultMap="dataSourceCellDataDto"> <select id="getManualDataSource2" parameterType="java.lang.Long" resultMap="dataSourceCellDataDto">
SELECT SELECT
CELL_DATA_SOURCE.ID AS ID, CELLDATASOURCE.ID AS ID,
CELLDATA.ID AS CELL_DATA_ID, CELLDATA.ID AS CELL_DATA_ID,
CELLDATA.DATA AS CELL_DATA_DATA, CELLDATA.DATA AS CELL_DATA_DATA,
CELLDATA.CELL_TEMPLATE_ID AS CELL_DATA_TEMPLATE_ID, CELLDATA.CELL_TEMPLATE_ID AS CELL_DATA_TEMPLATE_ID,
CELLDATA.REPORT_ID AS CELL_DATA_REPORT_ID, CELLDATA.REPORT_ID AS CELL_DATA_REPORT_ID,
CELLDATASOURCE.ID AS CELL_DATA_SOURCE_ID, CELLDATASOURCE.ID AS CELL_DATA_SOURCE_ID,
CELLDATASOURCE.OPERATION_TYPE AS CELL_DATA_SOURCE_OPERATION_TYPE CELLDATASOURCE.OPERATION_TYPE AS OPERATION_TYPE
FROM FROM
PERIOD_CELL_DATA CELLDATA PERIOD_CELL_DATA CELLDATA
JOIN JOIN
...@@ -336,6 +336,6 @@ ...@@ -336,6 +336,6 @@
ON ON
CELLDATA.ID = CELLDATASOURCE.CELL_DATA_ID AND CELLDATA.PROJECT_ID = CELLDATASOURCE.PROJECT_ID CELLDATA.ID = CELLDATASOURCE.CELL_DATA_ID AND CELLDATA.PROJECT_ID = CELLDATASOURCE.PROJECT_ID
WHERE WHERE
CELLDATASOURCE.DATA_SOURCE_ID = #{dataSourceID,jdbcType=BIGINT} LIMIT 1 CELLDATASOURCE.DATA_SOURCE_ID = #{dataSourceID,jdbcType=BIGINT} AND ROWNUM = 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<div class="cell-info-subject"> <div class="cell-info-subject">
<label class="cell-info-subject-label">{{'CellValue' | translate}}:</label> <label class="cell-info-subject-label">{{'CellValue' | translate}}:</label>
<span title="{{detail.cellInfo.modifiedReportCell?detail.cellInfo.modifiedReportCell.comment:''}}">{{detail.cellInfo.money}}</span> <span title="{{detail.cellInfo.modifiedReportCell?detail.cellInfo.modifiedReportCell.comment:''}}">{{detail.cellInfo.money}}</span>
<a href="javascript:void(0)" ng-click="openModifyCellDataDialog()">{{'Change' | translate}}</a> <!--<a href="javascript:void(0)" ng-click="openModifyCellDataDialog()">{{'Change' | translate}}</a>-->
<a href="javascript:void(0)" ng-if="detail.cellInfo.modifiedReportCell != null" ng-click="resetReportCell()">{{'Reset' | translate}}</a> <a href="javascript:void(0)" ng-if="detail.cellInfo.modifiedReportCell != null" ng-click="resetReportCell()">{{'Reset' | translate}}</a>
</div> </div>
</div> </div>
......
...@@ -42,14 +42,14 @@ ...@@ -42,14 +42,14 @@
// citUpdateConfig: function (projectId, period?) // citUpdateConfig: function (projectId, period?)
// citGetTemplate: function (projectId, period?) // citGetTemplate: function (projectId, period?)
updateConfig: function (projectId, ifDeleteManualDataSource, period, generator) { updateConfig: function (projectId, ifDeleteManualDataSource, period, generator, isMergeManualDataSource) {
return $http.post('/Report/updateConfig/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true})); return $http.post('/Report/updateConfig/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator+ '&mergeManual='+isMergeManualDataSource, {}, apiConfig.createVat({ignoreLoadingBar: true}));
}, },
generate: function (projectId, templateId, ifDeleteManualDataSource, period, generator) { generate: function (projectId, templateId, ifDeleteManualDataSource, period, generator) {
return $http.post('/Report/generate/' + projectId + '/' + templateId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true})); return $http.post('/Report/generate/' + projectId + '/' + templateId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true}));
}, },
generateAll: function (projectId, ifDeleteManualDataSource, period, generator) { generateAll: function (projectId, ifDeleteManualDataSource, period, generator) {
return $http.post('/Report/generateByTotal/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true})); return $http.post('/Report/generateByTotal/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator , {}, apiConfig.createVat({ignoreLoadingBar: true}));
}, },
getReportData: function (reportId) { getReportData: function (reportId) {
return $http.get('/Report/reportData/' + reportId, apiConfig.createVat()); return $http.get('/Report/reportData/' + reportId, apiConfig.createVat());
...@@ -178,7 +178,11 @@ ...@@ -178,7 +178,11 @@
}, },
getDataSourceDetailList: function (dataSourceId) { getDataSourceDetailList: function (dataSourceId) {
return $http.get('/Report/getDataSourceDetailList/' + dataSourceId, apiConfig.createVat()); return $http.get('/Report/getDataSourceDetailList/' + dataSourceId, apiConfig.createVat());
},
hasManualDataSource: function (projectId, period) {
return $http.get('/Report/hasManualDataSource/' + projectId+ '/' +period, apiConfig.createVat());
} }
}; };
}]); }]);
\ No newline at end of file
...@@ -43,8 +43,8 @@ webservices.factory('projectService', ['$http', 'apiConfig', function ($http, ap ...@@ -43,8 +43,8 @@ webservices.factory('projectService', ['$http', 'apiConfig', function ($http, ap
isImportedAnyData: function (periodId,projectId) { isImportedAnyData: function (periodId,projectId) {
return $http.get('/ProjectStatusManage/isImportedAnyData/' + periodId + '/' + projectId, apiConfig.createVat()); return $http.get('/ProjectStatusManage/isImportedAnyData/' + periodId + '/' + projectId, apiConfig.createVat());
}, },
isProjectStatusExisted: function (dbName, periodId) { isProjectStatusExisted: function (projectId, periodId) {
return $http.get('/ProjectStatusManage/isProjectStatusExisted/' + dbName + '/' + periodId, apiConfig.createVat()); return $http.get('/ProjectStatusManage/isProjectStatusExisted/' + projectId + '/' + periodId, apiConfig.createVat());
}, },
getProjectAllStatus: function (projectId) { getProjectAllStatus: function (projectId) {
return $http.get('/project/getProjectAllStatus/' + projectId, apiConfig.create()); return $http.get('/project/getProjectAllStatus/' + projectId, apiConfig.create());
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
var taskList = []; var taskList = [];
var fixedRef = []; var fixedRef = [];
$scope.period = vatSessionService.month; $scope.period = vatSessionService.month;
$scope.isMergeManualDataSource = false;
$scope.moduleid = enums.vatModuleEnum.Import_CalculateData; $scope.moduleid = enums.vatModuleEnum.Import_CalculateData;
...@@ -118,7 +119,9 @@ ...@@ -118,7 +119,9 @@
//}, function () { //}, function () {
// taskError(_this); // taskError(_this);
//}); //});
vatReportService.updateConfig(vatSessionService.project.id, true, vatSessionService.month).success(function (data) { vatReportService.updateConfig(vatSessionService.project.id, true, vatSessionService.month,
vatSessionService.logUser.id ? vatSessionService.logUser.id : "",
$scope.isMergeManualDataSource ).success(function (data) {
var data = {result: true}; var data = {result: true};
updateProgress(data, _this); updateProgress(data, _this);
//vatReportService.getTemplateReferences(vatSessionService.month).then(function (refData) { //vatReportService.getTemplateReferences(vatSessionService.month).then(function (refData) {
...@@ -240,7 +243,8 @@ ...@@ -240,7 +243,8 @@
}); });
}; };
function doStartCaculate() { function doStartCaculate(isMergeManualDataSource) {
$scope.isMergeManualDataSource = isMergeManualDataSource;
$scope.readonly = true; $scope.readonly = true;
$scope.resolveRef.length = 0; $scope.resolveRef.length = 0;
$scope.resolveRef.push({ $scope.resolveRef.push({
...@@ -287,15 +291,38 @@ ...@@ -287,15 +291,38 @@
}, },
function (isConfirm) { function (isConfirm) {
if (isConfirm) { if (isConfirm) {
doStartCaculate(); 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) {
doStartCaculate(true);
}else{
doStartCaculate(false);
}
});
}else{
doStartCaculate(false);
}
});
}
else { else {
swal.close(); swal.close();
} }
}); });
} }
else { else {
doStartCaculate(); doStartCaculate(false);
} }
}; };
...@@ -323,18 +350,27 @@ ...@@ -323,18 +350,27 @@
}); });
if (unstarted) { if (unstarted) {
var readyTasks; var readyTasks;
var isGenedAll = false;
var isReport = false;
if (!_.isEmpty($scope.resolveRef)) { if (!_.isEmpty($scope.resolveRef)) {
readyTasks = _.reject($scope.tasks[task.seqNo + 1].items, function (t) { readyTasks = _.reject($scope.tasks[task.seqNo + 1].items, function (t) {
return _.some($scope.resolveRef, function (x) { return _.some($scope.resolveRef, function (x) {
if($scope.tasks[task.seqNo + 1].isReportTask)isReport=true;
return !x.resolved && x.referTo === t.id; return !x.resolved && x.referTo === t.id;
}); });
}); });
} }
else { else {
readyTasks = $scope.tasks[task.seqNo + 1].items; readyTasks = $scope.tasks[task.seqNo + 1].items;
if($scope.tasks[task.seqNo + 1].isReportTask)isReport=true;
} }
readyTasks.forEach(function (t) { readyTasks.forEach(function (t) {
t.doTask(); if(isReport&&!isGenedAll){
t.doTask();
isGenedAll=true;
}
t.status = 'processing'; t.status = 'processing';
t.text = $translate.instant(t.status); t.text = $translate.instant(t.status);
}); });
...@@ -376,8 +412,16 @@ ...@@ -376,8 +412,16 @@
var updateProgress = function (data, task, ifWriteLog) { var updateProgress = function (data, task, ifWriteLog) {
if (data && data.result) { if (data && data.result) {
task.status = 'completed'; if( $scope.tasks[task.seqNo].isReportTask){
task.text = $translate.instant(task.status); $scope.tasks[task.seqNo].items.forEach(function (t) {
t.status = 'completed';
t.text = $translate.instant(t.status);
});
}else{
task.status = 'completed';
task.text = $translate.instant(task.status);
}
} }
else { else {
task.status = 'error'; task.status = 'error';
......
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