Commit 4b47db19 authored by kevin's avatar kevin

Merge branch 'dev_mysql' of https://gitee.com/Memorydoc/atms into dev_mysql

parents 3fd60ed7 35ce6e92
......@@ -37,9 +37,12 @@ public class AnalysisJob extends QuartzJobBean {
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
//e.createCriteria().andIsActiveEqualTo(true);
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));
analysisJobService.analysisExpectedTax(orgs,period, EnumTbImportType.CoverImport.getCode());
......@@ -49,15 +52,16 @@ public class AnalysisJob extends QuartzJobBean {
logger.info(String.format("开始分析%s档案管理数据",period));
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));
analysisJobService.analysisSales(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s返还后税数据",period));
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;
import com.google.common.collect.Lists;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.nutz.http.Http;
......@@ -23,6 +24,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.List;
import java.util.zip.ZipEntry;
......@@ -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
......@@ -285,7 +285,7 @@ public class AnalysisServiceImpl extends BaseService {
AnalysisTax model = new AnalysisTax();
model.setId(idService.nextId());
model.setOrganizationId(org.getId());
model.setSeqNo(org.getCode()+""+period);
model.setSeqNo(getSeqNoByPeriod(org.getId(), period));
model.setPeriod(period);
model.setCompanyName(org.getName());
model.setTaxGroup(getCellStringValue(sheet.getRow(0).getCell(k)));
......@@ -293,6 +293,16 @@ public class AnalysisServiceImpl extends BaseService {
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) {
try{
InputStream inputStream = file.getInputStream();
......@@ -346,7 +356,7 @@ public class AnalysisServiceImpl extends BaseService {
AnalysisActualTaxReturn model = new AnalysisActualTaxReturn();
model.setId(idService.nextId());
model.setOrganizationId(org.getId());
model.setSeqNo(org.getCode()+""+period);
model.setSeqNo(getSeqNoByPeriod(org.getId(), period));
model.setPeriod(period);
model.setCompanyName(org.getName());
model.setTaxReturnGroup(getCellStringValue(sheet.getRow(0).getCell(k)));
......@@ -381,6 +391,10 @@ public class AnalysisServiceImpl extends BaseService {
model.setInternAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(2)));
model.setVendorAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(3)));
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);
}
AnalysisEmployeeNumExample example = new AnalysisEmployeeNumExample();
......@@ -487,7 +501,6 @@ public class AnalysisServiceImpl extends BaseService {
throw new ServiceException(e);
}
}
private void importAnalysisInterTaxDataExcelFile(MultipartFile file, String periodDate,
String companyName,String country) {
try{
......
......@@ -2465,6 +2465,7 @@ public class ReportServiceImpl extends BaseService {
for (int m = 0; m < 3; m++) {
FileExcelUtil.cloneCell(sheetAt.getRow(m).getCell(2), sheetAt.getRow(m).getCell(1));
sheetAt.getRow(m).getCell(3).setCellValue("");
sheetAt.getRow(m).getCell(1).setCellValue("");
}
style1.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
......@@ -2472,7 +2473,7 @@ public class ReportServiceImpl extends BaseService {
sheetAt.getRow(2).getCell(2).setCellValue("本期:" + spreadData.get(0).getPeriod());
}
/* public String getCellStringValue(Cell cell) {
public String getCellStringValue(Cell cell) {
String cellValue = null;
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_STRING://字符串类型
......@@ -2498,7 +2499,7 @@ public class ReportServiceImpl extends BaseService {
break;
}
return cellValue;
}*/
}
@Autowired
private OrganizationMapper organizationMapper;
......@@ -2525,7 +2526,7 @@ public class ReportServiceImpl extends BaseService {
}
}
private String getCellStringValue(Cell cell) {
/* private String getCellStringValue(Cell cell) {
if (cell.getCellTypeEnum().equals(CellType.STRING)) {
return cell.getStringCellValue();
} else if (cell.getCellTypeEnum().equals(CellType.NUMERIC)) {
......@@ -2534,5 +2535,5 @@ public class ReportServiceImpl extends BaseService {
}
logger.warn("获取单元格数据类型未匹配");
return null;
}
}*/
}
......@@ -28,7 +28,7 @@ public class AnalysisTest extends CommonIT {
public void analysisExpectedTax(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
//e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s预期返还税数据",period));
analysisJobService.analysisExpectedTax(orgs,period, EnumTbImportType.CoverImport.getCode());
......@@ -39,7 +39,7 @@ public class AnalysisTest extends CommonIT {
public void analysisFee(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
//e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s费用数据",period));
analysisJobService.analysisFee(orgs,period, EnumTbImportType.CoverImport.getCode());
......@@ -49,7 +49,7 @@ public class AnalysisTest extends CommonIT {
public void analysisFileManagement(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
// e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s文档管理数据",period));
......@@ -60,7 +60,7 @@ public class AnalysisTest extends CommonIT {
public void analysisMaster(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
//e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s机构数据",period));
analysisJobService.analysisMaster(orgs,period, EnumTbImportType.CoverImport.getCode());
......@@ -70,7 +70,7 @@ public class AnalysisTest extends CommonIT {
public void analysisSales(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
//e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s申报表数据",period));
analysisJobService.analysisSales(orgs,period, EnumTbImportType.CoverImport.getCode());
......@@ -80,9 +80,19 @@ public class AnalysisTest extends CommonIT {
public void analysisTaxReturnEnd(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
//e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s返还后税数据",period));
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());
}
}
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