Commit 7ba95455 authored by neo.wang's avatar neo.wang

Merge branch 'dev_oracle_neo' into 'dev_oracle'

Dev oracle neo

See merge request root/atms!168
parents 2fd1fa9c a32ca02b
......@@ -30,15 +30,17 @@ public class ReportController {
public OperationResultDto updateConfig(@PathVariable String projectId,
@PathVariable Boolean ifDeleteManualDataSource,
@PathVariable Integer period,
@RequestParam String generator) {
return reportService.updateConfig(projectId, period, ifDeleteManualDataSource, generator);
@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}/{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);
}
......@@ -124,4 +126,9 @@ public class ReportController {
public OperationResultDto<String> getDataSourceDetailList(@PathVariable Long 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
......@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pwc.taxtech.atms.common.CommonUtils;
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;
......@@ -156,7 +157,7 @@ public class ReportServiceImpl {
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);
PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample();
periodFormulaBlockExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
......@@ -183,10 +184,35 @@ public class ReportServiceImpl {
periodTaxPayerReportRuleMapper.deleteByExample(periodTaxPayerReportRuleExample);
PeriodDataSourceExample periodDataSourceExample = new PeriodDataSourceExample();
periodDataSourceExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodDataSourceExample.createCriteria().andProjectIdEqualTo(projectId)
.andPeriodEqualTo(period);
List<PeriodDataSource> periodDataSources = periodDataSourceMapper.selectByExample(periodDataSourceExample);
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.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period)
.andDataSourceIdIn(periodDsIds);
......@@ -197,7 +223,10 @@ public class ReportServiceImpl {
.andDataSourceIdIn(periodDsIds);
periodCellDataSourceMapper.deleteByExample(periodCellDataSourceExample);
periodDataSourceMapper.deleteByExample(periodDataSourceExample);
PeriodDataSourceExample periodDataSourceDeleteExample = new PeriodDataSourceExample();
periodDataSourceDeleteExample.createCriteria().andIdIn(periodDsIds);
periodDataSourceMapper.deleteByExample(periodDataSourceDeleteExample);
PeriodReportExample periodReportExample = new PeriodReportExample();
periodReportExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
......@@ -206,14 +235,21 @@ public class ReportServiceImpl {
List<Long> reportIds = Lists.newArrayList(Long.MAX_VALUE);
reportIds.addAll(reports.stream().map(m -> m.getId()).collect(Collectors.toList()));
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);
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();
try {
if (period == null) {
......@@ -240,7 +276,7 @@ public class ReportServiceImpl {
Long templateGroupId = projectMapper.getTemplateGroupIdByProject(projectId, EnumServiceType.VAT.getCode());
if (templateGroupId != null && templateGroupId != 0) {
// 先进行数据清理,包括period开头的所有报表配置表 条件Period
clearPeriodData(projectId, period, exceptTemplateIds);
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
// 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample example = new TemplateExample();
example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId);
......@@ -1180,4 +1216,8 @@ public class ReportServiceImpl {
return "";
}
}
public Boolean hasManualDataSource(String projectId, Integer period) {
return periodReportMapper.hasManualDataSource(projectId, period) > 0;
}
}
......@@ -3,6 +3,7 @@ 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.PeriodReport;
......@@ -105,4 +106,16 @@ public interface PeriodReportMapper extends MyVatMapper {
* @mbg.generated
*/
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
......@@ -42,14 +42,14 @@
// citUpdateConfig: function (projectId, period?)
// citGetTemplate: function (projectId, period?)
updateConfig: function (projectId, ifDeleteManualDataSource, period, generator) {
return $http.post('/Report/updateConfig/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true}));
updateConfig: function (projectId, ifDeleteManualDataSource, period, generator, isMergeManualDataSource) {
return $http.post('/Report/updateConfig/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator+ '&mergeManual='+isMergeManualDataSource, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
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}));
return $http.post('/Report/generateByTotal/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator , {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
getReportData: function (reportId) {
return $http.get('/Report/reportData/' + reportId, apiConfig.createVat());
......@@ -178,7 +178,11 @@
},
getDataSourceDetailList: function (dataSourceId) {
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
......@@ -11,6 +11,7 @@
var taskList = [];
var fixedRef = [];
$scope.period = vatSessionService.month;
$scope.isMergeManualDataSource = false;
$scope.moduleid = enums.vatModuleEnum.Import_CalculateData;
......@@ -118,7 +119,9 @@
//}, function () {
// 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};
updateProgress(data, _this);
//vatReportService.getTemplateReferences(vatSessionService.month).then(function (refData) {
......@@ -240,7 +243,8 @@
});
};
function doStartCaculate() {
function doStartCaculate(isMergeManualDataSource) {
$scope.isMergeManualDataSource = isMergeManualDataSource;
$scope.readonly = true;
$scope.resolveRef.length = 0;
$scope.resolveRef.push({
......@@ -287,15 +291,38 @@
},
function (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 {
swal.close();
}
});
});
}
else {
doStartCaculate();
doStartCaculate(false);
}
};
......
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