Commit 64aa2c3b authored by kevin's avatar kevin

#

parent 6059beec
...@@ -156,4 +156,6 @@ public final class Constant { ...@@ -156,4 +156,6 @@ public final class Constant {
this.segment6 = segment6; this.segment6 = segment6;
} }
} }
} }
\ No newline at end of file
package pwc.taxtech.atms.constant;
/**
* @ClassName TemplateHeaderCheck
* Description TODO
* @Author pwc kevin
* @Date 3/28/2019 12:17 PM
* Version 1.0
**/
public class TemplateHeaderCheck {
public static String[] sjfhse = {
"公司名称", "增值税返还", "城建税返还", "教育费附加返还", "地方教育费附加返还", "个人所得税返还"
};
public static String[] gszse = {
"公司名称", "城建税", "教育费附加", "地方教育费附加", "员工个税", "司机个税", "印花税"
};
//业务线GMV
public static String[] ywxgmv = {
"业务线", "订单环比", "GMV环比", "B端补贴率", "B端环比", "C端补贴率", "C端环比"
};
//职工人数
public static String[] zgrs = {
"公司简称", "正式员工", "实习生", "外包", "合计"
};
//司机人数
public static String[] sjrs = {
"司機類型", "合计"
};
}
...@@ -87,7 +87,9 @@ public class AnalysisController extends BaseController { ...@@ -87,7 +87,9 @@ public class AnalysisController extends BaseController {
} }
return analysisServiceImpl.importDomesitcExcelFile(file,period, type); return analysisServiceImpl.importDomesitcExcelFile(file,period, type);
} catch (ServiceException e) { } catch (ServiceException e) {
return OperationResultDto.error(e.getMessage()); String message = e.getMessage();
String[] split = message.split(":");
return OperationResultDto.error(split[1]);
} catch (Exception e) { } catch (Exception e) {
logger.error("importDomesitcExcelFile error.", e); logger.error("importDomesitcExcelFile error.", e);
return OperationResultDto.error(ErrorMessage.SystemError); return OperationResultDto.error(ErrorMessage.SystemError);
......
...@@ -10,10 +10,7 @@ import pwc.taxtech.atms.constant.enums.EnumServiceType; ...@@ -10,10 +10,7 @@ import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.OrganizationMapper; import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper; import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dpo.ReportDto; import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.FileDto; import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.PeriodReportDto;
import pwc.taxtech.atms.dto.ReportAttachDto;
import pwc.taxtech.atms.dto.vatdto.*; import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.entity.OrganizationExample; import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.entity.Project; import pwc.taxtech.atms.entity.Project;
...@@ -88,14 +85,14 @@ public class ReportController { ...@@ -88,14 +85,14 @@ public class ReportController {
private static OperationResultDto<ReportDataDto> operationResultDto = null; private static OperationResultDto<ReportDataDto> operationResultDto = null;
@RequestMapping(value = "reportEbitData", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "reportEbitData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<ReportDataDto> reportEbitData(Long reportId, String orgId, Integer period) { public OperationResultDto<ReportDataDto> reportEbitData(@RequestBody RequestParameterDto requestParameterDto) {
OperationResultDto resultDto = new OperationResultDto(); /*OperationResultDto resultDto = new OperationResultDto();
if (reportId == null || reportId == 0L) { *//* if (requestParameterDto.getProjectId() == null || requestParameterDto.getReportId() == null) {
resultDto.setResult(false); resultDto.setResult(false);
return resultDto; return resultDto;
} }*/
operationResultDto = reportService.getCellData(reportId, orgId, period); operationResultDto = reportService.getCellData(Long.parseLong(requestParameterDto.getReportId()), requestParameterDto.getOrgId(),requestParameterDto.getPeriod());
return operationResultDto; return operationResultDto;
} }
...@@ -140,16 +137,9 @@ public class ReportController { ...@@ -140,16 +137,9 @@ public class ReportController {
} }
@RequestMapping(value = "getReportByTemplateEbit/{templateId}/{period}/{orgId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<PeriodReportDto> getReportByTemplateEbit(@PathVariable String templateId, @PathVariable Integer period, @PathVariable String orgId) {
OperationResultDto resultDto = new OperationResultDto();
if (templateId == null || period == null || period == 0) {
resultDto.setResult(false);
resultDto.setResultMsg("templateId or period is invalid");
return resultDto;
}
return reportService.getReportByTemplateEbit(Long.parseLong(templateId), period % 100, getProjId(orgId, period));
}
@RequestMapping(value = "getCellTemplateConfig/{reportTemplateId}/{period}/{rowIndex}/{columnIndex}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "getCellTemplateConfig/{reportTemplateId}/{period}/{rowIndex}/{columnIndex}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<PeriodCellTemplateConfig> getCellTemplateConfig(@PathVariable Long reportTemplateId, public OperationResultDto<PeriodCellTemplateConfig> getCellTemplateConfig(@PathVariable Long reportTemplateId,
...@@ -226,7 +216,6 @@ public class ReportController { ...@@ -226,7 +216,6 @@ public class ReportController {
@RequestMapping("loadAttachList") @RequestMapping("loadAttachList")
public List<PwcReportAttach> loadAttachList(@RequestBody ReportAttachDto reportAttachDto) { public List<PwcReportAttach> loadAttachList(@RequestBody ReportAttachDto reportAttachDto) {
System.out.println("sdsdfsd");
return reportService.loadAttachList(reportAttachDto); return reportService.loadAttachList(reportAttachDto);
} }
...@@ -246,4 +235,27 @@ public class ReportController { ...@@ -246,4 +235,27 @@ public class ReportController {
return operationResultDto; return operationResultDto;
} }
@RequestMapping(value = "getReportByTemplateEbit/{templateId}/{period}/{orgId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<PeriodReportDto> getReportByTemplateEbit(@PathVariable String templateId, @PathVariable Integer period, @PathVariable String orgId) {
OperationResultDto resultDto = new OperationResultDto();
if (templateId == null || period == null || period == 0) {
resultDto.setResult(false);
resultDto.setResultMsg("templateId or period is invalid");
return resultDto;
}
return reportService.getReportByTemplateEbit(Long.parseLong(templateId), period % 100, getProjId(orgId, period));
}
/**
*批量导出利润表
*/
@RequestMapping("manyExport")
public OperationResultDto manyExport(@RequestBody RequestParameterDto requestParameterDto){
OperationResultDto operationResultDto = new OperationResultDto();
operationResultDto.setResult(null);
return operationResultDto;
}
} }
\ No newline at end of file
...@@ -145,9 +145,9 @@ public class TemplateGroupController { ...@@ -145,9 +145,9 @@ public class TemplateGroupController {
@ResponseBody @ResponseBody
@RequestMapping(value = "ebitTemplateImport", method = RequestMethod.POST) @RequestMapping(value = "ebitTemplateImport", method = RequestMethod.POST)
public OperationResultDto ebitTemplateImport(@RequestParam MultipartFile file, public OperationResultDto ebitTemplateImport(@RequestParam("file") MultipartFile file,
@RequestParam String orgId, @RequestParam("orgId") String orgId,
@RequestParam Integer period) { @RequestParam("period") Integer period) {
try { try {
templateGroupService.ebitTemplateImport(file, orgId,period); templateGroupService.ebitTemplateImport(file, orgId,period);
return OperationResultDto.success(); return OperationResultDto.success();
......
package pwc.taxtech.atms.dto;
import java.io.Serializable;
/**
* @ClassName RequestParameterDto
* Description TODO
* @Author pwc kevin
* @Date 3/27/2019 6:38 PM
* Version 1.0
* 请求参数封装
**/
public class RequestParameterDto implements Serializable {
private String reportId;
private String orgId;
private Integer period;
private String templateId;
private String projectId;
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
public String toString() {
return "RequestParameterDto{" +
"reportId='" + reportId + '\'' +
", orgId='" + orgId + '\'' +
", period=" + period +
", templateId='" + templateId + '\'' +
", projectId='" + projectId + '\'' +
'}';
}
}
...@@ -23,4 +23,5 @@ public class Exceptions { ...@@ -23,4 +23,5 @@ public class Exceptions {
public static final FormulaException PSUM_CELL_TEMP_NULL = new FormulaException("cell template group is null or empty"); public static final FormulaException PSUM_CELL_TEMP_NULL = new FormulaException("cell template group is null or empty");
public static final ApiException NOT_FOUND_INSTANCE_EXCEPTION = new NotFoundException("not found instance"); public static final ApiException NOT_FOUND_INSTANCE_EXCEPTION = new NotFoundException("not found instance");
public static final FormulaException parameterError = new FormulaException("formula parameter is error"); public static final FormulaException parameterError = new FormulaException("formula parameter is error");
public static final FormulaException IMPORT_TEMPLATE_HEADER_ERROR = new FormulaException("导入模板不匹配");
} }
...@@ -27,6 +27,7 @@ import pwc.taxtech.atms.dto.OperationResultDto; ...@@ -27,6 +27,7 @@ import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateGroupDto; import pwc.taxtech.atms.dto.TemplateGroupDto;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.ServiceException; import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.vat.dao.EbitCellDataMapper;
import pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper; import pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper;
import pwc.taxtech.atms.vat.entity.*; import pwc.taxtech.atms.vat.entity.*;
...@@ -63,6 +64,9 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -63,6 +64,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
@Autowired @Autowired
private DidiFileUploadService didiFileUploadService; private DidiFileUploadService didiFileUploadService;
@Autowired
protected DistributedIdService idService;
public List<TemplateGroupDto> get() { public List<TemplateGroupDto> get() {
List<TemplateGroup> templateGroups = templateGroupMapper.selectByExample(new TemplateGroupExample()); List<TemplateGroup> templateGroups = templateGroupMapper.selectByExample(new TemplateGroupExample());
List<TemplateGroupDto> templateGroupDtos = new ArrayList<>(); List<TemplateGroupDto> templateGroupDtos = new ArrayList<>();
...@@ -196,7 +200,10 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -196,7 +200,10 @@ public class TemplateGroupServiceImpl extends AbstractService {
public static final String PROTABLEID = "100610523201314816"; public static final String PROTABLEID = "100610523201314816";
public void ebitTemplateImport(MultipartFile file, String orgId, Integer period) { @Autowired
private EbitCellDataMapper ebitCellDataMapper;
public OperationResultDto ebitTemplateImport(MultipartFile file, String orgId, Integer period) {
OperationResultDto operationResultDto = new OperationResultDto();
InputStream inputStream = null; InputStream inputStream = null;
Date now = new Date(); Date now = new Date();
String projectId = getProjId(orgId, period); String projectId = getProjId(orgId, period);
...@@ -216,29 +223,39 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -216,29 +223,39 @@ public class TemplateGroupServiceImpl extends AbstractService {
if (period == null) { if (period == null) {
throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod); throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod);
} }
//判断是否已经上传
EbitCellDataExample example = new EbitCellDataExample();
EbitCellDataExample.Criteria criteria = example.createCriteria();
criteria.andPeriodEqualTo(period).andOrganizationIdEqualTo(orgId);
if(ebitCellDataMapper.selectByExample(example).size() != 0){
ebitCellDataMapper.deleteByExample(example);
}
for (int j = 1; j <= sheet.getRow(0).getLastCellNum(); j++) { for (int j = 1; j <= sheet.getRow(0).getLastCellNum(); j++) {
for (int m = 1; j < sheet.getLastRowNum(); j++) { for (int m = 1; j < sheet.getLastRowNum(); j++) {
if (j == 2 || j == 3) { if (j == 1 || j == 2) {
EbitCellData ebitCellData = new EbitCellData(); EbitCellData ebitCellData = new EbitCellData();
ebitCellData.setId(idService.nextId());
ebitCellData.setCol(j); ebitCellData.setCol(j);
ebitCellData.setRow(m); ebitCellData.setRow(m);
ebitCellData.setCreateTime(now); ebitCellData.setCreateTime(now);
ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue()); ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue());
ebitCellData.setTemplateId(PROTABLEID); ebitCellData.setTemplateId(PROTABLEID);
ebitCellData.setProjectId(projectId); ebitCellData.setProjectId(projectId);
ebitCellData.setOrganizationId(orgId);
ebitCellData.setPeriod(period);
list.add(ebitCellData); list.add(ebitCellData);
} }
} }
} }
ebitCellDataMapper.insertBatch(list);
} }
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace();
} catch (InvalidFormatException e) {
e.printStackTrace(); e.printStackTrace();
operationResultDto.setResult(false);
} }
operationResultDto.setResult(true);
return operationResultDto;
} }
public class TemplateGroupMessage { public class TemplateGroupMessage {
......
...@@ -771,4 +771,12 @@ public class ExcelUtil { ...@@ -771,4 +771,12 @@ public class ExcelUtil {
} }
} }
//验证表头
public static void checkHeader (Sheet sheet, String[] headerArr, Exception exception) throws Exception {
for(int i =0; i< headerArr.length; i++){
if(!(headerArr[i].trim().equals(sheet.getRow(0).getCell(i).toString().trim()))){
throw exception;
}
}
}
} }
...@@ -1077,44 +1077,77 @@ public class ReportServiceImpl extends BaseService { ...@@ -1077,44 +1077,77 @@ public class ReportServiceImpl extends BaseService {
} }
public OperationResultDto<ReportDataDto> getCellData(Long reportId, String orgId, Integer period) { public OperationResultDto<ReportDataDto> getCellData(Long reportId, String orgId, Integer period) {
orgId="5bbd739c-1a13-4b0f-aba6-32ba41e4de69";
OperationResultDto<ReportDataDto> cellData = getCellData(reportId, getProjId(orgId, period)); OperationResultDto<ReportDataDto> cellData = getCellData(reportId, getProjId(orgId, period));
cellData.getData().setEbitData(loadEbitDataFirst(orgId, period));//特殊因素考虑 默认为0 rate 默认为1% EbitDataDto ebitDataDto = loadEbitDataFirst(orgId, period);
if (ebitDataDto != null) {
cellData.getData().setEbitData(ebitDataDto);
}else{
//特殊因素考虑 默认为0 rate 默认为1%
EbitDataDto ebitDataDto1 = loadEbitData(orgId, period, 0, "1%");
if(ebitDataDto1 !=null)
if(cellData.getData() != null){
cellData.getData().setEbitData(ebitDataDto1);
}else{
ReportDataDto reportDataDto = new ReportDataDto();
reportDataDto.setEbitData(ebitDataDto1);
cellData.setData(reportDataDto);
return cellData;
}
}
return cellData; return cellData;
} }
public EbitDataDto loadEbitDataFirst(String orgId, Integer period){ public EbitDataDto loadEbitDataFirst(String orgId, Integer period) {
EbitDataDto ebitDataDto = new EbitDataDto(); EbitDataDto ebitDataDto = new EbitDataDto();
EbitCellDataExample example = new EbitCellDataExample(); EbitCellDataExample example = new EbitCellDataExample();
EbitCellDataExample.Criteria criteria = example.createCriteria(); EbitCellDataExample.Criteria criteria = example.createCriteria();
criteria.andOrganizationIdEqualTo(orgId); criteria.andOrganizationIdEqualTo(orgId);
criteria.andPeriodEqualTo(period); criteria.andPeriodEqualTo(period);
List<EbitCellData> ebitCellData = ebitCellDataMapper.selectByExample(example); List<EbitCellData> ebitCellData = ebitCellDataMapper.selectByExample(example);
for(EbitCellData ebitCellData1 : ebitCellData){ boolean bool = false;
switch (ebitCellData1.getRow()){ for (EbitCellData ebitCellData1 : ebitCellData) {
bool = true;
switch (ebitCellData1.getRow()) {
case 37: case 37:
if (ebitCellData1.getData() == null)
break;
ebitDataDto.setSpecialConsiderations(ebitCellData1.getData()); ebitDataDto.setSpecialConsiderations(ebitCellData1.getData());
break; break;
case 38: case 38:
if (ebitCellData1.getData() == null)
break;
ebitDataDto.setSpecialConsiderations(ebitCellData1.getData()); ebitDataDto.setSpecialConsiderations(ebitCellData1.getData());
break; break;
case 39: case 39:
if (ebitCellData1.getData() == null)
break;
ebitDataDto.setSpecialFactors(new BigDecimal(ebitCellData1.getData())); ebitDataDto.setSpecialFactors(new BigDecimal(ebitCellData1.getData()));
break; break;
case 40: case 40:
if (ebitCellData1.getData() == null)
break;
ebitDataDto.setEbitRate(Double.parseDouble(ebitCellData1.getData())); ebitDataDto.setEbitRate(Double.parseDouble(ebitCellData1.getData()));
break; break;
case 41: case 41:
if (ebitCellData1.getData() == null)
break;
ebitDataDto.setTransactionAmount(new BigDecimal(ebitCellData1.getData())); ebitDataDto.setTransactionAmount(new BigDecimal(ebitCellData1.getData()));
break; break;
case 42: case 42:
if (ebitCellData1.getData() == null)
break;
ebitDataDto.setSixAddTax(ebitCellData1.getData()); ebitDataDto.setSixAddTax(ebitCellData1.getData());
break; break;
case 43: case 43:
if (ebitCellData1.getData() == null)
break;
ebitDataDto.setTotalAmountTax(new BigDecimal(ebitCellData1.getData())); ebitDataDto.setTotalAmountTax(new BigDecimal(ebitCellData1.getData()));
break; break;
} }
} }
if (!bool)
return null;
return ebitDataDto; return ebitDataDto;
} }
...@@ -1344,7 +1377,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1344,7 +1377,7 @@ public class ReportServiceImpl extends BaseService {
spec = new BigDecimal(specialConsiderations); spec = new BigDecimal(specialConsiderations);
if (_index != -1) { if (_index != -1) {
rate = Double.parseDouble(ebitRate.substring(0, _index - 1)) / 100; rate = Double.parseDouble(ebitRate.substring(0, _index)) / 100;
} else { } else {
rate = Double.parseDouble(ebitRate) / 100; rate = Double.parseDouble(ebitRate) / 100;
} }
...@@ -1353,7 +1386,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1353,7 +1386,7 @@ public class ReportServiceImpl extends BaseService {
ProfitLossStatementExample.Criteria criteria = example.createCriteria(); ProfitLossStatementExample.Criteria criteria = example.createCriteria();
criteria.andOrganizationIdEqualTo(orgId); criteria.andOrganizationIdEqualTo(orgId);
criteria.andPeriodEqualTo(period); criteria.andPeriodEqualTo(period);
List<ProfitLossStatement> profitLossStatements = profitLossStatementFinalMapper.selectByCondition(example); List<ProfitLossStatement> profitLossStatements = profitLossStatementFinalMapper.selectByExample(example);
BigDecimal yysr = new BigDecimal(0);//营业收入 BigDecimal yysr = new BigDecimal(0);//营业收入
BigDecimal yycb = new BigDecimal(0);//营业成本 BigDecimal yycb = new BigDecimal(0);//营业成本
BigDecimal yysjfj = new BigDecimal(0);//营业税金附加 BigDecimal yysjfj = new BigDecimal(0);//营业税金附加
...@@ -1474,7 +1507,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1474,7 +1507,7 @@ public class ReportServiceImpl extends BaseService {
Optional<PeriodReport> report = periodReportMapper.selectByExample(example).stream().findFirst(); Optional<PeriodReport> report = periodReportMapper.selectByExample(example).stream().findFirst();
if (report.isPresent()) { if (report.isPresent()) {
PeriodReportDto periodReportDto = new PeriodReportDto(); PeriodReportDto periodReportDto = new PeriodReportDto();
BeanUtils.copyProperties(report, periodReportDto); BeanUtils.copyProperties(report.get(), periodReportDto);
resultDto.setResult(true); resultDto.setResult(true);
resultDto.setData(periodReportDto); resultDto.setData(periodReportDto);
} else { } else {
...@@ -2086,7 +2119,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -2086,7 +2119,7 @@ public class ReportServiceImpl extends BaseService {
criteria.andRowEqualTo(i); criteria.andRowEqualTo(i);
List<EbitCellData> ebitCellData = ebitCellDataMapper.selectByExample(example); List<EbitCellData> ebitCellData = ebitCellDataMapper.selectByExample(example);
if (ebitCellData.size() == 0) { if (ebitCellData.size() == 0) {
ebitCellDataMapper.insert(switchMeth(i, new EbitCellData(), operationResultDto, specialConsiderations, ebitRate, orgId,period)); ebitCellDataMapper.insert(switchMeth(i, new EbitCellData(), operationResultDto, specialConsiderations, ebitRate, orgId, period));
} else { } else {
ebitCellDataMapper.updateByExampleSelective(switchMeth(i, new EbitCellData(), operationResultDto, specialConsiderations, ebitRate, orgId, period), example); ebitCellDataMapper.updateByExampleSelective(switchMeth(i, new EbitCellData(), operationResultDto, specialConsiderations, ebitRate, orgId, period), example);
} }
......
...@@ -229,9 +229,9 @@ public class FunctionBase { ...@@ -229,9 +229,9 @@ public class FunctionBase {
List<PeriodDataSource> dss = agent.queryManualDataSource(cellTemplateId, formulaContext.getProjectId(), formulaContext.getPeriod()); List<PeriodDataSource> dss = agent.queryManualDataSource(cellTemplateId, formulaContext.getProjectId(), formulaContext.getPeriod());
if (eval instanceof ErrorEval || eval == null || eval instanceof BlankEval) { if (eval instanceof ErrorEval || eval == null || eval instanceof BlankEval) {
if(eval !=null && eval instanceof ErrorEval){ if(eval !=null && eval instanceof ErrorEval){ErrorEval
LOGGER.warn("[Formula_Exception] error eval for cell {} and error code {} and error String {}", cellTemplateId, LOGGER.warn("[Formula_Exception] error eval for cell {} and error code {} and error String {}", cellTemplateId,
((ErrorEval) eval).getErrorCode(), ((ErrorEval) eval).getErrorString()); ((ErrorEval) eval).getErrorCode(), (() eval).getErrorString());
} }
if (!dss.isEmpty()) return dss.get(0).getAmount(); if (!dss.isEmpty()) return dss.get(0).getAmount();
} else { } else {
......
...@@ -7,6 +7,7 @@ import org.apache.ibatis.session.RowBounds; ...@@ -7,6 +7,7 @@ import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.EbitCellData; import pwc.taxtech.atms.vat.entity.EbitCellData;
import pwc.taxtech.atms.vat.entity.EbitCellDataExample; import pwc.taxtech.atms.vat.entity.EbitCellDataExample;
import pwc.taxtech.atms.vat.entity.ProfitLossStatement;
@Mapper @Mapper
public interface EbitCellDataMapper extends MyVatMapper { public interface EbitCellDataMapper extends MyVatMapper {
...@@ -105,4 +106,7 @@ public interface EbitCellDataMapper extends MyVatMapper { ...@@ -105,4 +106,7 @@ public interface EbitCellDataMapper extends MyVatMapper {
* @mbg.generated * @mbg.generated
*/ */
int updateByPrimaryKey(EbitCellData record); int updateByPrimaryKey(EbitCellData record);
int insertBatch(List<EbitCellData> pls);
} }
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.EbitCellDataMapper">
<sql id="Base_Column_List_Ebit">
id, template_id, `data`, organization_id, project_id, row, col,
period, create_time, update_time
</sql>
<insert id="insertBatch" parameterType="java.util.List">
insert into profit_loss_statement_manual
(<include refid="Base_Column_List_Ebit"/>)
values
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">#{item.id,jdbcType=BIGINT},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.templateId != null">#{item.templateId,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.data != null">#{item.data,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.organizationId != null">#{item.organizationId,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.row != null">#{item.row,jdbcType=INTEGER},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.col != null">#{item.col,jdbcType=INTEGER},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.period != null">#{item.period,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.createTime != null">#{item.createTime,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.updateTime != null">#{item.updateTime,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP</otherwise>
</choose>
</trim>
</foreach>;
SELECT 1 FROM DUAL;
</insert>
</mapper>
\ No newline at end of file
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
}); });
scope.$watchGroup(['reportSource', 'formulaBlocks', 'manualDataSources', 'templateId'], function (newVal, oldValue) { scope.$watchGroup(['reportSource', 'formulaBlocks', 'manualDataSources', 'templateId'], function (newVal, oldValue) {
if (scope.templateId && scope.reportSource && scope.hasLoadSpread) { if (scope.templateId && scope.reportSource) {
setData(); setData();
} }
}); });
...@@ -85,9 +85,9 @@ ...@@ -85,9 +85,9 @@
} }
}; };
scope.$watchGroup(['relation.period', 'relation.orgId', 'relation.data'], function(newValue, oldValue){ scope.$watchGroup(['relation.period', 'relation.orgId', 'relation.data', 'relation.broadcast'], function(newValue, oldValue){
if(scope.relation.orgId != null && scope.relation.period != null && scope.spread != undefined){ if(scope.relation.orgId != null && scope.relation.period != null && scope.spread != undefined){
setData("true") loadSheet(scope.templateId, true)
} }
}); });
var loadSheet = function (templateId, init) { var loadSheet = function (templateId, init) {
...@@ -177,10 +177,19 @@ ...@@ -177,10 +177,19 @@
} }
spread.resumePaint(); spread.resumePaint();
scope.spread = spread; scope.spread = spread;
if (scope.templateId && scope.reportSource && scope.hasLoadSpread) { if (scope.templateId && scope.reportSource ) {
setData("false"); setData("true");
}
//
sheet.setColumnWidth(0, 350)
//添加单元格
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
for(var i=0; i<=7; i++){
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.setValue(i+37,0, profileList[i]);
} }
return $q.when(spread); return $q.when(spread);
}; };
...@@ -346,6 +355,7 @@ ...@@ -346,6 +355,7 @@
// Get spreadJS control. // Get spreadJS control.
var getSpreadControl = function () { var getSpreadControl = function () {
scope.relation.sheetArea = GC.Spread.Sheets.SheetArea;
return new GC.Spread.Sheets.Workbook(getSpreadControlElement()); return new GC.Spread.Sheets.Workbook(getSpreadControlElement());
}; };
...@@ -525,30 +535,27 @@ ...@@ -525,30 +535,27 @@
var loadEbitCell = function(sheet, type){ var loadEbitCell = function(sheet, type){
for( var r = 37; r<= 43; r++ ){ for( var r = 37; r<= 43; r++ ){
for(var c = 1; c<=3; c++){ for(var c = 1; c<=3; c++){
if( c == 1){
sheet.setValue(r,c, profileList[r-37]);
}
if(c == 3 && type){ if(c == 3 && type){
if(r == 37){ if(r == 37){
sheet.setValue(r, c,scope.relation.data.ebitSubtraction); sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.ebitSubtraction));
} }
if(r == 38){ if(r == 38){
sheet.setValue(r, c,scope.relation.data.specialConsiderations ); sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.specialConsiderations));
} }
if(r == 39){ if(r == 39){
sheet.setValue(r, c,scope.relation.data.specialFactors); sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.specialFactors));
} }
if(r == 40){ if(r == 40){
sheet.setValue(r, c,scope.relation.data.ebitRate); sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.ebitRate));
} }
if(r == 41){ if(r == 41){
sheet.setValue(r, c,scope.relation.data.transactionAmount); sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.transactionAmount));
} }
if(r == 42){ if(r == 42){
sheet.setValue(r, c,scope.relation.data.sixAddTax); sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.sixAddTa));
} }
if(r ==43){ if(r ==43){
sheet.setValue(r, c,scope.relation.data.totalAmountTax); sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.totalAmountTax));
} }
} }
} }
......
...@@ -1099,8 +1099,8 @@ ...@@ -1099,8 +1099,8 @@
BSPLService.getReportData(); BSPLService.getReportData();
}; };
var getReportData = function (cb) { var getReportData = function (cb, period) {
vatReportService.getReportEbitData($scope.reportId, $scope.relation.orgId, $scope.relation.period ).success(function (reportData) { vatReportService.getReportEbitData($scope.reportId, $scope.relation.orgId, $scope.relation.period == undefined ? period : $scope.relation.period ).success(function (reportData) {
if (reportData && reportData.data && reportData.data.cellData) { if (reportData && reportData.data && reportData.data.cellData) {
_.each(reportData.data.cellData, function (x) { _.each(reportData.data.cellData, function (x) {
x.value = x.cellValue; x.value = x.cellValue;
...@@ -1110,14 +1110,17 @@ ...@@ -1110,14 +1110,17 @@
$scope.formulaBlocks = reportData.data.formulaBlocks; $scope.formulaBlocks = reportData.data.formulaBlocks;
$scope.manualDataSources = reportData.data.manualDataSources; $scope.manualDataSources = reportData.data.manualDataSources;
$scope.relation.data = reportData.data.ebitData; $scope.relation.data = reportData.data.ebitData;
if(cb)
cb(); cb();
} else { } else {
$scope.reportData = []; $scope.reportData = [];
$scope.formulaBlocks = []; $scope.formulaBlocks = [];
$scope.manualDataSources = []; $scope.manualDataSources = [];
$scope.relation.data = reportData.data.ebitData;
if(cb)
cb();
} }
}); });
}; };
var loadCellData = function (period, orgId,cb) { var loadCellData = function (period, orgId,cb) {
...@@ -1127,7 +1130,7 @@ ...@@ -1127,7 +1130,7 @@
vatReportService.getReportByTemplateIdEbit($scope.templateId, period, orgId).success(function (report) { vatReportService.getReportByTemplateIdEbit($scope.templateId, period, orgId).success(function (report) {
if (report.result) { if (report.result) {
$scope.reportId = report.data.id; $scope.reportId = report.data.id;
getReportData(cb); getReportData(cb, period);
} else if (!(report.result && report.data)) { } else if (!(report.result && report.data)) {
$scope.reportData = []; $scope.reportData = [];
$scope.formulaBlocks = []; $scope.formulaBlocks = [];
...@@ -2849,7 +2852,6 @@ ...@@ -2849,7 +2852,6 @@
}); });
}, },
onInitialized: function (e) { onInitialized: function (e) {
debugger;
$scope.dataSourceIndustryListInstance = e.component; $scope.dataSourceIndustryListInstance = e.component;
} }
} }
...@@ -2923,7 +2925,6 @@ ...@@ -2923,7 +2925,6 @@
$scope.relation.data = res.data; $scope.relation.data = res.data;
} }
}).error(function(error){ }).error(function(error){
deferred.reject(error);
}); });
} }
...@@ -2931,14 +2932,16 @@ ...@@ -2931,14 +2932,16 @@
$scope.upload($scope.file); $scope.upload($scope.file);
}); });
//上传模板 //上传模板
//Upload.setDefaults( {ngf-keep:false ngf-accept:'image/*', ...} );
$scope.upload = function (file) { $scope.upload = function (file) {
if(file == null)
return
frontImport(file);
var token = $('input[name="__RequestVerificationToken"]').val(); var token = $('input[name="__RequestVerificationToken"]').val();
var url = apiInterceptor.webApiHostUrl + '/templateGroup/ebitTemplateImport'; var url = apiInterceptor.vatWebApiHostUrl + '/templateGroup/ebitTemplateImport';
Upload.upload( Upload.upload(
{ {
url: url, url: url,
fields: {orgId : $scope.relation.orgId, period : $scope.relation.period}, file: file, data: {orgId : $scope.relation.orgId, period : $scope.relation.period}, file: file,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken() Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()
...@@ -2949,11 +2952,73 @@ ...@@ -2949,11 +2952,73 @@
.progress(function (evt) { .progress(function (evt) {
}) })
.success(function (data, status, headers, config) { .success(function (data, status, headers, config) {
SweetAlert.error("上传成功");
$scope.relation.fileName = config.file.name;
vatReportService.frontImportBack().success(function(res){
getReportData(function(){
$scope.relation.broadcast = true;
}, $scope.relation.period);
});
}) })
.error(function (data, status, headers, config) { .error(function (data, status, headers, config) {
SweetAlert.error(status + '错误' + ",上传失败")
}) })
}; };
//前端导入
var frontImport = function(file){
alert(typeof file);
if(typeof file != Blob){
file = new Blob(file);
}
if($scope.spread != undefined && $scope.spread){
var excelIo = new GC.Spread.Excel.IO();
excelIo.open(file, function (json) {
var workbookObj = json;
spread.fromJSON(workbookObj);
}, function (e) {
// process error
alert(e.errorMessage);
if (e.errorCode === 2/*noPassword*/ || e.errorCode === 3 /*invalidPassword*/) {
}
});
}
}
$scope.singleExport = function(){
if($scope.spread != undefined && $scope.spread){
var excelIo = new GC.Spread.Excel.IO();
var fileName = $scope.relation.fileName;
if (fileName.substr(-5, 5) !== '.xlsx') {
fileName += '.xlsx';
}
var json = $scope.spread.toJSON();
// here is excel IO API
excelIo.save(json, function (blob) {
saveAs(blob, fileName);
}, function (e) {
// process error
console.log(e);
});
}
};
//批量导出,导出当前期间进行过保存或刷新的所有的机构的利润表
$scope.manyExport = function(){
var param = {
period : $scope.relation.period,
templateId : $scope.templateId
}
vatReportService.manyExport(JSON.stringify(param)).success(function(res){
}).error(function(error){
SweetAlert.error(error + "批量导出失败")
});
};
// ---------------------------------------end ------------------------------------------- // ---------------------------------------end -------------------------------------------
(function initialize() { (function initialize() {
......
...@@ -22,19 +22,19 @@ ...@@ -22,19 +22,19 @@
</div> </div>
</div> </div>
<div class="col-sm-5" class="bar-export" style=" margin-top: 20px;width: 39%; float: right;"> <div class="col-sm-5" class="bar-export" style=" margin-top: 20px;width: 39%; float: right;">
<span ng-click="uploadProfileTable()" ngf-select ngf-change="upload($files)" ngf-multiple="true" <span ngf-select="upload($files)" ngf-multiple="false"
ngf-validate="{size: {min:'10KB', max:'20MB'}}"><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span> ngf-validate="{size: {min:'10KB', max:'20MB'}}"><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span>
<span ng-click="saveAndRefresh()"><i class="fa fa-refresh"></i>&nbsp;{{'saveAndRefresh' | translate}}</span> <span ng-click="saveAndRefresh()"><i class="fa fa-refresh"></i>&nbsp;{{'saveAndRefresh' | translate}}</span>
<span ng-click="singleExport();"><i <span ng-click="singleExport()"><i
class="fa fa-upload"></i>&nbsp;{{'singleExport' | translate}}</span> class="fa fa-upload"></i>&nbsp;{{'singleExport' | translate}}</span>
<span ng-click="manyExport()"><i <span ng-click="manyExport()"><i
class="fa fa-cloud-upload"></i>&nbsp;{{'manyExport' | translate}}</span> class="fa fa-cloud-upload"></i>&nbsp;{{'manyExport' | translate}}</span>
</div> </div>
</div> </div>
internationalDataImport
<div class='report-container' id="reportContainer"> <div class='report-container' id="reportContainer">
<input type="file" id="fileDemo" style="display: none" class="input"> <input type="file" id="fileDemo" style="display: none" class="input" ng-model = "relation.fileName">
<table-report-sheet report-source="reportData" spread='spread' template-id='templateId' <table-report-sheet report-source="reportData" spread='spread' template-id='templateId'
relation="relation"> relation="relation">
</table-report-sheet> </table-report-sheet>
......
...@@ -61,8 +61,18 @@ ...@@ -61,8 +61,18 @@
return $http.get('/Report/reportData/' + reportId, apiConfig.createVat()); return $http.get('/Report/reportData/' + reportId, apiConfig.createVat());
}, },
getReportEbitData: function (reportId, orgId, period) { getReportEbitData: function (reportId, orgId, period) {
return $http.get('/Report/reportEbitData?reportId=' + reportId + '&orgId=' + orgId, +'&period=' + period, apiConfig.createVat()); var param = {
reportId: reportId,
period: period,
orgId : orgId
}
param = JSON.stringify(param);
return $http.post('/Report/reportEbitData',param, apiConfig.createVat({ contentType:"application/json"}));
} , } ,
manyExport : function(param){
return $http.post('/Report/manyExport', param, apiConfig.createVat());
}
,
saveAndRefresh: function (orgId, period, specialConsiderations, ebitRate) { saveAndRefresh: function (orgId, period, specialConsiderations, ebitRate) {
return $http.get('/Report/specialConsiderations?=' + orgId + '&period=' + period + "&specialConsiderations=" + specialConsiderations + "&ebitRate=" + ebitRate, apiConfig.createVat()); return $http.get('/Report/specialConsiderations?=' + orgId + '&period=' + period + "&specialConsiderations=" + specialConsiderations + "&ebitRate=" + ebitRate, apiConfig.createVat());
}, },
......
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