Commit e3a1ae3f authored by zhkwei's avatar zhkwei

Merge remote-tracking branch 'origin/dev_mysql' into dev_mysql

parents 6b2dadc1 d057309f
...@@ -37,9 +37,12 @@ public class AnalysisJob extends QuartzJobBean { ...@@ -37,9 +37,12 @@ public class AnalysisJob extends QuartzJobBean {
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
Integer period = DateUtils.getPeriodNow(); Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample(); OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true); //e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e); List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s机构数据",period));
analysisJobService.analysisMaster(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s预期返还税数据",period)); logger.info(String.format("开始分析%s预期返还税数据",period));
analysisJobService.analysisExpectedTax(orgs,period, EnumTbImportType.CoverImport.getCode()); analysisJobService.analysisExpectedTax(orgs,period, EnumTbImportType.CoverImport.getCode());
...@@ -49,15 +52,16 @@ public class AnalysisJob extends QuartzJobBean { ...@@ -49,15 +52,16 @@ public class AnalysisJob extends QuartzJobBean {
logger.info(String.format("开始分析%s档案管理数据",period)); logger.info(String.format("开始分析%s档案管理数据",period));
analysisJobService.analysisFileManagement(orgs,period, EnumTbImportType.CoverImport.getCode()); analysisJobService.analysisFileManagement(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s机构数据",period));
analysisJobService.analysisMaster(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s申报表数据",period)); logger.info(String.format("开始分析%s申报表数据",period));
analysisJobService.analysisSales(orgs,period, EnumTbImportType.CoverImport.getCode()); analysisJobService.analysisSales(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s返还后税数据",period)); logger.info(String.format("开始分析%s返还后税数据",period));
analysisJobService.analysisTaxReturnEnd(orgs,period, EnumTbImportType.CoverImport.getCode()); analysisJobService.analysisTaxReturnEnd(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%税种税金计算数据",period));
analysisJobService.analysisTax(orgs,period, EnumTbImportType.CoverImport.getCode());
} }
} }
...@@ -11,6 +11,7 @@ package pwc.taxtech.atms.common.util; ...@@ -11,6 +11,7 @@ package pwc.taxtech.atms.common.util;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration; import org.activiti.engine.ProcessEngineConfiguration;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.nutz.http.Http; import org.nutz.http.Http;
...@@ -23,6 +24,7 @@ import javax.servlet.ServletOutputStream; ...@@ -23,6 +24,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.List; import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
...@@ -379,4 +381,50 @@ public class FileExcelUtil { ...@@ -379,4 +381,50 @@ public class FileExcelUtil {
} }
} }
/**
*
* @param cell 获取值的单元格
* @param zero 是否将空 或者null转换成 zero
* @return
*/
public static Object getCellValue(Cell cell, Boolean zero) {
String cellValue = null;
switch (cell.getCellType()) {
case Cell.CELL_TYPE_STRING://字符串类型
cellValue = cell.getStringCellValue();
if (cellValue.trim().equals("") || cellValue.trim().length() <= 0)
cellValue = "";
break;
case Cell.CELL_TYPE_NUMERIC: //数值类型
cellValue = String.valueOf(cell.getNumericCellValue());
break;
case Cell.CELL_TYPE_FORMULA: //公式
cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
cellValue = String.valueOf(cell.getNumericCellValue());
break;
case Cell.CELL_TYPE_BLANK:
cellValue = "";
break;
case Cell.CELL_TYPE_BOOLEAN:
break;
case Cell.CELL_TYPE_ERROR:
break;
default:
break;
}
if("".equals(cellValue) && zero)
return BigDecimal.ZERO;
if(zero){
try{
return new BigDecimal(cellValue);
}catch (Exception e){
logger.warn("获取Cell,在值转换成数字的地方出错");
return BigDecimal.ZERO;
}
}
return cellValue;
}
} }
\ No newline at end of file
...@@ -71,28 +71,22 @@ public class OperationLogTaxDocController { ...@@ -71,28 +71,22 @@ public class OperationLogTaxDocController {
@RequestMapping("exportExcel") @RequestMapping("exportExcel")
@ResponseBody @ResponseBody
// public void exportExcelFile(HttpServletResponse response, @RequestBody OperationLogTaxDocument operationLogTaxDocument) { public void exportExcelFile(HttpServletResponse response, @RequestBody OperationLogTaxDocument operationLogTaxDocument) {
public void exportExcelFile(HttpServletResponse response) {
try { try {
Map<String, String> headers = new LinkedHashMap<>(); Map<String, String> headers = new LinkedHashMap<>();
headers.put("id", "id"); headers.put("id", "id");
// headers.put("operation_content", "操作内容");
// headers.put("module_name", "模块名称");
// headers.put("operation_object", "操作对象");
headers.put("operation_action", "操作action"); headers.put("operation_action", "操作action");
// headers.put("original_state", "原始状态");
// headers.put("update_state", "更新状态");
headers.put("update_state", "操作内容"); headers.put("update_state", "操作内容");
headers.put("operation_user", "操作者"); headers.put("operation_user", "操作者");
headers.put("ip", "操作ip"); headers.put("ip", "操作ip");
headers.put("comment", "内容"); headers.put("comment", "内容");
headers.put("create_time", "创建时间"); headers.put("create_time", "创建时间");
List<OperationLogTaxDocument> TaxDocuments = operationLogTaxDocService.selectTaxDocumentList(); List<String> ids = operationLogTaxDocument.getIds() == null ? Lists.newArrayList() : operationLogTaxDocument.getIds();
// List<String> ids = operationLogTaxDocument.getIds() == null ? Lists.newArrayList() : operationLogTaxDocument.getIds(); List<OperationLogTaxDocument> taxDocuments = operationLogTaxDocService.selectListForLog(ids);
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + new String("档案列表日志".getBytes("GB2312"), "ISO-8859-1")); response.setHeader("Content-Disposition", "attachment;fileName=" + new String("档案列表日志".getBytes("GB2312"), "ISO-8859-1"));
OutputStream ouputStream = response.getOutputStream(); OutputStream ouputStream = response.getOutputStream();
ExcelUtil.exportExcel(headers, TaxDocuments, ouputStream); ExcelUtil.exportExcel(headers, taxDocuments, ouputStream);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.*; import java.util.*;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.analysis.dao.*; import pwc.taxtech.atms.analysis.dao.*;
import pwc.taxtech.atms.analysis.entity.*; import pwc.taxtech.atms.analysis.entity.*;
import pwc.taxtech.atms.common.util.DateUtils; import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.common.util.FileExcelUtil;
import pwc.taxtech.atms.constant.enums.EnumTbImportType; import pwc.taxtech.atms.constant.enums.EnumTbImportType;
import pwc.taxtech.atms.dao.*; import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dpo.AnalysisSalesValueDto; import pwc.taxtech.atms.dpo.AnalysisSalesValueDto;
import pwc.taxtech.atms.dpo.ProjectAnaylsisDto; import pwc.taxtech.atms.dpo.ProjectAnaylsisDto;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.vat.dao.EbitSpreadDataMapper;
import pwc.taxtech.atms.vat.dao.PeriodCellDataMapper; import pwc.taxtech.atms.vat.dao.PeriodCellDataMapper;
import pwc.taxtech.atms.vat.dao.ProfitLossStatementFinalMapper; import pwc.taxtech.atms.vat.dao.ProfitLossStatementFinalMapper;
import pwc.taxtech.atms.vat.dao.TrialBalanceFinalMapper; import pwc.taxtech.atms.vat.dao.TrialBalanceFinalMapper;
import pwc.taxtech.atms.vat.entity.ProfitLossStatement; import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.entity.ProfitLossStatementExample;
import pwc.taxtech.atms.vat.entity.TrialBalanceFinal;
import pwc.taxtech.atms.vat.entity.TrialBalanceFinalExample;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.function.Function; import java.util.function.Function;
...@@ -99,15 +109,15 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -99,15 +109,15 @@ public class AnalysisJobServiceImpl extends BaseService {
* @return * @return
* @author Gary J Li * @author Gary J Li
*/ */
public void analysisMaster(List<Organization> orgs, Integer period,Integer type) { public void analysisMaster(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
if(type.equals(EnumTbImportType.CoverImport.getCode())){ if (type.equals(EnumTbImportType.CoverImport.getCode())) {
AnalysisMasterExample example = new AnalysisMasterExample(); AnalysisMasterExample example = new AnalysisMasterExample();
example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period); example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period);
analysisMasterMapper.deleteByExample(example); analysisMasterMapper.deleteByExample(example);
} }
OrganizationExample e1 = new OrganizationExample(); /* OrganizationExample e1 = new OrganizationExample();
e1.createCriteria().andIsActiveEqualTo(true); e1.createCriteria().andIsActiveEqualTo(true);*/
List<String> currencys = orgs.stream().map(Organization::getCurrencyCode).collect(Collectors.toList()); List<String> currencys = orgs.stream().map(Organization::getCurrencyCode).collect(Collectors.toList());
...@@ -136,7 +146,7 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -136,7 +146,7 @@ public class AnalysisJobServiceImpl extends BaseService {
try { try {
AnalysisMaster am = new AnalysisMaster(); AnalysisMaster am = new AnalysisMaster();
am.setId(idService.nextId()); am.setId(idService.nextId());
am.setSeqNo(o.getCode() + "" + period); am.setSeqNo(UUID.randomUUID().toString());
List<Organization> parents = orgs.stream().filter(org -> org.getId().equals(o.getParentId())).collect(Collectors.toList()); List<Organization> parents = orgs.stream().filter(org -> org.getId().equals(o.getParentId())).collect(Collectors.toList());
String parentAbbreviation = ""; String parentAbbreviation = "";
if (!parents.isEmpty()) { if (!parents.isEmpty()) {
...@@ -150,7 +160,7 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -150,7 +160,7 @@ public class AnalysisJobServiceImpl extends BaseService {
am.setName(o.getName()); am.setName(o.getName());
am.setArea(areaMap.get(o.getAreaId())); am.setArea(areaMap.get(o.getAreaId()));
am.setCountry(o.getCountry()); am.setCountry(o.getCountry());
am.setOrganizationId(o.getId());
String regionMeg = regionMap.get(o.getRegionId()); String regionMeg = regionMap.get(o.getRegionId());
List<String> regionMs = Lists.newArrayList(); List<String> regionMs = Lists.newArrayList();
if (StringUtils.isNotEmpty(regionMeg)) { if (StringUtils.isNotEmpty(regionMeg)) {
...@@ -179,6 +189,15 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -179,6 +189,15 @@ public class AnalysisJobServiceImpl extends BaseService {
} }
} }
public String getSeqNoByPeriod(String orgId, Integer period) {
AnalysisMasterExample analysisMasterExample = new AnalysisMasterExample();
analysisMasterExample.createCriteria().andPeriodEqualTo(period).andOrganizationIdEqualTo(orgId);
List<AnalysisMaster> analysisMasters = analysisMasterMapper.selectByExample(analysisMasterExample);
if (analysisMasters.size() != 0)
return analysisMasters.get(0).getSeqNo();
return null;
}
/** /**
* 19/03/2019 15:55 * 19/03/2019 15:55
* VAT、CIT申报表取数 * VAT、CIT申报表取数
...@@ -192,9 +211,9 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -192,9 +211,9 @@ public class AnalysisJobServiceImpl extends BaseService {
* @return * @return
* @author Gary J Li * @author Gary J Li
*/ */
public void analysisSales(List<Organization> orgs, Integer period,Integer type) { public void analysisSales(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
if(type.equals(EnumTbImportType.CoverImport.getCode())){ if (type.equals(EnumTbImportType.CoverImport.getCode())) {
AnalysisSalesExample example = new AnalysisSalesExample(); AnalysisSalesExample example = new AnalysisSalesExample();
example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period); example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period);
analysisSalesMapper.deleteByExample(example); analysisSalesMapper.deleteByExample(example);
...@@ -206,7 +225,8 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -206,7 +225,8 @@ public class AnalysisJobServiceImpl extends BaseService {
try { try {
AnalysisSales as = new AnalysisSales(); AnalysisSales as = new AnalysisSales();
as.setId(idService.nextId()); as.setId(idService.nextId());
as.setSeqNo(o.getCode() + "" + period); //as.setSeqNo(o.getCode() + "" + period);
as.setSeqNo(getSeqNoByPeriod(vatDto.getOrgId(), period));
List<AnalysisSalesValueDto> values = periodCellDataMapper.selectAnalysisSalesValueDto(vatDto.getReportId(), vatDto.getProjectId()); List<AnalysisSalesValueDto> values = periodCellDataMapper.selectAnalysisSalesValueDto(vatDto.getReportId(), vatDto.getProjectId());
...@@ -218,22 +238,22 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -218,22 +238,22 @@ public class AnalysisJobServiceImpl extends BaseService {
vMap.get(9 + ":" + 18); vMap.get(9 + ":" + 18);
// S-19 AJ-33 // S-19 AJ-33
BigDecimal segment1 = getSegmentAmount(vMap, 9, 18). BigDecimal segment1 = getSegmentAmount(vMap, 9, 18).
add(getSegmentAmount(vMap, 9, 32)). add(getSegmentAmount(vMap, 9, 35)).
add(getSegmentAmount(vMap, 13, 18)). add(getSegmentAmount(vMap, 13, 18)).
add(getSegmentAmount(vMap, 13, 32)). add(getSegmentAmount(vMap, 13, 35)).
add(getSegmentAmount(vMap, 15, 18)). add(getSegmentAmount(vMap, 15, 18)).
add(getSegmentAmount(vMap, 17, 18)); add(getSegmentAmount(vMap, 17, 18));
BigDecimal segment2 = getSegmentAmount(vMap, 19, 18).add(getSegmentAmount(vMap, 19, 32)); BigDecimal segment2 = getSegmentAmount(vMap, 19, 18).add(getSegmentAmount(vMap, 19, 35));
BigDecimal segment3 = getSegmentAmount(vMap, 20, 18).add(getSegmentAmount(vMap, 20, 32)); BigDecimal segment3 = getSegmentAmount(vMap, 20, 18).add(getSegmentAmount(vMap, 20, 35));
BigDecimal segment4 = getSegmentAmount(vMap, 22, 18).add(getSegmentAmount(vMap, 22, 32)); BigDecimal segment4 = getSegmentAmount(vMap, 22, 18).add(getSegmentAmount(vMap, 22, 35));
BigDecimal segment5 = getSegmentAmount(vMap, 21, 18).add(getSegmentAmount(vMap, 21, 32)); BigDecimal segment5 = getSegmentAmount(vMap, 21, 18).add(getSegmentAmount(vMap, 21, 35));
BigDecimal segment6 = getSegmentAmount(vMap, 28, 18).add(getSegmentAmount(vMap, 28, 32)); BigDecimal segment6 = getSegmentAmount(vMap, 28, 18).add(getSegmentAmount(vMap, 28, 35));
BigDecimal segment7 = getSegmentAmount(vMap, 29, 18).add(getSegmentAmount(vMap, 29, 32)); BigDecimal segment7 = getSegmentAmount(vMap, 29, 18).add(getSegmentAmount(vMap, 29, 35));
BigDecimal segment8 = getSegmentAmount(vMap, 31, 18).add(getSegmentAmount(vMap, 31, 32)); BigDecimal segment8 = getSegmentAmount(vMap, 31, 18).add(getSegmentAmount(vMap, 31, 35));
BigDecimal segment9 = getSegmentAmount(vMap, 32, 18).add(getSegmentAmount(vMap, 32, 32)); BigDecimal segment9 = getSegmentAmount(vMap, 32, 18).add(getSegmentAmount(vMap, 32, 35));
BigDecimal segment10 = getSegmentAmount(vMap, 35, 18).add(getSegmentAmount(vMap, 35, 32)); BigDecimal segment10 = getSegmentAmount(vMap, 35, 18).add(getSegmentAmount(vMap, 35, 35));
BigDecimal segment11 = getSegmentAmount(vMap, 42, 18).add(getSegmentAmount(vMap, 42, 32)); BigDecimal segment11 = getSegmentAmount(vMap, 42, 18).add(getSegmentAmount(vMap, 42, 35));
// 查询小微纳税人表 // 查询小微纳税人表
List<ProjectAnaylsisDto> tinyDto = projectMapper.getTemlateWithServiceType2(vatDto.getOrgId(), period / 100, period % 100, "VAT100"); List<ProjectAnaylsisDto> tinyDto = projectMapper.getTemlateWithServiceType2(vatDto.getOrgId(), period / 100, period % 100, "VAT100");
...@@ -247,7 +267,7 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -247,7 +267,7 @@ public class AnalysisJobServiceImpl extends BaseService {
Map<String, String> tvMap = new HashMap<>(); Map<String, String> tvMap = new HashMap<>();
tinyValues.forEach(v -> { tinyValues.forEach(v -> {
tvMap.put(v.getRowIndex() + "" + v.getColumnIndex(), v.getData()); tvMap.put(v.getRowIndex() + ":" + v.getColumnIndex(), v.getData());
}); });
//E10+F10+E15+F15+E18+F18+E21+F21+E25+F25 //E10+F10+E15+F15+E18+F18+E21+F21+E25+F25
...@@ -282,7 +302,7 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -282,7 +302,7 @@ public class AnalysisJobServiceImpl extends BaseService {
as.setSegment12(segment12); as.setSegment12(segment12);
as.setSegment13(segment13); as.setSegment13(segment13);
as.setSegment14(segment14); as.setSegment14(segment14);
setEbitData(as, o.getId(), period);
segment1 = segment1.add(segment1Tiny); segment1 = segment1.add(segment1Tiny);
segment9 = segment9.add(segment9Tiny); segment9 = segment9.add(segment9Tiny);
segment10 = segment10.add(segment10Tiny); segment10 = segment10.add(segment10Tiny);
...@@ -299,9 +319,10 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -299,9 +319,10 @@ public class AnalysisJobServiceImpl extends BaseService {
as.setSegment9(segment9); as.setSegment9(segment9);
as.setSegment10(segment10); as.setSegment10(segment10);
as.setSegment11(segment11); as.setSegment11(segment11);
as.setSegment15(getPLData(vatDto, "一、营业收入")); /* as.setSegment15(getPLData(vatDto, "一、营业收入"));
as.setSegment16(getPLData(vatDto, "减:营业成本")); as.setSegment16(getPLData(vatDto, "减:营业成本"));
as.setSegment17(getPLData(vatDto, "三、利润总额(亏损总额以“-”号填列)")); as.setSegment17(getPLData(vatDto, "三、利润总额(亏损总额以“-”号填列)"));*/
setEbitData(as, o.getId(), period);
//todo segment18需求未定义 //todo segment18需求未定义
as.setOrganizationId(o.getId()); as.setOrganizationId(o.getId());
as.setCompanyName(o.getName()); as.setCompanyName(o.getName());
...@@ -312,7 +333,65 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -312,7 +333,65 @@ public class AnalysisJobServiceImpl extends BaseService {
} }
}); });
}
@Autowired
private EbitSpreadDataMapper ebitSpreadDataMapper;
@Autowired
private DidiFileUploadService didiFileUploadService;
@Autowired
private HttpFileService httpFileService;
private void setEbitData(AnalysisSales analysisSales, String orgId, Integer period) {
EbitSpreadDataExample example = new EbitSpreadDataExample();
example.createCriteria().andPeriodEqualTo(period).andOrganizationIdEqualTo(orgId);
List<EbitSpreadData> ebitSpreadData = ebitSpreadDataMapper.selectByExample(example);
if (ebitSpreadData.size() != 0) {
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(Arrays.asList(ebitSpreadData.get(0).getFileKey()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
String path = null;
if (CollectionUtils.isNotEmpty(uploadDetail.getList())) {
path = uploadDetail.getList().get(0).getViewHttpUrl();
}
InputStream inputStream = httpFileService.getUserTemplate(path);
Workbook workbook = null;
try {
workbook = WorkbookFactory.create(inputStream);
Sheet sheet = workbook.getSheetAt(0);
analysisSales.setSegment15((BigDecimal) FileExcelUtil.getCellValue(sheet.getRow(11).getCell(1), true));
analysisSales.setSegment15((BigDecimal) FileExcelUtil.getCellValue(sheet.getRow(12).getCell(1), true));
analysisSales.setSegment15((BigDecimal) FileExcelUtil.getCellValue(sheet.getRow(27).getCell(1), true));
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidFormatException e) {
e.printStackTrace();
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} else {
// 查询利润表
List<AnalysisSalesValueDto> tinyValues = Lists.newArrayList();
List<ProjectAnaylsisDto> tinyDto = projectMapper.getTemlateWithServiceType2(orgId, period / 100, period % 100, "VAT10086");
if (!tinyDto.isEmpty()) {
tinyValues = periodCellDataMapper.selectAnalysisSalesValueDto(tinyDto.get(0).getReportId(), tinyDto.get(0).getProjectId());
}
if (!tinyValues.isEmpty()) {
Map<String, String> tvMap = new HashMap<>();
tinyValues.forEach(v -> {
tvMap.put(v.getRowIndex() + ":" + v.getColumnIndex(), v.getData());
});
analysisSales.setSegment15(getSegmentAmount(tvMap, 11, 1));
analysisSales.setSegment15(getSegmentAmount(tvMap, 12, 1));
analysisSales.setSegment15(getSegmentAmount(tvMap, 27, 1));
}
}
} }
...@@ -339,9 +418,9 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -339,9 +418,9 @@ public class AnalysisJobServiceImpl extends BaseService {
* @return * @return
* @author Gary J Li * @author Gary J Li
*/ */
public void analysisTaxReturnEnd(List<Organization> orgs, Integer period,Integer type) { public void analysisTaxReturnEnd(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
if(type.equals(EnumTbImportType.CoverImport.getCode())){ if (type.equals(EnumTbImportType.CoverImport.getCode())) {
AnalysisTaxReturnEndExample example = new AnalysisTaxReturnEndExample(); AnalysisTaxReturnEndExample example = new AnalysisTaxReturnEndExample();
example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period); example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period);
analysisTaxReturnEndMapper.deleteByExample(example); analysisTaxReturnEndMapper.deleteByExample(example);
...@@ -370,7 +449,7 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -370,7 +449,7 @@ public class AnalysisJobServiceImpl extends BaseService {
private void generalAnaysisReturnTaxEnd(Organization org, List<AnalysisTax> orgATList, List<AnalysisActualTaxReturn> aatrs) { private void generalAnaysisReturnTaxEnd(Organization org, List<AnalysisTax> orgATList, List<AnalysisActualTaxReturn> aatrs) {
BigDecimal selfTax = new BigDecimal(0); BigDecimal selfTax = new BigDecimal(0);
if(null!=orgATList){ if (null != orgATList) {
for (AnalysisTax at : orgATList) { for (AnalysisTax at : orgATList) {
if ("员工个税".equals(at.getTaxGroup()) || "司机个税".equals(at.getTaxGroup())) { if ("员工个税".equals(at.getTaxGroup()) || "司机个税".equals(at.getTaxGroup())) {
selfTax.add(at.getTaxAmount()); selfTax.add(at.getTaxAmount());
...@@ -380,11 +459,11 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -380,11 +459,11 @@ public class AnalysisJobServiceImpl extends BaseService {
taxReturnEnd.setOrganizationId(org.getId()); taxReturnEnd.setOrganizationId(org.getId());
taxReturnEnd.setCompanyName(at.getCompanyName()); taxReturnEnd.setCompanyName(at.getCompanyName());
taxReturnEnd.setPeriod(at.getPeriod()); taxReturnEnd.setPeriod(at.getPeriod());
taxReturnEnd.setSeqNo(org.getCode() + "" + at.getPeriod()); taxReturnEnd.setSeqNo(at.getSeqNo());
taxReturnEnd.setTaxGroup(at.getTaxGroup()); taxReturnEnd.setTaxGroup(at.getTaxGroup());
BigDecimal taxAmount = at.getTaxAmount(); BigDecimal taxAmount = at.getTaxAmount();
// 该机构返还税信息不空时进行计算 // 该机构返还税信息不空时进行计算
if(null!=aatrs){ if (null != aatrs) {
if ("城建税".equals(at.getTaxGroup())) { if ("城建税".equals(at.getTaxGroup())) {
String returnTaxName = "城建税返还"; String returnTaxName = "城建税返还";
for (AnalysisActualTaxReturn attr : aatrs) { for (AnalysisActualTaxReturn attr : aatrs) {
...@@ -437,15 +516,15 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -437,15 +516,15 @@ public class AnalysisJobServiceImpl extends BaseService {
selfTaxReturnEnd.setOrganizationId(org.getId()); selfTaxReturnEnd.setOrganizationId(org.getId());
selfTaxReturnEnd.setCompanyName(orgATList.get(0).getCompanyName()); selfTaxReturnEnd.setCompanyName(orgATList.get(0).getCompanyName());
selfTaxReturnEnd.setPeriod(orgATList.get(0).getPeriod()); selfTaxReturnEnd.setPeriod(orgATList.get(0).getPeriod());
selfTaxReturnEnd.setSeqNo(org.getCode() + "" + orgATList.get(0).getPeriod()); selfTaxReturnEnd.setSeqNo(orgATList.get(0).getSeqNo());
selfTaxReturnEnd.setTaxGroup(orgATList.get(0).getTaxGroup()); selfTaxReturnEnd.setTaxGroup(orgATList.get(0).getTaxGroup());
BigDecimal taxAmount = selfTax.subtract(selfTaxReturn); BigDecimal taxAmount = selfTax.subtract(selfTaxReturn);
selfTaxReturnEnd.setTaxAmount(taxAmount); selfTaxReturnEnd.setTaxAmount(taxAmount);
analysisTaxReturnEndMapper.insertSelective(selfTaxReturnEnd); analysisTaxReturnEndMapper.insertSelective(selfTaxReturnEnd);
} }
} }
/** /**
* 19/03/2019 15:57 * 19/03/2019 15:57
* analysis_tax 与 organization_return_rate 计算预期返还税额 * analysis_tax 与 organization_return_rate 计算预期返还税额
...@@ -454,10 +533,10 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -454,10 +533,10 @@ public class AnalysisJobServiceImpl extends BaseService {
* @return * @return
* @author Gary J Li * @author Gary J Li
*/ */
public void analysisExpectedTax(List<Organization> orgs, Integer period,Integer type) { public void analysisExpectedTax(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
if(type.equals(EnumTbImportType.CoverImport.getCode())){ if (type.equals(EnumTbImportType.CoverImport.getCode())) {
AnalysisExpectedTaxReturnExample example = new AnalysisExpectedTaxReturnExample(); AnalysisExpectedTaxReturnExample example = new AnalysisExpectedTaxReturnExample();
example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period); example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period);
analysisExpectedTaxReturnMapper.deleteByExample(example); analysisExpectedTaxReturnMapper.deleteByExample(example);
...@@ -509,9 +588,9 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -509,9 +588,9 @@ public class AnalysisJobServiceImpl extends BaseService {
* @return * @return
* @author Gary J Li * @author Gary J Li
*/ */
public void analysisFee(List<Organization> orgs, Integer period,Integer type) { public void analysisFee(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
if(type.equals(EnumTbImportType.CoverImport.getCode())){ if (type.equals(EnumTbImportType.CoverImport.getCode())) {
AnalysisFeeExample example = new AnalysisFeeExample(); AnalysisFeeExample example = new AnalysisFeeExample();
example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period); example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period);
analysisFeeMapper.deleteByExample(example); analysisFeeMapper.deleteByExample(example);
...@@ -531,7 +610,7 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -531,7 +610,7 @@ public class AnalysisJobServiceImpl extends BaseService {
af.setId(idService.nextId()); af.setId(idService.nextId());
Organization org = orgMap.get(k); Organization org = orgMap.get(k);
String subjectCode = tb.getSegment3(); String subjectCode = tb.getSegment3();
af.setSeqNo(org.getCode() + "" + period); af.setSeqNo(getSeqNoByPeriod(tb.getOrganizationId(), period));
af.setSubject(subjectCode); af.setSubject(subjectCode);
af.setFeeClassification1(tb.getAcctName1()); af.setFeeClassification1(tb.getAcctName1());
af.setFeeClassification2(tb.getAcctName2()); af.setFeeClassification2(tb.getAcctName2());
...@@ -562,9 +641,9 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -562,9 +641,9 @@ public class AnalysisJobServiceImpl extends BaseService {
* @return * @return
* @author Gary J Li * @author Gary J Li
*/ */
public void analysisFileManagement(List<Organization> orgs, Integer period,Integer type) { public void analysisFileManagement(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
if(type.equals(EnumTbImportType.CoverImport.getCode())){ if (type.equals(EnumTbImportType.CoverImport.getCode())) {
AnalysisFileManagementExample example = new AnalysisFileManagementExample(); AnalysisFileManagementExample example = new AnalysisFileManagementExample();
example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period); example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period);
analysisFileManagementMapper.deleteByExample(example); analysisFileManagementMapper.deleteByExample(example);
...@@ -580,20 +659,20 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -580,20 +659,20 @@ public class AnalysisJobServiceImpl extends BaseService {
Map<String, List<OrganizationTaxRule>> ruleMap = taxRules.stream().collect(Collectors.groupingBy(OrganizationTaxRule::getGroupName)); Map<String, List<OrganizationTaxRule>> ruleMap = taxRules.stream().collect(Collectors.groupingBy(OrganizationTaxRule::getGroupName));
for(TaxDocument td : taxDocuments){ for (TaxDocument td : taxDocuments) {
Organization o = orgMap.get(td.getCompanyId()); Organization o = orgMap.get(td.getCompanyId());
AnalysisFileManagement afm = new AnalysisFileManagement(); AnalysisFileManagement afm = new AnalysisFileManagement();
afm.setId(idService.nextId()); afm.setId(idService.nextId());
afm.setSeqNo(o.getCode() + "" + period); afm.setSeqNo(getSeqNoByPeriod(o.getId(), period));
afm.setFileType(td.getFileType()); afm.setFileType(td.getFileType());
// 周期性上传 校验当年的当前及之前的周期是否有上传文件 // 周期性上传 校验当年的当前及之前的周期是否有上传文件
if (StringUtils.isNotEmpty(td.getTaxType()) && null != td.getOwnTime()) { if (StringUtils.isNotEmpty(td.getTaxType()) && null != td.getOwnTime()) {
List<OrganizationTaxRule> otrs = ruleMap.get(td.getTaxType()); List<OrganizationTaxRule> otrs = ruleMap.get(td.getTaxType());
Optional<OrganizationTaxRule> otrOP= otrs.stream().filter(otr->otr.getGroupName().equals(td.getTaxType())).map(OrganizationTaxRule::getUpdateTime).max(new ComparatorDate()); Optional<OrganizationTaxRule> otrOP = otrs.stream().filter(otr -> otr.getGroupName().equals(td.getTaxType())).map(OrganizationTaxRule::getUpdateTime).max(new ComparatorDate());
OrganizationTaxRule rule = otrOP.get(); OrganizationTaxRule rule = otrOP.get();
if(null==rule){ if (null == rule) {
break; break;
} }
...@@ -619,7 +698,7 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -619,7 +698,7 @@ public class AnalysisJobServiceImpl extends BaseService {
archivingStatus = taxDocumentMapper.countByExample(example) > 0 ? "已归档" : archivingStatus; archivingStatus = taxDocumentMapper.countByExample(example) > 0 ? "已归档" : archivingStatus;
} }
afm.setArchivingStatus(archivingStatus); afm.setArchivingStatus(archivingStatus);
}else{ } else {
afm.setReportingFrequency("/"); afm.setReportingFrequency("/");
// 由于是根据文档列表查询 必然已归档 // 由于是根据文档列表查询 必然已归档
afm.setArchivingStatus("已归档"); afm.setArchivingStatus("已归档");
...@@ -631,6 +710,72 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -631,6 +710,72 @@ public class AnalysisJobServiceImpl extends BaseService {
} }
} }
public void analysisTax(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
if (type.equals(EnumTbImportType.CoverImport.getCode())) {
AnalysisTaxExample example = new AnalysisTaxExample();
example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period).andTaxGroupNotEqualTo("企业所得税")
.andTaxGroupNotEqualTo("员工个税")
.andTaxGroupNotEqualTo("印花税")
.andTaxGroupNotEqualTo("司机个税")
.andTaxGroupNotEqualTo("返还后增值税")
.andTaxGroupNotEqualTo("返还后个人所得税")
.andTaxGroupNotEqualTo("员工个税");
analysisTaxMapper.deleteByExample(example);
}
List<ProjectAnaylsisDto> vatDtos = projectMapper.getTemlateWithServiceType(orgIds, period / 100, period % 100, "增值税纳税申报表");
Map<String, Organization> orgMap = orgs.stream().collect(Collectors.toMap(Organization::getId, Function.identity()));
vatDtos.forEach(vatDto -> {
Organization o = orgMap.get(vatDto.getOrgId());
try {
AnalysisTax as = new AnalysisTax();
as.setId(idService.nextId());
as.setTaxGroup("增值税");
as.setSeqNo(getSeqNoByPeriod(vatDto.getOrgId(), period));
List<AnalysisSalesValueDto> values = periodCellDataMapper.selectAnalysisSalesValueDto(vatDto.getReportId(), vatDto.getProjectId());
Map<String, String> vMap = new HashMap<>();
values.forEach(v -> {
vMap.put(v.getRowIndex() + ":" + v.getColumnIndex(), v.getData());
});
BigDecimal zzse = getSegmentAmount(vMap, 42, 35).add(getSegmentAmount(vMap, 42, 18));
analysisTaxMapper.insertSelective(as);
} catch (Exception e) {
logger.error(String.format("公司:[%s]生成应缴税额表分析数据失败!", o.getName()), e);
}
});
//企业所得税
List<ProjectAnaylsisDto> qysdsDto = projectMapper.getTemlateWithServiceType(orgIds, period / 100, period % 100, "企业所得税纳税申报表");
qysdsDto.forEach(qd -> {
Organization o = orgMap.get(qd.getOrgId());
try {
AnalysisTax as = new AnalysisTax();
as.setId(idService.nextId());
as.setTaxGroup("企业所得税");
as.setSeqNo(getSeqNoByPeriod(qd.getOrgId(), period));
List<AnalysisSalesValueDto> values = periodCellDataMapper.selectAnalysisSalesValueDto(qd.getReportId(), qd.getProjectId());
Map<String, String> vMap = new HashMap<>();
values.forEach(v -> {
vMap.put(v.getRowIndex() + ":" + v.getColumnIndex(), v.getData());
});
BigDecimal zzse = getSegmentAmount(vMap, 42, 35).add(getSegmentAmount(vMap, 42, 18));
analysisTaxMapper.insertSelective(as);
} catch (Exception e) {
logger.error(String.format("公司:[%s]生成应缴税额表分析数据失败!", o.getName()), e);
}
});
}
public class ComparatorDate implements Comparator { public class ComparatorDate implements Comparator {
public static final String TAG = "ComparatorDate"; public static final String TAG = "ComparatorDate";
......
...@@ -285,7 +285,7 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -285,7 +285,7 @@ public class AnalysisServiceImpl extends BaseService {
AnalysisTax model = new AnalysisTax(); AnalysisTax model = new AnalysisTax();
model.setId(idService.nextId()); model.setId(idService.nextId());
model.setOrganizationId(org.getId()); model.setOrganizationId(org.getId());
model.setSeqNo(org.getCode()+""+period); model.setSeqNo(getSeqNoByPeriod(org.getId(), period));
model.setPeriod(period); model.setPeriod(period);
model.setCompanyName(org.getName()); model.setCompanyName(org.getName());
model.setTaxGroup(getCellStringValue(sheet.getRow(0).getCell(k))); model.setTaxGroup(getCellStringValue(sheet.getRow(0).getCell(k)));
...@@ -293,6 +293,16 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -293,6 +293,16 @@ public class AnalysisServiceImpl extends BaseService {
return model; return model;
} }
public String getSeqNoByPeriod(String orgId, Integer period){
AnalysisMasterExample analysisMasterExample = new AnalysisMasterExample();
analysisMasterExample.createCriteria().andPeriodEqualTo(period).andOrganizationIdEqualTo(orgId);
List<AnalysisMaster> analysisMasters = analysisMasterMapper.selectByExample(analysisMasterExample);
if(analysisMasters.size() != 0)
return analysisMasters.get(0).getSeqNo();
return null;
}
private void importAnalysisReturnTaxExcelFile(MultipartFile file, String periodDate) { private void importAnalysisReturnTaxExcelFile(MultipartFile file, String periodDate) {
try{ try{
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
...@@ -346,7 +356,7 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -346,7 +356,7 @@ public class AnalysisServiceImpl extends BaseService {
AnalysisActualTaxReturn model = new AnalysisActualTaxReturn(); AnalysisActualTaxReturn model = new AnalysisActualTaxReturn();
model.setId(idService.nextId()); model.setId(idService.nextId());
model.setOrganizationId(org.getId()); model.setOrganizationId(org.getId());
model.setSeqNo(org.getCode()+""+period); model.setSeqNo(getSeqNoByPeriod(org.getId(), period));
model.setPeriod(period); model.setPeriod(period);
model.setCompanyName(org.getName()); model.setCompanyName(org.getName());
model.setTaxReturnGroup(getCellStringValue(sheet.getRow(0).getCell(k))); model.setTaxReturnGroup(getCellStringValue(sheet.getRow(0).getCell(k)));
...@@ -381,6 +391,10 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -381,6 +391,10 @@ public class AnalysisServiceImpl extends BaseService {
model.setInternAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(2))); model.setInternAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(2)));
model.setVendorAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(3))); model.setVendorAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(3)));
model.setTotalAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(4))); model.setTotalAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(4)));
//通过公司名称查询orgId
OrganizationExample example = new OrganizationExample();
example.createCriteria().andNameEqualTo(getCellStringValue(sheet.getRow(j).getCell(0)));
model.setSeqNo(getSeqNoByPeriod(organizationMapper.selectByExample(example).get(0).getId(), Integer.parseInt(periodDate)));
lists.add(model); lists.add(model);
} }
AnalysisEmployeeNumExample example = new AnalysisEmployeeNumExample(); AnalysisEmployeeNumExample example = new AnalysisEmployeeNumExample();
...@@ -487,7 +501,6 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -487,7 +501,6 @@ public class AnalysisServiceImpl extends BaseService {
throw new ServiceException(e); throw new ServiceException(e);
} }
} }
private void importAnalysisInterTaxDataExcelFile(MultipartFile file, String periodDate, private void importAnalysisInterTaxDataExcelFile(MultipartFile file, String periodDate,
String companyName,String country) { String companyName,String country) {
try{ try{
......
...@@ -64,19 +64,19 @@ public class TaxDocumentServiceImpl { ...@@ -64,19 +64,19 @@ public class TaxDocumentServiceImpl {
private OrganizationServiceImpl organizationService; private OrganizationServiceImpl organizationService;
public List<TaxDocument> selectTaxDocumentList(TaxDocumentDto taxDocumentDto,List<String> orgIds) { public List<TaxDocument> selectTaxDocumentList(TaxDocumentDto taxDocumentDto, List<String> orgIds) {
List<TaxDocument> dataList = taxDocumentMapper.selectByExample(getExample(taxDocumentDto,orgIds)); List<TaxDocument> dataList = taxDocumentMapper.selectByExample(getExample(taxDocumentDto, orgIds));
DidiFileIUploadParam fileParam = new DidiFileIUploadParam(); DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(dataList.stream() fileParam.setUuids(dataList.stream()
.map(o -> o.getFileUploadId()).collect(Collectors.toList())); .map(o -> o.getFileUploadId()).collect(Collectors.toList()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam); PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
Map<String,String> urlMap = null; Map<String, String> urlMap = null;
if(CollectionUtils.isNotEmpty(uploadDetail.getList())){ if (CollectionUtils.isNotEmpty(uploadDetail.getList())) {
urlMap = uploadDetail.getList().stream().collect(Collectors.toMap(DidiFileUploadDetailResult::getUid, didiFileUploadDetailResult -> didiFileUploadDetailResult.getViewHttpUrl())); urlMap = uploadDetail.getList().stream().collect(Collectors.toMap(DidiFileUploadDetailResult::getUid, didiFileUploadDetailResult -> didiFileUploadDetailResult.getViewHttpUrl()));
} }
if(urlMap!=null){ if (urlMap != null) {
for(TaxDocument data:dataList){ for (TaxDocument data : dataList) {
data.setFilePositionUrl(urlMap.get(data.getFileUploadId())); data.setFilePositionUrl(urlMap.get(data.getFileUploadId()));
} }
} }
...@@ -92,7 +92,7 @@ public class TaxDocumentServiceImpl { ...@@ -92,7 +92,7 @@ public class TaxDocumentServiceImpl {
* @param taxDocumentDto * @param taxDocumentDto
* @return * @return
*/ */
private TaxDocumentExample getExample(TaxDocumentDto taxDocumentDto,List<String> orgIds) { private TaxDocumentExample getExample(TaxDocumentDto taxDocumentDto, List<String> orgIds) {
TaxDocumentExample example = new TaxDocumentExample(); TaxDocumentExample example = new TaxDocumentExample();
TaxDocumentExample.Criteria criteria = example.createCriteria(); TaxDocumentExample.Criteria criteria = example.createCriteria();
criteria.andCompanyIdIn(orgIds); criteria.andCompanyIdIn(orgIds);
...@@ -172,6 +172,10 @@ public class TaxDocumentServiceImpl { ...@@ -172,6 +172,10 @@ public class TaxDocumentServiceImpl {
if (StringUtils.isNotBlank(taxDocumentDto.getCreator())) { if (StringUtils.isNotBlank(taxDocumentDto.getCreator())) {
criteria.andCreatorLike("%" + taxDocumentDto.getCreator() + "%"); criteria.andCreatorLike("%" + taxDocumentDto.getCreator() + "%");
} }
//ids
if (null != taxDocumentDto.getIds() && taxDocumentDto.getIds().size() > 0) {
criteria.andIdIn(taxDocumentDto.getIds());
}
//设置查询可用的数据 //设置查询可用的数据
criteria.andEnableEqualTo("T"); criteria.andEnableEqualTo("T");
example.setOrderByClause("create_time DESC"); example.setOrderByClause("create_time DESC");
...@@ -182,27 +186,27 @@ public class TaxDocumentServiceImpl { ...@@ -182,27 +186,27 @@ public class TaxDocumentServiceImpl {
public synchronized boolean addTaxDocumentList(MultipartFile file, TaxDocument taxDocument) { public synchronized boolean addTaxDocumentList(MultipartFile file, TaxDocument taxDocument) {
try { try {
//上传文件 //上传文件
if(StringUtils.isBlank(taxDocument.getFileUploadId())){ if (StringUtils.isBlank(taxDocument.getFileUploadId())) {
if(ReportFileUploadEnum.ReportType.MAPPING.containsKey(taxDocument.getFileType())){ if (ReportFileUploadEnum.ReportType.MAPPING.containsKey(taxDocument.getFileType())) {
//重新命名 //重新命名
String fileName = taxDocument.getCompanyName()+"_"+taxDocument.getFileType()+"_"+taxDocument.getOwnTime(); String fileName = taxDocument.getCompanyName() + "_" + taxDocument.getFileType() + "_" + taxDocument.getOwnTime();
fileName+=file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); fileName += file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
FileUpload fileUpload = didiFileUploadService.uploadFile(file,fileName, FileUploadEnum.BizSource.RECORD_UPLOAD.name()); FileUpload fileUpload = didiFileUploadService.uploadFile(file, fileName, FileUploadEnum.BizSource.RECORD_UPLOAD.name());
taxDocument.setFileUploadId(fileUpload.getUid()); taxDocument.setFileUploadId(fileUpload.getUid());
taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl()); taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl());
taxDocument.setFileName(fileName); taxDocument.setFileName(fileName);
ReportFileUpload reportFileUpload = new ReportFileUpload(); ReportFileUpload reportFileUpload = new ReportFileUpload();
reportFileUpload.setOrgId(taxDocument.getCompanyId()); reportFileUpload.setOrgId(taxDocument.getCompanyId());
reportFileUpload.setSourceType(ReportFileUploadEnum.SuorceType.RECORD.name()); reportFileUpload.setSourceType(ReportFileUploadEnum.SuorceType.RECORD.name());
String period = String.valueOf(taxDocument.getOwnTime()).substring(0,6); String period = String.valueOf(taxDocument.getOwnTime()).substring(0, 6);
reportFileUpload.setPeriod(Integer.valueOf(period)); reportFileUpload.setPeriod(Integer.valueOf(period));
reportFileUpload.setFileUploadId(fileUpload.getUid()); reportFileUpload.setFileUploadId(fileUpload.getUid());
reportFileUpload.setReportType(taxDocument.getFileType()); reportFileUpload.setReportType(taxDocument.getFileType());
reportFileUpload.setReportFileName(fileName); reportFileUpload.setReportFileName(fileName);
reportFileUploadService.saveData(file,reportFileUpload); reportFileUploadService.saveData(file, reportFileUpload);
}else{ } else {
FileUpload fileUpload = didiFileUploadService.uploadFile(file,file.getOriginalFilename(), FileUploadEnum.BizSource.RECORD_UPLOAD.name()); FileUpload fileUpload = didiFileUploadService.uploadFile(file, file.getOriginalFilename(), FileUploadEnum.BizSource.RECORD_UPLOAD.name());
taxDocument.setFileUploadId(fileUpload.getUid()); taxDocument.setFileUploadId(fileUpload.getUid());
taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl()); taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl());
} }
...@@ -275,6 +279,7 @@ public class TaxDocumentServiceImpl { ...@@ -275,6 +279,7 @@ public class TaxDocumentServiceImpl {
if (null == ids || ids.size() < 1) { if (null == ids || ids.size() < 1) {
return false; return false;
} }
//逻辑批量删除(批量修改)
int num = taxDocumentMapper.batchDelete(ids); int num = taxDocumentMapper.batchDelete(ids);
if (num > 0) { if (num > 0) {
for (Long id : ids) { for (Long id : ids) {
...@@ -348,30 +353,77 @@ public class TaxDocumentServiceImpl { ...@@ -348,30 +353,77 @@ public class TaxDocumentServiceImpl {
public TaxDocument queryWhetherData(TaxDocument taxDocument) { public TaxDocument queryWhetherData(TaxDocument taxDocument) {
try { try {
//简单参数校验 //简单参数校验
/* if (StringUtils.isAnyBlank(taxDocumentDto.getFileAttr(), taxDocumentDto.getFileName(),
taxDocumentDto.getFileType(), taxDocumentDto.getCompanyName())){
return false;
}*/
TaxDocumentExample taxDocumentExample = new TaxDocumentExample(); TaxDocumentExample taxDocumentExample = new TaxDocumentExample();
TaxDocumentExample.Criteria criteria = taxDocumentExample.createCriteria(); TaxDocumentExample.Criteria criteria = taxDocumentExample.createCriteria();
criteria.andFileAttrEqualTo(taxDocument.getFileAttr()); //档案属性 fileAttr
criteria.andFileTypeEqualTo(taxDocument.getFileType()); if (StringUtils.isNotBlank(taxDocument.getFileAttr())) {
criteria.andFileNameEqualTo(taxDocument.getFileName()); criteria.andFileAttrEqualTo(taxDocument.getFileAttr());
criteria.andCompanyNameEqualTo(taxDocument.getCompanyName()); }
criteria.andEnableEqualTo("T"); //档案类型 fileType
if (null != taxDocument.getOwnTime()){ if (StringUtils.isNotBlank(taxDocument.getFileType())) {
criteria.andFileTypeEqualTo(taxDocument.getFileType());
}
//文件生效日期 fileTime
if (null != taxDocument.getFileTime()) {
criteria.andFileTimeEqualTo(taxDocument.getFileTime());
}
//所属时间 ownTime
if (null != taxDocument.getOwnTime()) {
criteria.andOwnTimeEqualTo(taxDocument.getOwnTime()); criteria.andOwnTimeEqualTo(taxDocument.getOwnTime());
} }
//档案名称 fileName
if (StringUtils.isNotBlank(taxDocument.getFileName())) {
criteria.andFileNameEqualTo(taxDocument.getFileName());
}
//业务线 businessLine
if (StringUtils.isNotBlank(taxDocument.getBusinessLine())) {
criteria.andBusinessLineEqualTo(taxDocument.getBusinessLine());
}
//公司名称 companyName
if (StringUtils.isNotBlank(taxDocument.getCompanyName())) {
criteria.andCompanyNameEqualTo(taxDocument.getCompanyName());
}
//到期日 effectiveTime
if (null != taxDocument.getEffectiveTime()) {
criteria.andEffectiveTimeEqualTo(taxDocument.getEffectiveTime());
}
//税种 taxType
if (StringUtils.isNotBlank(taxDocument.getTaxType())) {
criteria.andTaxTypeEqualTo(taxDocument.getTaxType());
}
//实物索引号 physicalIndexNumber
if (StringUtils.isNotBlank(taxDocument.getPhysicalIndexNumber())) {
criteria.andPhysicalIndexNumberEqualTo(taxDocument.getPhysicalIndexNumber());
}
//实物存放地点 storageArea
if (StringUtils.isNotBlank(taxDocument.getStorageArea())) {
criteria.andStorageAreaEqualTo(taxDocument.getStorageArea());
}
//实物保管人 keeper
if (StringUtils.isNotBlank(taxDocument.getKeeper())) {
criteria.andKeeperEqualTo(taxDocument.getKeeper());
}
//审批状态 auditStatus
if (null != taxDocument.getAuditStatus()) {
criteria.andAuditStatusEqualTo(taxDocument.getAuditStatus());
}
//创建人 creator
if (StringUtils.isNotBlank(taxDocument.getCreator())) {
criteria.andCreatorEqualTo(taxDocument.getCreator());
}
//设置查询可用的数据
criteria.andEnableEqualTo("T");
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(taxDocumentExample); List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(taxDocumentExample);
if (null != taxDocuments && taxDocuments.size() > 0) { if (null != taxDocuments && taxDocuments.size() > 0) {
return taxDocuments.get(0); return taxDocuments.get(0);
} }
return new TaxDocument(); return new TaxDocument();
} catch (Exception e) { } catch (Exception e) {
// log.error("TaxDocumentServiceImpl queryWhetherData error :" + e.getMessage()); log.error("TaxDocumentServiceImpl queryWhetherData error :" + e.getMessage());
return new TaxDocument(); return new TaxDocument();
} }
} }
public void downloadAllFile(HttpServletResponse response, List<Long> ids) { public void downloadAllFile(HttpServletResponse response, List<Long> ids) {
//如果只选择了一个附件,则不打包 //如果只选择了一个附件,则不打包
if (null != ids && ids.size() == 1) { if (null != ids && ids.size() == 1) {
...@@ -522,7 +574,7 @@ public class TaxDocumentServiceImpl { ...@@ -522,7 +574,7 @@ public class TaxDocumentServiceImpl {
// } // }
//检查文件名是否有重复 //检查文件名是否有重复
int fileNameRepeatTimes = 0; int fileNameRepeatTimes = 0;
if (fileNameList.size()>0){ if (fileNameList.size() > 0) {
fileNameRepeatTimes = Collections.frequency(fileNameList, item.getFileName()); fileNameRepeatTimes = Collections.frequency(fileNameList, item.getFileName());
} }
String fileName; String fileName;
...@@ -597,8 +649,9 @@ public class TaxDocumentServiceImpl { ...@@ -597,8 +649,9 @@ public class TaxDocumentServiceImpl {
} }
} }
public Map<String,Object> multipalInitData(String address) {
if (StringUtils.isBlank(address)){ public Map<String, Object> multipalInitData(String address) {
if (StringUtils.isBlank(address)) {
throw new RuntimeException("地址格式错误"); throw new RuntimeException("地址格式错误");
} }
Map<String, Object> resultMap = Maps.newHashMap(); Map<String, Object> resultMap = Maps.newHashMap();
...@@ -607,49 +660,77 @@ public class TaxDocumentServiceImpl { ...@@ -607,49 +660,77 @@ public class TaxDocumentServiceImpl {
ArrayList<String> successFileNameList = Lists.newArrayList(); ArrayList<String> successFileNameList = Lists.newArrayList();
ArrayList<String> existedFileNameList = Lists.newArrayList(); ArrayList<String> existedFileNameList = Lists.newArrayList();
//读取固定文件目录下的所有文件的文件名 //读取固定文件目录下的所有文件的文件名
File file = new File(address); File iniTfile = new File(address);
if (!file.isDirectory() || !file.exists()){ if (!iniTfile.isDirectory() || !iniTfile.exists()) {
throw new RuntimeException("文件夹地址错误"); throw new RuntimeException("文件夹地址错误");
} }
List<File> files = Arrays.asList(file.listFiles()); List<File> files = Arrays.asList(iniTfile.listFiles());
if (files.size()<1){ if (files.size() < 1) {
throw new RuntimeException("文件列表为空"); throw new RuntimeException("文件列表为空");
} }
List<String> fileNames = files.stream().filter(e -> e.isFile()).map(File::getName).collect(Collectors.toList()); /*List<String> fileNames = files.stream().filter(e -> e.isFile()).map(File::getName).collect(Collectors.toList());
if (fileNames.size()<1){ if (fileNames.size()<1){
throw new RuntimeException("文件列表为空"); throw new RuntimeException("文件列表为空");
} }*/
//公司名简称和公司序号Map(name-id) //公司名简称和公司序号Map(name-id)
Map<String, String> companyNameAndId; Map<String, String> companyNameAndId;
try { try {
companyNameAndId = organizationService.findAllOrganizations().stream().collect(Collectors.toMap(Organization::getAbbreviation, Organization::getId)); companyNameAndId = organizationService.findAllOrganizations().stream().collect(Collectors.toMap(Organization::getAbbreviation, Organization::getId, (value1, value2) -> {
return value2;
}));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("公司简称和id获取失败!请联系管理员"); throw new RuntimeException("公司简称和id获取失败!请联系管理员");
} }
if (companyNameAndId.size() < 1) { if (companyNameAndId.size() < 1) {
throw new RuntimeException("公司名称列表无数据!"); throw new RuntimeException("公司名称列表无数据!");
} }
fileNames.forEach(fileName -> { //递归处理
recursiveSolveFile(errorFileNameList, successFileNameList, existedFileNameList, files, companyNameAndId);
//返回成功列表和失败列表
resultMap.put("successFileNameList", successFileNameList);
resultMap.put("errorFileNameList", errorFileNameList);
resultMap.put("existedFileNameList", existedFileNameList);
return resultMap;
}
/**
* 递归循环文件夹 处理
*
* @param errorFileNameList
* @param successFileNameList
* @param existedFileNameList
* @param files
* @param companyNameAndId
*/
private void recursiveSolveFile(ArrayList<String> errorFileNameList, ArrayList<String> successFileNameList, ArrayList<String> existedFileNameList, List<File> files, Map<String, String> companyNameAndId) {
files.forEach(file -> {
if (file.isDirectory()) {
recursiveSolveFile(errorFileNameList, successFileNameList, existedFileNameList, Arrays.asList(file.listFiles()), companyNameAndId);
return;
}
String fileName = file.getName();//文件名/
String filePath = file.getPath();//文件路径
//文件名校验 如果文件名中不包含_则不符合规则,添加到错误列表中 //文件名校验 如果文件名中不包含_则不符合规则,添加到错误列表中
if (!fileName.contains("_")) { if (!fileName.contains("_")) {
errorFileNameList.add(fileName); errorFileNameList.add(filePath);
return;//此处相当于continue return;//此处相当于continue
} }
//根据文件名格式分割,以 "_"来分割 //根据文件名格式分割,以 "_"来分割
List<String> params = Arrays.asList(fileName.substring(0,fileName.indexOf(".")).split("_")); try {
//根据分割的长度来进行匹配对比 如果长度<3或者>6或公司简称匹配不上则添加至失败列表(目前最少的是3个,若以后有更改请更改此处参数) List<String> params = Arrays.asList(fileName.substring(0, fileName.indexOf(".")).split("_"));
if (params.size() < 3 || params.size() > 6 || !companyNameAndId.containsKey(params.get(0))) { //根据分割的长度来进行匹配对比 如果长度<3或者>6或公司简称匹配不上则添加至失败列表(目前最少的是3个,若以后有更改请更改此处参数)
errorFileNameList.add(fileName); if (params.size() < 3 || params.size() > 6 || !companyNameAndId.containsKey(params.get(0))) {
errorFileNameList.add(filePath);
return;//此处相当于continue
}
//根据档案类型匹配并初始化值
matchFileTypeToInitData(errorFileNameList, successFileNameList, existedFileNameList, companyNameAndId, file, params, filePath);
} catch (Exception e) {
e.printStackTrace();
errorFileNameList.add(filePath);
return;//此处相当于continue return;//此处相当于continue
} }
//根据档案类型匹配并初始化值
matchFileTypeToInitData(errorFileNameList, successFileNameList, existedFileNameList, companyNameAndId, fileName, params);
}); });
//返回成功列表和失败列表
resultMap.put("successFileNameList",successFileNameList);
resultMap.put("errorFileNameList",errorFileNameList);
resultMap.put("existedFileNameList",existedFileNameList);
return resultMap;
} }
//初始化税种列表(后续可做成从数据库中拿) //初始化税种列表(后续可做成从数据库中拿)
...@@ -857,7 +938,7 @@ public class TaxDocumentServiceImpl { ...@@ -857,7 +938,7 @@ public class TaxDocumentServiceImpl {
* *
* @return * @return
*/ */
private TaxDocument buildBaseTaxDocument(Map<String, String> companyNameAndId, List<String> params ,String fileName) { private TaxDocument buildBaseTaxDocument(Map<String, String> companyNameAndId, List<String> params, String fileName) {
TaxDocument taxDocument = new TaxDocument(); TaxDocument taxDocument = new TaxDocument();
taxDocument.setFileName(fileName); taxDocument.setFileName(fileName);
taxDocument.setCompanyId(companyNameAndId.get(params.get(0))); taxDocument.setCompanyId(companyNameAndId.get(params.get(0)));
...@@ -878,13 +959,13 @@ public class TaxDocumentServiceImpl { ...@@ -878,13 +959,13 @@ public class TaxDocumentServiceImpl {
/** /**
* 根据档案类型匹配并初始化值 * 根据档案类型匹配并初始化值
*
* @param errorFileNameList * @param errorFileNameList
* @param successeFileNameList * @param successeFileNameList
* @param companyNameAndId * @param companyNameAndId
* @param fileName
* @param params * @param params
*/ */
private void matchFileTypeToInitData(ArrayList<String> errorFileNameList, ArrayList<String> successeFileNameList, ArrayList<String> existedFileNameList, Map<String, String> companyNameAndId, String fileName, List<String> params) { private void matchFileTypeToInitData(ArrayList<String> errorFileNameList, ArrayList<String> successeFileNameList, ArrayList<String> existedFileNameList, Map<String, String> companyNameAndId, File file, List<String> params, String filePath) {
//长度为3(先验证是否国际类型并校验匹配,若是国际类型档案类型索引为2(国际类型第三个为档案类型),否则索引为1为档案类型 //长度为3(先验证是否国际类型并校验匹配,若是国际类型档案类型索引为2(国际类型第三个为档案类型),否则索引为1为档案类型
if (params.size() == 3 if (params.size() == 3
&& (//国际类型 公司簡稱_档案属性_档案类型 && (//国际类型 公司簡稱_档案属性_档案类型
...@@ -900,172 +981,107 @@ public class TaxDocumentServiceImpl { ...@@ -900,172 +981,107 @@ public class TaxDocumentServiceImpl {
(internationalGroupOfCompanyFileAttrFileType4.keySet().contains(params.get(2)) (internationalGroupOfCompanyFileAttrFileType4.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileType4.values().contains(params.get(1))))) { && internationalGroupOfCompanyFileAttrFileType4.values().contains(params.get(1))))) {
//构建基础对象 设置基础值 公司简称 Id 文件名 //构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName); TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案属性 档案类型 //设置档案属性 档案类型
taxDocument.setFileAttr(params.get(1)); taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2)); taxDocument.setFileType(params.get(2));
//校验是否已存在 //校验是否已存在
if (null == queryWhetherData(taxDocument).getId()){ checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
//插入数据 } else if (params.size() == 3//公司簡稱_档案类型_文件生效日期
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 3//公司簡稱_档案类型_文件生效日期
&& groupOfCompanyFileTypeFIleTime.keySet().contains(params.get(1)) && groupOfCompanyFileTypeFIleTime.keySet().contains(params.get(1))
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(2))){//文件生效日期校验 && null != DateUtils.stringToDate4yyyyMMdd(params.get(2))) {//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名 //构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName); TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案属性 档案类型 文件生效日期 //设置档案属性 档案类型 文件生效日期
taxDocument.setFileType(params.get(1)); taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeFIleTime.get(params.get(1))); taxDocument.setFileAttr(groupOfCompanyFileTypeFIleTime.get(params.get(1)));
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(2))); taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(2)));
if (null == queryWhetherData(taxDocument).getId()){ //校验是否已存在
//插入数据 checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
taxDocumentMapper.insert(taxDocument); } else if (params.size() == 3//公司簡稱_档案类型_到期日
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 3//公司簡稱_档案类型_到期日
&& groupOfCompanyFileTypeEffectiveTime.keySet().contains(params.get(1)) && groupOfCompanyFileTypeEffectiveTime.keySet().contains(params.get(1))
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(2))){//到期日校验 && null != DateUtils.stringToDate4yyyyMMdd(params.get(2))) {//到期日校验
//构建基础对象 设置基础值 公司简称 Id 文件名 //构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName); TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案属性 档案类型 到期日 //设置档案属性 档案类型 到期日
taxDocument.setFileType(params.get(1)); taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeEffectiveTime.get(params.get(1))); taxDocument.setFileAttr(groupOfCompanyFileTypeEffectiveTime.get(params.get(1)));
taxDocument.setEffectiveTime(DateUtils.stringToDate4yyyyMMdd(params.get(2))); taxDocument.setEffectiveTime(DateUtils.stringToDate4yyyyMMdd(params.get(2)));
if (null == queryWhetherData(taxDocument).getId()){ //校验是否已存在
//插入数据 checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
taxDocumentMapper.insert(taxDocument); } else if (params.size() == 4 //国际类型 公司簡稱_档案属性_档案类型_所属期间
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 4 //国际类型 公司簡稱_档案属性_档案类型_所属期间
&& (internationalGroupOfCompanyFileAttrFileTypeOwnTime.keySet().contains(params.get(2)) && (internationalGroupOfCompanyFileAttrFileTypeOwnTime.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileTypeOwnTime.values().contains(params.get(1))) && internationalGroupOfCompanyFileAttrFileTypeOwnTime.values().contains(params.get(1)))
&& checkOwnTime(params.get(3))){//所属期间校验 && checkOwnTime(params.get(3))) {//所属期间校验
//构建基础对象 设置基础值 公司简称 Id 文件名 //构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName); TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案属性 档案类型 所属期间 //设置档案属性 档案类型 所属期间
taxDocument.setFileAttr(params.get(1)); taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2)); taxDocument.setFileType(params.get(2));
taxDocument.setOwnTime(Integer.valueOf(params.get(3))); taxDocument.setOwnTime(Integer.valueOf(params.get(3)));
if (null == queryWhetherData(taxDocument).getId()){ //校验是否已存在
//插入数据 checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
taxDocumentMapper.insert(taxDocument); } else if (params.size() == 4 //公司簡稱_档案类型_所属期间_文件生效日期
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 4 //公司簡稱_档案类型_所属期间_文件生效日期
&& groupOfCompanyFileTypeOwnTimeFileTime.keySet().contains(params.get(1)) && groupOfCompanyFileTypeOwnTimeFileTime.keySet().contains(params.get(1))
&& checkOwnTime(params.get(2))//所属期间校验 && checkOwnTime(params.get(2))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//文件生效日期校验 && null != DateUtils.stringToDate4yyyyMMdd(params.get(3))) {//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名 //构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName); TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案类型 档案属性 所属期间 文件生效日期 //设置档案类型 档案属性 所属期间 文件生效日期
taxDocument.setFileType(params.get(1)); taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeFileTime.get(params.get(1))); taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeFileTime.get(params.get(1)));
taxDocument.setOwnTime(Integer.valueOf(params.get(2))); taxDocument.setOwnTime(Integer.valueOf(params.get(2)));
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(3))); taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(3)));
if (null == queryWhetherData(taxDocument).getId()){ //校验是否已存在
//插入数据 checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
taxDocumentMapper.insert(taxDocument); } else if (params.size() == 4 //公司簡稱_档案类型_所属期间_到期日
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 4 //公司簡稱_档案类型_所属期间_到期日
&& groupOfCompanyFileTypeOwnTimeEffectiveTime.keySet().contains(params.get(1)) && groupOfCompanyFileTypeOwnTimeEffectiveTime.keySet().contains(params.get(1))
&& checkOwnTime(params.get(2))//所属期间校验 && checkOwnTime(params.get(2))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//到期日校验 && null != DateUtils.stringToDate4yyyyMMdd(params.get(3))) {//到期日校验
//构建基础对象 设置基础值 公司简称 Id 文件名 //构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName); TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案类型 档案属性 所属期间 到期日 //设置档案类型 档案属性 所属期间 到期日
taxDocument.setFileType(params.get(1)); taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeEffectiveTime.get(params.get(1))); taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeEffectiveTime.get(params.get(1)));
taxDocument.setOwnTime(Integer.valueOf(params.get(2))); taxDocument.setOwnTime(Integer.valueOf(params.get(2)));
taxDocument.setEffectiveTime(DateUtils.stringToDate4yyyyMMdd(params.get(3))); taxDocument.setEffectiveTime(DateUtils.stringToDate4yyyyMMdd(params.get(3)));
if (null == queryWhetherData(taxDocument).getId()){ //校验是否已存在
//插入数据 checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
taxDocumentMapper.insert(taxDocument); } else if (params.size() == 5 //国际类型 公司簡稱_档案属性_档案类型_税种_所属期间
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 5 //国际类型 公司簡稱_档案属性_档案类型_税种_所属期间
&& (internationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime.keySet().contains(params.get(2)) && (internationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime.keySet().contains(params.get(2))
&& internationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime.values().contains(params.get(1))) && internationalGroupOfCompanyFileAttrFileTypeTaxTypeOwnTime.values().contains(params.get(1)))
&& taxsList.contains(params.get(3))//税种校验 && taxsList.contains(params.get(3))//税种校验
&& checkOwnTime(params.get(4))){//所属期间校验 && checkOwnTime(params.get(4))) {//所属期间校验
//构建基础对象 设置基础值 公司简称 Id 文件名 //构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName); TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案属性 档案类型 税种 所属期间 //设置档案属性 档案类型 税种 所属期间
taxDocument.setFileAttr(params.get(1)); taxDocument.setFileAttr(params.get(1));
taxDocument.setFileType(params.get(2)); taxDocument.setFileType(params.get(2));
taxDocument.setTaxType(params.get(3)); taxDocument.setTaxType(params.get(3));
taxDocument.setOwnTime(Integer.valueOf(params.get(4))); taxDocument.setOwnTime(Integer.valueOf(params.get(4)));
if (null == queryWhetherData(taxDocument).getId()){ //校验是否已存在
//插入数据 checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
taxDocumentMapper.insert(taxDocument); } else if (params.size() == 5 //公司簡稱_档案类型_税种_所属期间_文件生效日期
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 5 //公司簡稱_档案类型_税种_所属期间_文件生效日期
&& groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.keySet().contains(params.get(1)) && groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.keySet().contains(params.get(1))
&& taxsList.contains(params.get(2))//税种校验 && taxsList.contains(params.get(2))//税种校验
&& checkOwnTime(params.get(3))//所属期间校验 && checkOwnTime(params.get(3))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(4))){//文件生效日期校验 && null != DateUtils.stringToDate4yyyyMMdd(params.get(4))) {//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名 //构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName); TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案类型 档案属性 税种 所属期间 文件生效日期 //设置档案类型 档案属性 税种 所属期间 文件生效日期
taxDocument.setFileType(params.get(1)); taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.get(params.get(1))); taxDocument.setFileAttr(groupOfCompanyFileTypeTaxTypeOwnTimeFileTime.get(params.get(1)));
taxDocument.setTaxType(params.get(2)); taxDocument.setTaxType(params.get(2));
taxDocument.setOwnTime(Integer.valueOf(params.get(3))); taxDocument.setOwnTime(Integer.valueOf(params.get(3)));
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(4))); taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(4)));
if (null == queryWhetherData(taxDocument).getId()){ //校验是否已存在
//插入数据 checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
taxDocumentMapper.insert(taxDocument); } else if (params.size() == 6 //公司簡稱_档案类型_所属期间_文件生效日期_实物存放地点_实物保管人
//添加到成功列表中
successeFileNameList.add(fileName);
}else {
//添加到已存在列表中
existedFileNameList.add(fileName);
//TODO 或做覆盖操作
}
}else if (params.size() == 6 //公司簡稱_档案类型_所属期间_文件生效日期_实物存放地点_实物保管人
&& groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper.keySet().contains(params.get(1)) && groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper.keySet().contains(params.get(1))
&& checkOwnTime(params.get(2))//所属期间校验 && checkOwnTime(params.get(2))//所属期间校验
&& null != DateUtils.stringToDate4yyyyMMdd(params.get(3))){//文件生效日期校验 && null != DateUtils.stringToDate4yyyyMMdd(params.get(3))) {//文件生效日期校验
//构建基础对象 设置基础值 公司简称 Id 文件名 //构建基础对象 设置基础值 公司简称 Id 文件名
TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId,params,fileName); TaxDocument taxDocument = buildBaseTaxDocument(companyNameAndId, params, file.getName());
//设置档案类型 档案属性 所属期间 文件生效日期 实物存放地点 实物保管人 //设置档案类型 档案属性 所属期间 文件生效日期 实物存放地点 实物保管人
taxDocument.setFileType(params.get(1)); taxDocument.setFileType(params.get(1));
taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper.get(params.get(1))); taxDocument.setFileAttr(groupOfCompanyFileTypeOwnTimeFileTimeStorageAreaKeeper.get(params.get(1)));
...@@ -1073,15 +1089,53 @@ public class TaxDocumentServiceImpl { ...@@ -1073,15 +1089,53 @@ public class TaxDocumentServiceImpl {
taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(3))); taxDocument.setFileTime(DateUtils.stringToDate4yyyyMMdd(params.get(3)));
taxDocument.setStorageArea(params.get(4)); taxDocument.setStorageArea(params.get(4));
taxDocument.setKeeper(params.get(5)); taxDocument.setKeeper(params.get(5));
//校验是否已存在
checkExistedAndInsertOrUpdate(successeFileNameList, existedFileNameList, file, taxDocument, filePath);
} else {
errorFileNameList.add(filePath);
}
}
private void checkExistedAndInsertOrUpdate(ArrayList<String> successeFileNameList, ArrayList<String> existedFileNameList, File file, TaxDocument taxDocument, String filePath) {
if (null == queryWhetherData(taxDocument).getId()) {
//TODO 上传文件 并填充文件url 上传人等信息
FileInputStream fis = null;
ByteArrayOutputStream bos = null;
try {
fis = new FileInputStream(file);
bos = new ByteArrayOutputStream(1000);
byte[] b = new byte[1000];
int n;
while ((n = fis.read(b)) != -1) {
bos.write(b, 0, n);
}
FileUpload fileUpload = didiFileUploadService.uploadFile(bos.toByteArray(), file.getName(), FileUploadEnum.BizSource.RECORD_UPLOAD.name());
taxDocument.setFileUploadId(fileUpload.getUid());
taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl());
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
fis.close();
bos.close();
} catch (Exception e) {
}
}
//插入数据
taxDocumentMapper.insert(taxDocument);
//添加到成功列表中 //添加到成功列表中
successeFileNameList.add(fileName); successeFileNameList.add(filePath);
}else { } else {
errorFileNameList.add(fileName); //添加到已存在列表中
existedFileNameList.add(filePath);
//TODO 或做覆盖操作
} }
} }
/** /**
* 检查所属期间转换是否正常 * 检查所属期间转换是否正常
*
* @param s * @param s
* @return * @return
*/ */
......
...@@ -8,10 +8,8 @@ import com.google.common.collect.Lists; ...@@ -8,10 +8,8 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCell;
...@@ -26,7 +24,6 @@ import org.springframework.stereotype.Component; ...@@ -26,7 +24,6 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import pwc.taxtech.atms.analysis.entity.AnalysisTax;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.POIUtil; import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.message.ErrorMessage; import pwc.taxtech.atms.common.message.ErrorMessage;
...@@ -61,7 +58,10 @@ import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper; ...@@ -61,7 +58,10 @@ import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -71,7 +71,6 @@ import java.util.regex.Matcher; ...@@ -71,7 +71,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static pwc.taxtech.atms.common.util.FileExcelUtil.downloadExcel;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*; import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component @Component
...@@ -352,17 +351,15 @@ public class ReportServiceImpl extends BaseService { ...@@ -352,17 +351,15 @@ public class ReportServiceImpl extends BaseService {
andStartDateLessThanOrEqualTo(queryDate).andEndDateGreaterThanOrEqualTo(queryDate). andStartDateLessThanOrEqualTo(queryDate).andEndDateGreaterThanOrEqualTo(queryDate).
andStatusEqualTo(0); andStatusEqualTo(0);
List<RevenueTypeMapping> mappingList = revenueTypeMappingMapper.selectByExample(mappingExample); List<RevenueTypeMapping> mappingList = revenueTypeMappingMapper.selectByExample(mappingExample);
//先清除数据
InvoiceRecord delRecord = new InvoiceRecord();
delRecord.setRevenueCofId(null);
if (!isMergeManualData) {
delRecord.setModifyRevenueCofId(null);
}
InvoiceRecordExample delExample = new InvoiceRecordExample(); InvoiceRecordExample delExample = new InvoiceRecordExample();
delExample.createCriteria().andProjectIdEqualTo(projectId) delExample.createCriteria().andProjectIdEqualTo(projectId).
.andProjectIdEqualTo(projectId).
andPeriodEqualTo(Integer.valueOf(queryDate.replace("-", ""))); andPeriodEqualTo(Integer.valueOf(queryDate.replace("-", "")));
invoiceRecordMapper.deleteByExample(delExample); if (isMergeManualData) {
invoiceRecordMapper.clearRevenueCof(true, false, delExample);
} else {
invoiceRecordMapper.clearRevenueCof(true, true, delExample);
}
Map<String, Long> map = new HashMap<>(); Map<String, Long> map = new HashMap<>();
for (RevenueTypeMapping mapping : mappingList) { for (RevenueTypeMapping mapping : mappingList) {
if (!map.containsKey(mapping.getContent())) { if (!map.containsKey(mapping.getContent())) {
...@@ -482,140 +479,78 @@ public class ReportServiceImpl extends BaseService { ...@@ -482,140 +479,78 @@ public class ReportServiceImpl extends BaseService {
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) { for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r); Row row = sheet.getRow(r);
for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) { for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) {
Cell cell = row.getCell(c); Cell cell = row.getCell(c);
if (cell == null) { if (cell == null) {
continue;//todo cell == null 如何处理 continue;//todo cell == null 如何处理
} }
if (r <= addRowIndex + 1) { if (r <= addRowIndex + 1) {
String cellId = projectId + template.getId() + period + r + c; if(r == addRowIndex + 1 && c>TaxesCalculateReportEnum.Column.Column_14.getIndex()){
if ((r - 1) >= 0 && (r - 1) < configIds.size()) { assembleOriginalTemplateData(template,projectId,period,r,c,addRowIndex,cellTemplateList,cellTemplateConfigList);
cellId += configIds.get(configIds.size() - r); }else{
} String cellId = projectId + template.getId() + period + r + c;
Long cellTemplateId = Long.valueOf(cellId.hashCode()); if ((r - 1) >= 0 && (r - 1) < configIds.size()) {
cellTemplateId = cellTemplateId < 0 ? cellTemplateId : (cellTemplateId * -1); cellId += configIds.get(configIds.size() - r);
//更新手工数据源 }
PeriodDataSourceExample delExample = new PeriodDataSourceExample(); Long cellTemplateId = Long.valueOf(cellId.hashCode());
delExample.createCriteria().andProjectIdEqualTo(projectId) cellTemplateId = cellTemplateId < 0 ? cellTemplateId : (cellTemplateId * -1);
.andPeriodEqualTo(period).andTypeEqualTo(10).andColumnIndexEqualTo(c).andRowIndexEqualTo(r); //更新手工数据源
PeriodDataSource dataSource = new DataSourceExtendDto(); PeriodDataSourceExample delExample = new PeriodDataSourceExample();
dataSource.setColumnIndex(999); delExample.createCriteria().andProjectIdEqualTo(projectId)
dataSource.setRowIndex(999); .andPeriodEqualTo(period).andTypeEqualTo(10).andColumnIndexEqualTo(c).andRowIndexEqualTo(r);
periodDataSourceMapper.updateByExampleSelective(dataSource, delExample); PeriodDataSource dataSource = new DataSourceExtendDto();
dataSource.setColumnIndex(999);
PeriodDataSourceExample updateExample = new PeriodDataSourceExample(); dataSource.setRowIndex(999);
updateExample.createCriteria().andProjectIdEqualTo(projectId) periodDataSourceMapper.updateByExampleSelective(dataSource, delExample);
.andPeriodEqualTo(period).andTypeEqualTo(10).andCellTemplateIdEqualTo(cellTemplateId);
dataSource = new DataSourceExtendDto(); PeriodDataSourceExample updateExample = new PeriodDataSourceExample();
dataSource.setColumnIndex(c); updateExample.createCriteria().andProjectIdEqualTo(projectId)
dataSource.setRowIndex(r); .andPeriodEqualTo(period).andTypeEqualTo(10).andCellTemplateIdEqualTo(cellTemplateId);
periodDataSourceMapper.updateByExampleSelective(dataSource, updateExample); dataSource = new DataSourceExtendDto();
PeriodCellTemplate cellTemplate = new PeriodCellTemplate(); dataSource.setColumnIndex(c);
cellTemplate.setPeriod(period); dataSource.setRowIndex(r);
cellTemplate.setRowName(POIUtil.getCellFormulaString(cell)); periodDataSourceMapper.updateByExampleSelective(dataSource, updateExample);
cellTemplate.setProjectId(projectId); PeriodCellTemplate cellTemplate = new PeriodCellTemplate();
cellTemplate.setColumnIndex(c); cellTemplate.setPeriod(period);
cellTemplate.setCreateTime(now); cellTemplate.setRowName(POIUtil.getCellFormulaString(cell));
cellTemplate.setCellTemplateId(cellTemplateId); cellTemplate.setProjectId(projectId);
cellTemplate.setUpdateTime(now); cellTemplate.setColumnIndex(c);
cellTemplate.setRowIndex(r); cellTemplate.setCreateTime(now);
cellTemplate.setReportTemplateId(template.getId()); cellTemplate.setCellTemplateId(cellTemplateId);
cellTemplate.setId(distributedIdService.nextId()); cellTemplate.setUpdateTime(now);
if (cell.getCellComment() != null) { cellTemplate.setRowIndex(r);
cellTemplate.setComment(cell.getCellComment().getString().getString()); cellTemplate.setReportTemplateId(template.getId());
} cellTemplate.setId(distributedIdService.nextId());
cellTemplate.setIsReadOnly(hasHandDatas.contains(c) ? 0 : 1); if (cell.getCellComment() != null) {
cellTemplateList.add(cellTemplate); cellTemplate.setComment(cell.getCellComment().getString().getString());
if (r > 0 && hasFormulaDatas.contains(c) && StringUtils.isNotBlank(POIUtil.getCellFormulaString(cell))) { }
PeriodCellTemplateConfig periodCellTemplateConfig = new PeriodCellTemplateConfig(); cellTemplate.setIsReadOnly(hasHandDatas.contains(c) ? 0 : 1);
periodCellTemplateConfig.setId(distributedIdService.nextId()); cellTemplateList.add(cellTemplate);
periodCellTemplateConfig.setPeriod(period); if (r > 0 && hasFormulaDatas.contains(c) && StringUtils.isNotBlank(POIUtil.getCellFormulaString(cell))) {
periodCellTemplateConfig.setCellTemplateId(cellTemplateId); PeriodCellTemplateConfig periodCellTemplateConfig = new PeriodCellTemplateConfig();
periodCellTemplateConfig.setReportTemplateId(template.getId()); periodCellTemplateConfig.setId(distributedIdService.nextId());
periodCellTemplateConfig.setDataSourceType(1); periodCellTemplateConfig.setPeriod(period);
periodCellTemplateConfig.setFormula(POIUtil.getCellFormulaString(cell)); periodCellTemplateConfig.setCellTemplateId(cellTemplateId);
periodCellTemplateConfig.setParsedFormula(null); periodCellTemplateConfig.setReportTemplateId(template.getId());
periodCellTemplateConfig.setDataSourceType(1);
periodCellTemplateConfig.setFormula(POIUtil.getCellFormulaString(cell));
periodCellTemplateConfig.setParsedFormula(null);
// periodCellTemplateConfig.setCreateBy(authUserHelper.getCurrentUserId()); // periodCellTemplateConfig.setCreateBy(authUserHelper.getCurrentUserId());
periodCellTemplateConfig.setCreateTime(now); periodCellTemplateConfig.setCreateTime(now);
// periodCellTemplateConfig.setUpdateBy(authUserHelper.getCurrentUserId()); // periodCellTemplateConfig.setUpdateBy(authUserHelper.getCurrentUserId());
periodCellTemplateConfig.setUpdateTime(now); periodCellTemplateConfig.setUpdateTime(now);
periodCellTemplateConfig.setFormulaDataSource("报表数据"); periodCellTemplateConfig.setFormulaDataSource("报表数据");
periodCellTemplateConfig.setKeyValueParsedFormula(null); periodCellTemplateConfig.setKeyValueParsedFormula(null);
periodCellTemplateConfig.setProjectId(projectId); periodCellTemplateConfig.setProjectId(projectId);
fixedParsedFormula(periodCellTemplateConfig); fixedParsedFormula(periodCellTemplateConfig);
fixedAccountCode(periodCellTemplateConfig); fixedAccountCode(periodCellTemplateConfig);
cellTemplateConfigList.add(periodCellTemplateConfig); cellTemplateConfigList.add(periodCellTemplateConfig);
} }
if (r > 0 && r <= addRowIndex && hasHandDatas.contains(c)) { if (r > 0 && r <= addRowIndex && hasHandDatas.contains(c)) {
addManualConfig(cellTemplate, cell, now, cellTemplateConfigList); addManualConfig(cellTemplate, cell, now, cellTemplateConfigList);
}
} else {
//查询原来行cell是否有CellTemplate
CellTemplateExample cellTemplateExample = new CellTemplateExample();
cellTemplateExample.createCriteria().andReportTemplateIdEqualTo(template.getId()).andRowIndexEqualTo(r - addRowIndex).andColumnIndexEqualTo(c);
List<CellTemplate> cellTemplates = cellTemplateMapper.selectByExample(cellTemplateExample);
if (CollectionUtils.isNotEmpty(cellTemplates)) {
CellTemplate cellTemplate = cellTemplates.get(0);
PeriodCellTemplate periodCellTemplate = new PeriodCellTemplate();
CommonUtils.copyProperties(cellTemplate, periodCellTemplate);
periodCellTemplate.setId(distributedIdService.nextId());
periodCellTemplate.setPeriod(period);
periodCellTemplate.setReportTemplateId(template.getId());
periodCellTemplate.setRowIndex(r);
periodCellTemplate.setRowName(cellTemplate.getRowName());
periodCellTemplate.setColumnIndex(c);
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(StringUtils.isBlank(cellTemplate.getCreateBy()) ? "admin" : cellTemplate.getCreateBy());
periodCellTemplate.setUpdateBy(StringUtils.isBlank(cellTemplate.getUpdateBy()) ? "admin" : cellTemplate.getUpdateBy());
periodCellTemplate.setProjectId(projectId);
cellTemplateList.add(periodCellTemplate);
CellTemplateConfigExample configExample = new CellTemplateConfigExample();
configExample.createCriteria().andCellTemplateIdEqualTo(cellTemplate.getId());
List<CellTemplateConfig> configs = cellTemplateConfigMapper.selectByExample(configExample);
if (CollectionUtils.isNotEmpty(configs)) {
for (CellTemplateConfig cellTemplateConfig : configs) {
PeriodCellTemplateConfig periodCellTemplateConfig = new PeriodCellTemplateConfig();
CommonUtils.copyProperties(cellTemplateConfig, periodCellTemplateConfig);
periodCellTemplateConfig.setId(distributedIdService.nextId());
periodCellTemplateConfig.setPeriod(period);
periodCellTemplateConfig.setCellTemplateId(cellTemplateConfig.getCellTemplateId());
periodCellTemplateConfig.setReportTemplateId(template.getId());
periodCellTemplateConfig.setDataSourceType(cellTemplateConfig.getDataSourceType());
periodCellTemplateConfig.setFormula(StringUtils.isBlank(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(StringUtils.isBlank(cellTemplateConfig.getCreateBy()) ? "admin" : cellTemplateConfig.getCreateBy());
periodCellTemplateConfig.setCreateTime(cellTemplateConfig.getCreateTime());
periodCellTemplateConfig.setUpdateBy(StringUtils.isBlank(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);
cellTemplateConfigList.add(periodCellTemplateConfig);
}
} }
} }
} else {
assembleOriginalTemplateData(template,projectId,period,r,c,addRowIndex,cellTemplateList,cellTemplateConfigList);
} }
} }
} }
...@@ -630,6 +565,76 @@ public class ReportServiceImpl extends BaseService { ...@@ -630,6 +565,76 @@ public class ReportServiceImpl extends BaseService {
} }
} }
public void assembleOriginalTemplateData(Template template, String projectId, Integer period,
Integer r, Integer c, Integer addRowIndex,
List<PeriodCellTemplate> cellTemplateList, List<PeriodCellTemplateConfig> cellTemplateConfigList) {
//查询原来行cell是否有CellTemplate
CellTemplateExample cellTemplateExample = new CellTemplateExample();
cellTemplateExample.createCriteria().andReportTemplateIdEqualTo(template.getId()).andRowIndexEqualTo(r - addRowIndex).andColumnIndexEqualTo(c);
List<CellTemplate> cellTemplates = cellTemplateMapper.selectByExample(cellTemplateExample);
if (CollectionUtils.isNotEmpty(cellTemplates)) {
CellTemplate cellTemplate = cellTemplates.get(0);
PeriodCellTemplate periodCellTemplate = new PeriodCellTemplate();
CommonUtils.copyProperties(cellTemplate, periodCellTemplate);
periodCellTemplate.setId(distributedIdService.nextId());
periodCellTemplate.setPeriod(period);
periodCellTemplate.setReportTemplateId(template.getId());
periodCellTemplate.setRowIndex(r);
periodCellTemplate.setRowName(cellTemplate.getRowName());
periodCellTemplate.setColumnIndex(c);
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(StringUtils.isBlank(cellTemplate.getCreateBy()) ? "admin" : cellTemplate.getCreateBy());
periodCellTemplate.setUpdateBy(StringUtils.isBlank(cellTemplate.getUpdateBy()) ? "admin" : cellTemplate.getUpdateBy());
periodCellTemplate.setProjectId(projectId);
cellTemplateList.add(periodCellTemplate);
CellTemplateConfigExample configExample = new CellTemplateConfigExample();
configExample.createCriteria().andCellTemplateIdEqualTo(cellTemplate.getId());
List<CellTemplateConfig> configs = cellTemplateConfigMapper.selectByExample(configExample);
if (CollectionUtils.isNotEmpty(configs)) {
for (CellTemplateConfig cellTemplateConfig : configs) {
PeriodCellTemplateConfig periodCellTemplateConfig = new PeriodCellTemplateConfig();
CommonUtils.copyProperties(cellTemplateConfig, periodCellTemplateConfig);
periodCellTemplateConfig.setId(distributedIdService.nextId());
periodCellTemplateConfig.setPeriod(period);
periodCellTemplateConfig.setCellTemplateId(cellTemplateConfig.getCellTemplateId());
periodCellTemplateConfig.setReportTemplateId(template.getId());
periodCellTemplateConfig.setDataSourceType(cellTemplateConfig.getDataSourceType());
periodCellTemplateConfig.setFormula(StringUtils.isBlank(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(StringUtils.isBlank(cellTemplateConfig.getCreateBy()) ? "admin" : cellTemplateConfig.getCreateBy());
periodCellTemplateConfig.setCreateTime(cellTemplateConfig.getCreateTime());
periodCellTemplateConfig.setUpdateBy(StringUtils.isBlank(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);
cellTemplateConfigList.add(periodCellTemplateConfig);
}
}
}
}
private void addManualConfig(PeriodCellTemplate cellTemplate, Cell cell, Date now, List<PeriodCellTemplateConfig> list) { private void addManualConfig(PeriodCellTemplate cellTemplate, Cell cell, Date now, List<PeriodCellTemplateConfig> list) {
PeriodCellTemplateConfig configManual = new PeriodCellTemplateConfig(); PeriodCellTemplateConfig configManual = new PeriodCellTemplateConfig();
configManual.setId(distributedIdService.nextId()); configManual.setId(distributedIdService.nextId());
...@@ -2465,6 +2470,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -2465,6 +2470,7 @@ public class ReportServiceImpl extends BaseService {
for (int m = 0; m < 3; m++) { for (int m = 0; m < 3; m++) {
FileExcelUtil.cloneCell(sheetAt.getRow(m).getCell(2), sheetAt.getRow(m).getCell(1)); FileExcelUtil.cloneCell(sheetAt.getRow(m).getCell(2), sheetAt.getRow(m).getCell(1));
sheetAt.getRow(m).getCell(3).setCellValue("");
sheetAt.getRow(m).getCell(1).setCellValue(""); sheetAt.getRow(m).getCell(1).setCellValue("");
} }
style1.setFillBackgroundColor(IndexedColors.YELLOW.getIndex()); style1.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
...@@ -2472,7 +2478,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -2472,7 +2478,7 @@ public class ReportServiceImpl extends BaseService {
sheetAt.getRow(2).getCell(2).setCellValue("本期:" + spreadData.get(0).getPeriod()); sheetAt.getRow(2).getCell(2).setCellValue("本期:" + spreadData.get(0).getPeriod());
} }
/* public String getCellStringValue(Cell cell) { public String getCellStringValue(Cell cell) {
String cellValue = null; String cellValue = null;
switch (cell.getCellType()) { switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_STRING://字符串类型 case HSSFCell.CELL_TYPE_STRING://字符串类型
...@@ -2498,7 +2504,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -2498,7 +2504,7 @@ public class ReportServiceImpl extends BaseService {
break; break;
} }
return cellValue; return cellValue;
}*/ }
@Autowired @Autowired
private OrganizationMapper organizationMapper; private OrganizationMapper organizationMapper;
...@@ -2525,7 +2531,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -2525,7 +2531,7 @@ public class ReportServiceImpl extends BaseService {
} }
} }
private String getCellStringValue(Cell cell) { /* private String getCellStringValue(Cell cell) {
if (cell.getCellTypeEnum().equals(CellType.STRING)) { if (cell.getCellTypeEnum().equals(CellType.STRING)) {
return cell.getStringCellValue(); return cell.getStringCellValue();
} else if (cell.getCellTypeEnum().equals(CellType.NUMERIC)) { } else if (cell.getCellTypeEnum().equals(CellType.NUMERIC)) {
...@@ -2534,5 +2540,5 @@ public class ReportServiceImpl extends BaseService { ...@@ -2534,5 +2540,5 @@ public class ReportServiceImpl extends BaseService {
} }
logger.warn("获取单元格数据类型未匹配"); logger.warn("获取单元格数据类型未匹配");
return null; return null;
} }*/
} }
...@@ -28,7 +28,7 @@ public class AnalysisTest extends CommonIT { ...@@ -28,7 +28,7 @@ public class AnalysisTest extends CommonIT {
public void analysisExpectedTax(){ public void analysisExpectedTax(){
Integer period = DateUtils.getPeriodNow(); Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample(); OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true); //e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e); List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s预期返还税数据",period)); logger.info(String.format("开始分析%s预期返还税数据",period));
analysisJobService.analysisExpectedTax(orgs,period, EnumTbImportType.CoverImport.getCode()); analysisJobService.analysisExpectedTax(orgs,period, EnumTbImportType.CoverImport.getCode());
...@@ -39,7 +39,7 @@ public class AnalysisTest extends CommonIT { ...@@ -39,7 +39,7 @@ public class AnalysisTest extends CommonIT {
public void analysisFee(){ public void analysisFee(){
Integer period = DateUtils.getPeriodNow(); Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample(); OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true); //e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e); List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s费用数据",period)); logger.info(String.format("开始分析%s费用数据",period));
analysisJobService.analysisFee(orgs,period, EnumTbImportType.CoverImport.getCode()); analysisJobService.analysisFee(orgs,period, EnumTbImportType.CoverImport.getCode());
...@@ -49,7 +49,7 @@ public class AnalysisTest extends CommonIT { ...@@ -49,7 +49,7 @@ public class AnalysisTest extends CommonIT {
public void analysisFileManagement(){ public void analysisFileManagement(){
Integer period = DateUtils.getPeriodNow(); Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample(); OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true); // e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e); List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s文档管理数据",period)); logger.info(String.format("开始分析%s文档管理数据",period));
...@@ -60,7 +60,7 @@ public class AnalysisTest extends CommonIT { ...@@ -60,7 +60,7 @@ public class AnalysisTest extends CommonIT {
public void analysisMaster(){ public void analysisMaster(){
Integer period = DateUtils.getPeriodNow(); Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample(); OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true); //e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e); List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s机构数据",period)); logger.info(String.format("开始分析%s机构数据",period));
analysisJobService.analysisMaster(orgs,period, EnumTbImportType.CoverImport.getCode()); analysisJobService.analysisMaster(orgs,period, EnumTbImportType.CoverImport.getCode());
...@@ -70,7 +70,7 @@ public class AnalysisTest extends CommonIT { ...@@ -70,7 +70,7 @@ public class AnalysisTest extends CommonIT {
public void analysisSales(){ public void analysisSales(){
Integer period = DateUtils.getPeriodNow(); Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample(); OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true); //e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e); List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s申报表数据",period)); logger.info(String.format("开始分析%s申报表数据",period));
analysisJobService.analysisSales(orgs,period, EnumTbImportType.CoverImport.getCode()); analysisJobService.analysisSales(orgs,period, EnumTbImportType.CoverImport.getCode());
...@@ -80,9 +80,19 @@ public class AnalysisTest extends CommonIT { ...@@ -80,9 +80,19 @@ public class AnalysisTest extends CommonIT {
public void analysisTaxReturnEnd(){ public void analysisTaxReturnEnd(){
Integer period = DateUtils.getPeriodNow(); Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample(); OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true); //e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e); List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s返还后税数据",period)); logger.info(String.format("开始分析%s返还后税数据",period));
analysisJobService.analysisTaxReturnEnd(orgs,period, EnumTbImportType.CoverImport.getCode()); analysisJobService.analysisTaxReturnEnd(orgs,period, EnumTbImportType.CoverImport.getCode());
} }
@Test
public void analysisTax(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
//e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s返还后税数据",period));
analysisJobService.analysisTax(orgs,period, EnumTbImportType.CoverImport.getCode());
}
} }
...@@ -924,5 +924,6 @@ ...@@ -924,5 +924,6 @@
"false": "否", "false": "否",
"ConditionColumnNum": "条件列", "ConditionColumnNum": "条件列",
"Condition": "查询条件", "Condition": "查询条件",
"Cancel4Tax": "取消",
"~MustBeEndOneApp": "I Must be the End One, please!" "~MustBeEndOneApp": "I Must be the End One, please!"
} }
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
<!--<div class="modal-footer"> <!--<div class="modal-footer">
<button type="submit" class="btn btn-primary" translate="Confirm" <button type="submit" class="btn btn-primary" translate="Confirm"
></button>&lt;!&ndash;ng-disabled="newDocFileTypeForm.roleName.$invalid || newDocFileTypeForm.service_id.$invalid"&ndash;&gt; ></button>&lt;!&ndash;ng-disabled="newDocFileTypeForm.roleName.$invalid || newDocFileTypeForm.service_id.$invalid"&ndash;&gt;
<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()" translate="Cancel"></button> <button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()" translate="Cancel4Tax"></button>
</div>--> </div>-->
<div style="margin-bottom: 20px;"> <div style="margin-bottom: 20px;">
<center> <center>
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
></button> ></button>
<!--ng-disabled="newDocFileTypeForm.roleName.$invalid || newDocFileTypeForm.service_id.$invalid"--> <!--ng-disabled="newDocFileTypeForm.roleName.$invalid || newDocFileTypeForm.service_id.$invalid"-->
<button type="button" class="btn btn-third" data-dismiss="modal" <button type="button" class="btn btn-third" data-dismiss="modal"
ng-click="cancelDocFileType()" translate="Cancel"></button> ng-click="cancelDocFileType()" translate="Cancel4Tax"></button>
</center> </center>
</div> </div>
</form> </form>
......
...@@ -29,8 +29,8 @@ frameworkModule.controller('appUsrOperateLogController', ...@@ -29,8 +29,8 @@ frameworkModule.controller('appUsrOperateLogController',
SweetAlert.warning("没有数据可以下载"); SweetAlert.warning("没有数据可以下载");
return; return;
} }
$scope.thisModuleId=[];//清空查询id
$scope.dataGridUpdate(data); $scope.dataGridUpdate(data);
$scope.thisModuleId=[];//清空查询id
}) })
}; };
// $scope.sniffHelpPopRadio = function(){ // $scope.sniffHelpPopRadio = function(){
...@@ -206,16 +206,22 @@ frameworkModule.directive('usrLogExportPlugin',function(){ ...@@ -206,16 +206,22 @@ frameworkModule.directive('usrLogExportPlugin',function(){
function($scope,SweetAlert,$translate,usrOperateLogService,$q,$log){ function($scope,SweetAlert,$translate,usrOperateLogService,$q,$log){
$scope.exportTableData = function () $scope.exportTableData = function ()
{ {
var checkedItems = $(".log-export-checked-item"); // var checkedItems = $(".log-export-checked-item");
var ids = []; var ids = [];
if(checkedItems.length) /*if(checkedItems.length)
checkedItems.find("span[data-name='logCheckedItem']") checkedItems.find("span[data-name='logCheckedItem']")
.each(function(index,checkedItem){ .each(function(index,checkedItem){
var idLike = checkedItem.getAttribute('data-id'); var idLike = checkedItem.getAttribute('data-id');
if(idLike || idLike == 0){ if(idLike || idLike == 0){
ids.push(idLike); ids.push(idLike);
} }
}); });*/
var datas=$scope.localData;
for(var i=0;i<datas.length;i++){
if(datas[i].id){
ids.push(datas[i].id);
}
}
usrOperateLogService[$scope.thisModuleName + "Export"]({ usrOperateLogService[$scope.thisModuleName + "Export"]({
"ids":ids "ids":ids
}).then(function (data, status, headers) { }).then(function (data, status, headers) {
......
...@@ -18,7 +18,7 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -18,7 +18,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
}; };
$scope.localData = null; $scope.localData = null;
$scope.loadMainData = function () { $scope.loadMainData = function () {
checkReminder();
$scope.queryFieldModel.currentPage = $scope.pagingOptions.pageIndex; $scope.queryFieldModel.currentPage = $scope.pagingOptions.pageIndex;
$scope.queryFieldModel.pageSize = $scope.pagingOptions.pageSize; $scope.queryFieldModel.pageSize = $scope.pagingOptions.pageSize;
...@@ -51,6 +51,36 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -51,6 +51,36 @@ taxDocumentManageModule.controller('taxDocumentListController',
}) })
}; };
function checkReminder(){
var items=$scope.queryFieldModel;
var message="";
if (!PWC.isNullOrEmpty(items.fileBeginTime) && !PWC.isNullOrEmpty(items.fileEndTTime) &&
items.fileBeginTime > items.fileEndTTime)
{
message+=$translate.instant('AvailabilityDate')+",";
}
if (!PWC.isNullOrEmpty(items.ownBeginTime) && !PWC.isNullOrEmpty(items.ownEndTime) &&
items.ownBeginTime > items.ownEndTime)
{
message+=$translate.instant('Duration')+",";
}
if (!PWC.isNullOrEmpty(items.effectiveBeginTime) && !PWC.isNullOrEmpty(items.effectiveEndTime) &&
items.effectiveBeginTime > items.effectiveEndTime)
{
message+=$translate.instant('DueDate')+",";
}
if (!PWC.isNullOrEmpty(items.uploadBeginTime) && !PWC.isNullOrEmpty(items.uploadEndTime) &&
items.uploadBeginTime > items.uploadEndTime)
{
message+=$translate.instant('UploadDate')+",";
}
if(message){
message = (message.substring(message.length - 1) == ',') ? message.substring(0, message.length - 1) : message;
message+="-"+$translate.instant('DateWarningSearch');
window.swal(message);
return;
}
}
$scope.dataGridUpdate = function (_data) { $scope.dataGridUpdate = function (_data) {
$scope.localData = _data.list; $scope.localData = _data.list;
$scope.pagingOptions.pageIndex = _data.pageNo; $scope.pagingOptions.pageIndex = _data.pageNo;
...@@ -1827,7 +1857,7 @@ taxDocumentManageModule.directive('tempModule', function () { ...@@ -1827,7 +1857,7 @@ taxDocumentManageModule.directive('tempModule', function () {
$scope.checkedItemIds = []; $scope.checkedItemIds = [];
$scope.sniffCheckbox = function () { $scope.sniffCheckbox = function () {
$scope.checkedItemIds.length = 0; $scope.checkedItemIds.length = 0;
$("input[name='dataGridCheckBox']").each(function (index, item) { $("tr td[name='logCheckedItem']").each(function (index, item) {
if (item.checked) { if (item.checked) {
var cellId = $(item).attr("data-id"); var cellId = $(item).attr("data-id");
$scope.checkedItemIds.push(cellId); $scope.checkedItemIds.push(cellId);
...@@ -1938,6 +1968,8 @@ taxDocumentManageModule.directive('tempModule', function () { ...@@ -1938,6 +1968,8 @@ taxDocumentManageModule.directive('tempModule', function () {
result = 1; result = 1;
}else if(src === $translate.instant('ApprovalReject')){ }else if(src === $translate.instant('ApprovalReject')){
result = -1; result = -1;
}else{
result="";
} }
return result; return result;
}; };
...@@ -1950,6 +1982,8 @@ taxDocumentManageModule.directive('tempModule', function () { ...@@ -1950,6 +1982,8 @@ taxDocumentManageModule.directive('tempModule', function () {
result = $translate.instant('ApprovalPass'); result = $translate.instant('ApprovalPass');
}else if(src == -1){ }else if(src == -1){
result = $translate.instant('ApprovalReject'); result = $translate.instant('ApprovalReject');
}else{
result="";
} }
return result; return result;
}; };
...@@ -2068,7 +2102,15 @@ taxDocumentManageModule.directive('exportPlugin',function(){ ...@@ -2068,7 +2102,15 @@ taxDocumentManageModule.directive('exportPlugin',function(){
$scope.queryFieldModel.currentPage = $scope.pagingOptions.pageIndex; $scope.queryFieldModel.currentPage = $scope.pagingOptions.pageIndex;
$scope.queryFieldModel.pageSize = $scope.pagingOptions.pageSize; $scope.queryFieldModel.pageSize = $scope.pagingOptions.pageSize;
var delIDs = [];
$("input[name='dataGridCheckBox']").each(function (index, tdCell) {
if (tdCell.checked) {
var cellId = $(tdCell).attr('data-id');
delIDs.push(cellId);
}
});
var params = angular.copy($scope.queryFieldModel); var params = angular.copy($scope.queryFieldModel);
params.ids=delIDs;
params.fileBeginTime = getQueryDate(params.fileBeginTime,"-"); params.fileBeginTime = getQueryDate(params.fileBeginTime,"-");
params.fileEndTTime = getQueryDate(params.fileEndTTime,"-"); params.fileEndTTime = getQueryDate(params.fileEndTTime,"-");
params.ownBeginTime = getQueryDate(params.ownBeginTime,"-"); params.ownBeginTime = getQueryDate(params.ownBeginTime,"-");
......
...@@ -897,7 +897,7 @@ ...@@ -897,7 +897,7 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary" translate="Confirm"></button> <button type="submit" class="btn btn-primary" translate="Confirm"></button>
<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()" <button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()"
translate="Cancel"></button> translate="Cancel4Tax"></button>
</div> </div>
</form> </form>
</div> </div>
...@@ -1146,7 +1146,7 @@ ...@@ -1146,7 +1146,7 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-primary" translate="Confirm" ng-click="multiUploadSubmit_handmade()"></button> <button type="button" class="btn btn-primary" translate="Confirm" ng-click="multiUploadSubmit_handmade()"></button>
<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="closeUploadReview()" <button type="button" class="btn btn-third" data-dismiss="modal" ng-click="closeUploadReview()"
translate="Cancel"></button> translate="Cancel4Tax"></button>
</div> </div>
</form> </form>
</div> </div>
...@@ -1391,7 +1391,7 @@ ...@@ -1391,7 +1391,7 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-primary" translate="Confirm" ng-click="multiUploadSubmit()"></button> <button type="button" class="btn btn-primary" translate="Confirm" ng-click="multiUploadSubmit()"></button>
<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()" <button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()"
translate="Cancel"></button> translate="Cancel4Tax"></button>
</div> </div>
</form> </form>
</div> </div>
...@@ -1444,7 +1444,7 @@ ...@@ -1444,7 +1444,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-primary" translate="Confirm" ng-click="confirmUploadResult()"></button> <button class="btn btn-primary" translate="Confirm" ng-click="confirmUploadResult()"></button>
<button type="button" class="btn btn-third" ng-if="multiUploadErrorItems.length" data-dismiss="modal" translate="Cancel"></button> <button type="button" class="btn btn-third" ng-if="multiUploadErrorItems.length" data-dismiss="modal" translate="Cancel4Tax"></button>
</div> </div>
</div> </div>
</div> </div>
...@@ -1465,7 +1465,7 @@ ...@@ -1465,7 +1465,7 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-primary" translate="Confirm" ng-click="sniffHelpPopRadio()"></button> <button type="button" class="btn btn-primary" translate="Confirm" ng-click="sniffHelpPopRadio()"></button>
<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()" <button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()"
translate="Cancel"></button> translate="Cancel4Tax"></button>
</div> </div>
</div> </div>
</div> </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