Commit 864f1c9f authored by eddie.woo's avatar eddie.woo

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents eb6c0ce2 75c4a42d
......@@ -73,8 +73,12 @@ public class POIUtil {
if (null != cell.getCellComment()) {
targetCell.setCellComment(cell.getCellComment());
}
if (null != cell.getCellStyle()) {
targetCell.getCellStyle().cloneStyleFrom(cell.getCellStyle());
if (null != cell.getCellStyle() && targetCell.getCellStyle() != null ) {
try{
targetCell.getCellStyle().cloneStyleFrom(cell.getCellStyle());
}catch (Exception e){
//e.printStackTrace();
}
}
if (null != cell.getHyperlink()) {
targetCell.setHyperlink(cell.getHyperlink());
......
......@@ -61,7 +61,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public static ProfitLossStatementMapper profitLossStatementMapper;
public static RevenueTypeMappingMapper revenueTypeMappingMapper;
public static InvoiceRecordMapper invoiceRecordMapper;
public static CertifiedInvoicesListMapper certifiedInvoicesListMapper;
......@@ -146,7 +146,7 @@ public class SpringContextUtil implements ApplicationContextAware {
balanceSheetMapper = webApplicationContext.getBean(BalanceSheetMapper.class);
revenueTypeMappingMapper = webApplicationContext.getBean(RevenueTypeMappingMapper.class);
invoiceRecordMapper = webApplicationContext.getBean(InvoiceRecordMapper.class);
certifiedInvoicesListMapper = webApplicationContext.getBean(CertifiedInvoicesListMapper.class);
/* map.put("balance_sheet", balanceMapper);
map.put("profit_loss_statement",profitLossStatementMapper);
map.put("cash_flow", cashFlowMapper);
......
......@@ -156,4 +156,6 @@ public final class Constant {
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 {
}
return analysisServiceImpl.importDomesitcExcelFile(file,period, type);
} catch (ServiceException e) {
return OperationResultDto.error(e.getMessage());
String message = e.getMessage();
String[] split = message.split(":");
return OperationResultDto.error(split[1]);
} catch (Exception e) {
logger.error("importDomesitcExcelFile error.", e);
return OperationResultDto.error(ErrorMessage.SystemError);
......
......@@ -10,10 +10,7 @@ import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.FileDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.PeriodReportDto;
import pwc.taxtech.atms.dto.ReportAttachDto;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.entity.Project;
......@@ -88,14 +85,14 @@ public class ReportController {
private static OperationResultDto<ReportDataDto> operationResultDto = null;
@RequestMapping(value = "reportEbitData", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<ReportDataDto> reportEbitData(Long reportId, String orgId, Integer period) {
OperationResultDto resultDto = new OperationResultDto();
if (reportId == null || reportId == 0L) {
@RequestMapping(value = "reportEbitData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<ReportDataDto> reportEbitData(@RequestBody RequestParameterDto requestParameterDto) {
/*OperationResultDto resultDto = new OperationResultDto();
*//* if (requestParameterDto.getProjectId() == null || requestParameterDto.getReportId() == null) {
resultDto.setResult(false);
return resultDto;
}
operationResultDto = reportService.getCellData(reportId, orgId, period);
}*/
operationResultDto = reportService.getCellData(Long.parseLong(requestParameterDto.getReportId()), requestParameterDto.getOrgId(),requestParameterDto.getPeriod());
return operationResultDto;
}
......@@ -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)
public OperationResultDto<PeriodCellTemplateConfig> getCellTemplateConfig(@PathVariable Long reportTemplateId,
......@@ -226,7 +216,6 @@ public class ReportController {
@RequestMapping("loadAttachList")
public List<PwcReportAttach> loadAttachList(@RequestBody ReportAttachDto reportAttachDto) {
System.out.println("sdsdfsd");
return reportService.loadAttachList(reportAttachDto);
}
......@@ -246,4 +235,27 @@ public class ReportController {
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 {
@ResponseBody
@RequestMapping(value = "ebitTemplateImport", method = RequestMethod.POST)
public OperationResultDto ebitTemplateImport(@RequestParam MultipartFile file,
@RequestParam String orgId,
@RequestParam Integer period) {
public OperationResultDto ebitTemplateImport(@RequestParam("file") MultipartFile file,
@RequestParam("orgId") String orgId,
@RequestParam("period") Integer period) {
try {
templateGroupService.ebitTemplateImport(file, orgId,period);
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 + '\'' +
'}';
}
}
......@@ -13,18 +13,21 @@ import java.util.Map;
public class TableRule {
public static Map<String, String> map = new HashMap<String, String>();
static {
map.put("EBSZCFZB", "balance_sheet");
map.put("EBSLRB", "profit_loss_statement");
map.put("EBSZCFZB", "balance_sheet_prc");
map.put("EBSLRB", "profit_loss_statement_prc");
map.put("EBSXJLLB", "cash_flow");
map.put("RGDRZCFZB", "balance_sheet_manual");
map.put("RGDRLRB", "profit_loss_statement_manual");
map.put("RGDRZCFZB", "balance_sheet_prc_manual");
map.put("RGDRLRB", "profit_loss_statement_prc_manual");
map.put("RGDRXJLLB", "cash_flow_manual");
map.put("HZXXB", "red_letter_info_table");
map.put("ZXZCFZB", "balance_sheet_final");
map.put("ZXLLB", "profit_loss_statement_final");
map.put("ZXXJLLB", "cash_flow_final");
map.put("HZXXB", "red_letter_info_table");
map.put("CITZCFZB", "cit_balance_sheet_prc_adjust");
map.put("CITLRB", "cit_profit_prc_adjust");
map.put("CIT_TBAM", "cit_tbam");
......
......@@ -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 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 IMPORT_TEMPLATE_HEADER_ERROR = new FormulaException("导入模板不匹配");
}
......@@ -27,6 +27,7 @@ import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateGroupDto;
import pwc.taxtech.atms.entity.*;
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.entity.*;
......@@ -63,6 +64,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
@Autowired
private DidiFileUploadService didiFileUploadService;
@Autowired
protected DistributedIdService idService;
public List<TemplateGroupDto> get() {
List<TemplateGroup> templateGroups = templateGroupMapper.selectByExample(new TemplateGroupExample());
List<TemplateGroupDto> templateGroupDtos = new ArrayList<>();
......@@ -196,7 +200,10 @@ public class TemplateGroupServiceImpl extends AbstractService {
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;
Date now = new Date();
String projectId = getProjId(orgId, period);
......@@ -216,29 +223,39 @@ public class TemplateGroupServiceImpl extends AbstractService {
if (period == null) {
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 m = 1; j < sheet.getLastRowNum(); j++) {
if (j == 2 || j == 3) {
if (j == 1 || j == 2) {
EbitCellData ebitCellData = new EbitCellData();
ebitCellData.setId(idService.nextId());
ebitCellData.setCol(j);
ebitCellData.setRow(m);
ebitCellData.setCreateTime(now);
ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue());
ebitCellData.setTemplateId(PROTABLEID);
ebitCellData.setProjectId(projectId);
ebitCellData.setOrganizationId(orgId);
ebitCellData.setPeriod(period);
list.add(ebitCellData);
}
}
}
ebitCellDataMapper.insertBatch(list);
}
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidFormatException e) {
} catch (Exception e) {
e.printStackTrace();
operationResultDto.setResult(false);
}
operationResultDto.setResult(true);
return operationResultDto;
}
public class TemplateGroupMessage {
......
......@@ -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;
}
}
}
}
......@@ -6,12 +6,9 @@ import org.springframework.stereotype.Service;
import pwc.taxtech.atms.invoice.InputInvoiceMapper;
import pwc.taxtech.atms.vat.entity.InputInvoice;
import pwc.taxtech.atms.vat.entity.InputInvoiceExample;
import pwc.taxtech.atms.vat.entity.InputVatInvoice;
import pwc.taxtech.atms.vat.entity.InputVatInvoiceExample;
import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class InputInvoiceDao {
......@@ -25,16 +22,19 @@ public class InputInvoiceDao {
if (period != null) {
Calendar date = Calendar.getInstance();
String year = String.valueOf(date.get(Calendar.YEAR));
//认证期间
criteria.andRZSQEqualTo(year + (period > 9 ? period.toString() : "0" + period.toString()));
}
if (invoiceType != null) {
//发票类型
criteria.andFPLXEqualTo(String.valueOf(invoiceType));
// criteria1.andFPLXEqualTo(String.valueOf(invoiceType));
}
if (StringUtils.isNotBlank(notPass)) {
String unPass = "2";
//认证结果
criteria.andRZJGEqualTo(unPass);
// criteria1.andRZJGEqualTo(unPass);
} else if (StringUtils.isNotBlank(checkPass) && StringUtils.isNotBlank(scanPass)) {
......@@ -43,6 +43,7 @@ public class InputInvoiceDao {
// criteria1.andRZJGEqualTo(pass);
// example.or(criteria1);
}
//发票状态
criteria.andFPZTNotEqualTo("1"); // 过滤作废状态
// List<InputInvoice> list = inputInvoiceMapper.selectByExample(example).stream().filter(x -> {
......
......@@ -4,24 +4,19 @@ import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.EnumOperationType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.dto.vatdto.InputInvoiceDataSourceDto;
import pwc.taxtech.atms.vat.entity.InputInvoice;
import pwc.taxtech.atms.vat.entity.CertifiedInvoicesList;
import pwc.taxtech.atms.vat.entity.CertifiedInvoicesListExample;
import java.math.BigDecimal;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/// <summary>
......@@ -84,24 +79,24 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
calendar.add(Calendar.YEAR, 1);
Date endDate = calendar.getTime();
List<InputInvoice> inputInvoices;
List<CertifiedInvoicesList> inputInvoices;
if (authenticationType == 1 && formulaContext.getIsYear()) {
inputInvoices = SpringContextUtil.inputInvoiceDao.getInputInvoice(null, invoiceType,
inputInvoices = getInvoice(null, invoiceType,
Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass,
null);
} else if (authenticationType == 1) {
inputInvoices = SpringContextUtil.inputInvoiceDao.getInputInvoice(period, invoiceType,
inputInvoices =getInvoice(period, invoiceType,
Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass,
null);
}
// 认证未通过与未认证暂认为是同一个意思
else if (authenticationType == 2 && formulaContext.getIsYear()) {
inputInvoices = SpringContextUtil.inputInvoiceDao.getInputInvoice(null, invoiceType,
inputInvoices = getInvoice(null, invoiceType,
null, null, Constant.InputInvoiceCertificationResult.NotPass);
}
// 认证未通过与未认证暂认为是同一个意思
else if (authenticationType == 0 || authenticationType == 2) {
inputInvoices = SpringContextUtil.inputInvoiceDao.getInputInvoice(period, invoiceType, null,
inputInvoices =getInvoice(period, invoiceType, null,
null, Constant.InputInvoiceCertificationResult.NotPass);
} else {
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L, formulaContext.getProjectId());
......@@ -118,7 +113,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
endDate = calendar.getTime();
Date finalEndDate = endDate;
inputInvoices = inputInvoices.stream()
.filter(a -> DateUtils.strToDate(a.getRZSJ()).before(finalEndDate))
.filter(a -> a.getCertifiedDate().before(finalEndDate))
.collect(Collectors.toList());
} else if (certificationPeriod != 99) {
calendar.set(formulaContext.getYear(), certificationPeriod - 1, 1);
......@@ -129,26 +124,26 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
Date finalEndDate1 = endDate;
Date finalStartDate = startDate;
inputInvoices = inputInvoices.stream()
.filter(a -> strToDate(a.getRZSQ()).after(finalStartDate)
&& strToDate(a.getRZSQ()).before(finalEndDate1))
.filter(a -> a.getCertifiedDate().after(finalStartDate)
&& a.getCertifiedDate().before(finalEndDate1))
.collect(Collectors.toList());
}
}
List<InputInvoiceDataSourceDto> dataSource = new ArrayList<>();
for (InputInvoice x : inputInvoices) {
for (CertifiedInvoicesList x : inputInvoices) {
InputInvoiceDataSourceDto inputInvoiceDataSourceDto = new InputInvoiceDataSourceDto();
inputInvoiceDataSourceDto.setAmount(FormulaHelper.roundValue(new BigDecimal(x.getHJJE()), KeyValueConfigResultType.Accounting,
inputInvoiceDataSourceDto.setAmount(FormulaHelper.roundValue(x.getAmount(), KeyValueConfigResultType.Accounting,
null, formulaContext));
inputInvoiceDataSourceDto.setResultType(KeyValueConfigResultType.Accounting.getCode());
inputInvoiceDataSourceDto.setTaxAmount(FormulaHelper.roundValue(new BigDecimal(x.getHJSE()), KeyValueConfigResultType.Accounting,
inputInvoiceDataSourceDto.setTaxAmount(FormulaHelper.roundValue(x.getTaxAmount(), KeyValueConfigResultType.Accounting,
null, formulaContext));
inputInvoiceDataSourceDto.setCertificationDate(DateUtils.strToDate(x.getRZSJ()));
inputInvoiceDataSourceDto.setInvoiceCode(x.getFPDM());
inputInvoiceDataSourceDto.setInvoiceNumber(x.getFPHM());
inputInvoiceDataSourceDto.setInvoiceType(Integer.parseInt(x.getFPLX()));
inputInvoiceDataSourceDto.setCertificationDate(x.getCertifiedDate());
inputInvoiceDataSourceDto.setInvoiceCode(x.getInvoiceCode());
inputInvoiceDataSourceDto.setInvoiceNumber(x.getInvoiceNum());
inputInvoiceDataSourceDto.setInvoiceType(Integer.parseInt(x.getInvoiceType()));
inputInvoiceDataSourceDto.setPeriod(period);
inputInvoiceDataSourceDto.setSellerTaxNumber(x.getXFSH());
inputInvoiceDataSourceDto.setSellerTaxNumber(x.getSalesTaxNum());
inputInvoiceDataSourceDto.setName(Constant.DataSourceName.InputDetailInvoiceDataSource);
inputInvoiceDataSourceDto.setOperationType(EnumOperationType.Single.getCode());
dataSource.add(inputInvoiceDataSourceDto);
......@@ -199,4 +194,40 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
return strtodate;
}
public List<CertifiedInvoicesList> getInvoice(Integer period, String invoiceType, String checkPass, String scanPass, String notPass) {
CertifiedInvoicesListExample example = new CertifiedInvoicesListExample();
CertifiedInvoicesListExample.Criteria criteria = example.createCriteria();
if (period != null) {
Calendar date = Calendar.getInstance();
String year = String.valueOf(date.get(Calendar.YEAR));
//认证期间
criteria.andPeriodEqualTo(Integer.valueOf(year + (period > 9 ? period.toString() : "0" + period.toString())));
}
if (invoiceType != null) {
//发票类型
criteria.andInvoiceTypeEqualTo(String.valueOf(invoiceType));
// criteria1.andFPLXEqualTo(String.valueOf(invoiceType));
}
// if (StringUtils.isNotBlank(notPass)) {
// String unPass = "2";
// //认证结果
// criteria.andRZJGEqualTo(unPass);
//// criteria1.andRZJGEqualTo(unPass);
// } else if (StringUtils.isNotBlank(checkPass) && StringUtils.isNotBlank(scanPass)) {
// String pass = "1";
// criteria.andRZJGEqualTo(pass);
//// criteria1.andRZJGEqualTo(pass);
//// example.or(criteria1);
// }
//发票状态
criteria.andInvoiceTypeEqualTo("1"); // 过滤作废状态
// List<InputInvoice> list = inputInvoiceMapper.selectByExample(example).stream().filter(x -> {
// return x.getRZSQ().endsWith("-" + (period.intValue() > 9 ? period.toString() : "0" + period.toString()));
// }).collect(Collectors.toList());
return SpringContextUtil.certifiedInvoicesListMapper.selectByExample(example);
}
}
......@@ -40,10 +40,10 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java">
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator>
<table tableName="ebit_cell_data" domainObjectName="EbitCellData">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<!--<table tableName="ebit_cell_data" domainObjectName="EbitCellData">-->
<!--<property name="useActualColumnNames" value="false"/>-->
<!--<property name="ignoreQualifiersAtRuntime" value="true"/>-->
<!--</table>-->
<!--
......@@ -546,14 +546,14 @@
<table tableName="period_cell_comment" domainObjectName="PeriodCellComment">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
</table>-->
<table tableName="period_cell_data" domainObjectName="PeriodCellData">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="period_cell_data_source" domainObjectName="PeriodCellDataSource">
<!--<table tableName="period_cell_data_source" domainObjectName="PeriodCellDataSource">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
......
......@@ -7,6 +7,7 @@ import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.EbitCellData;
import pwc.taxtech.atms.vat.entity.EbitCellDataExample;
import pwc.taxtech.atms.vat.entity.ProfitLossStatement;
@Mapper
public interface EbitCellDataMapper extends MyVatMapper {
......@@ -105,4 +106,7 @@ public interface EbitCellDataMapper extends MyVatMapper {
* @mbg.generated
*/
int updateByPrimaryKey(EbitCellData record);
int insertBatch(List<EbitCellData> pls);
}
\ No newline at end of file
......@@ -121,4 +121,9 @@ public interface TrialBalanceFinalMapper extends MyVatMapper {
@Param("projectId") String projectId,
@Param("period") Integer period,
@Param("queryDate") String queryDate);
int generateFinalData(@Param("projectId") String projectId,
@Param("period") Integer period,
@Param("lastProjectId") String lastProjectId,
@Param("lastPeriod") Integer lastPeriod);
}
\ No newline at end of file
package pwc.taxtech.atms.vat.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable;
import java.util.Date;
......@@ -10,7 +12,7 @@ import java.util.Date;
*
* @mbg.generated do_not_delete_during_merge
*/
public class PeriodCellData implements Serializable {
public class PeriodCellData extends BaseEntity implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
......@@ -119,6 +121,24 @@ public class PeriodCellData implements Serializable {
*/
private String keyinData;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column period_cell_data.validate_formula_exp
*
* @mbg.generated
*/
private String validateFormulaExp;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column period_cell_data.validate_result
*
* @mbg.generated
*/
private String validateResult;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table period_cell_data
......@@ -415,6 +435,54 @@ public class PeriodCellData implements Serializable {
this.keyinData = keyinData == null ? null : keyinData.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column period_cell_data.validate_formula_exp
*
* @return the value of period_cell_data.validate_formula_exp
*
* @mbg.generated
*/
public String getValidateFormulaExp() {
return validateFormulaExp;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column period_cell_data.validate_formula_exp
*
* @param validateFormulaExp the value for period_cell_data.validate_formula_exp
*
* @mbg.generated
*/
public void setValidateFormulaExp(String validateFormulaExp) {
this.validateFormulaExp = validateFormulaExp == null ? null : validateFormulaExp.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column period_cell_data.validate_result
*
* @return the value of period_cell_data.validate_result
*
* @mbg.generated
*/
public String getValidateResult() {
return validateResult;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column period_cell_data.validate_result
*
* @param validateResult the value for period_cell_data.validate_result
*
* @mbg.generated
*/
public void setValidateResult(String validateResult) {
this.validateResult = validateResult == null ? null : validateResult.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table period_cell_data
......@@ -439,6 +507,8 @@ public class PeriodCellData implements Serializable {
sb.append(", projectId=").append(projectId);
sb.append(", period=").append(period);
sb.append(", keyinData=").append(keyinData);
sb.append(", validateFormulaExp=").append(validateFormulaExp);
sb.append(", validateResult=").append(validateResult);
sb.append("]");
return sb.toString();
}
......
......@@ -974,6 +974,146 @@ public class PeriodCellDataExample {
addCriterion("keyin_data not between", value1, value2, "keyinData");
return (Criteria) this;
}
public Criteria andValidateFormulaExpIsNull() {
addCriterion("validate_formula_exp is null");
return (Criteria) this;
}
public Criteria andValidateFormulaExpIsNotNull() {
addCriterion("validate_formula_exp is not null");
return (Criteria) this;
}
public Criteria andValidateFormulaExpEqualTo(String value) {
addCriterion("validate_formula_exp =", value, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpNotEqualTo(String value) {
addCriterion("validate_formula_exp <>", value, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpGreaterThan(String value) {
addCriterion("validate_formula_exp >", value, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpGreaterThanOrEqualTo(String value) {
addCriterion("validate_formula_exp >=", value, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpLessThan(String value) {
addCriterion("validate_formula_exp <", value, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpLessThanOrEqualTo(String value) {
addCriterion("validate_formula_exp <=", value, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpLike(String value) {
addCriterion("validate_formula_exp like", value, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpNotLike(String value) {
addCriterion("validate_formula_exp not like", value, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpIn(List<String> values) {
addCriterion("validate_formula_exp in", values, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpNotIn(List<String> values) {
addCriterion("validate_formula_exp not in", values, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpBetween(String value1, String value2) {
addCriterion("validate_formula_exp between", value1, value2, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateFormulaExpNotBetween(String value1, String value2) {
addCriterion("validate_formula_exp not between", value1, value2, "validateFormulaExp");
return (Criteria) this;
}
public Criteria andValidateResultIsNull() {
addCriterion("validate_result is null");
return (Criteria) this;
}
public Criteria andValidateResultIsNotNull() {
addCriterion("validate_result is not null");
return (Criteria) this;
}
public Criteria andValidateResultEqualTo(String value) {
addCriterion("validate_result =", value, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultNotEqualTo(String value) {
addCriterion("validate_result <>", value, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultGreaterThan(String value) {
addCriterion("validate_result >", value, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultGreaterThanOrEqualTo(String value) {
addCriterion("validate_result >=", value, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultLessThan(String value) {
addCriterion("validate_result <", value, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultLessThanOrEqualTo(String value) {
addCriterion("validate_result <=", value, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultLike(String value) {
addCriterion("validate_result like", value, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultNotLike(String value) {
addCriterion("validate_result not like", value, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultIn(List<String> values) {
addCriterion("validate_result in", values, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultNotIn(List<String> values) {
addCriterion("validate_result not in", values, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultBetween(String value1, String value2) {
addCriterion("validate_result between", value1, value2, "validateResult");
return (Criteria) this;
}
public Criteria andValidateResultNotBetween(String value1, String value2) {
addCriterion("validate_result not between", value1, value2, "validateResult");
return (Criteria) this;
}
}
/**
......
......@@ -18,6 +18,8 @@
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="period" jdbcType="INTEGER" property="period" />
<result column="keyin_data" jdbcType="VARCHAR" property="keyinData" />
<result column="validate_formula_exp" jdbcType="VARCHAR" property="validateFormulaExp" />
<result column="validate_result" jdbcType="VARCHAR" property="validateResult" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -91,7 +93,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, report_id, cell_template_id, `data`, formula_exp, create_by, create_time, update_by,
update_time, project_id, period, keyin_data
update_time, project_id, period, keyin_data, validate_formula_exp, validate_result
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellDataExample" resultMap="BaseResultMap">
<!--
......@@ -147,13 +149,13 @@
insert into period_cell_data (id, report_id, cell_template_id,
`data`, formula_exp, create_by,
create_time, update_by, update_time,
project_id, period, keyin_data
)
project_id, period, keyin_data,
validate_formula_exp, validate_result)
values (#{id,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT}, #{cellTemplateId,jdbcType=BIGINT},
#{data,jdbcType=VARCHAR}, #{formulaExp,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{projectId,jdbcType=VARCHAR}, #{period,jdbcType=INTEGER}, #{keyinData,jdbcType=VARCHAR}
)
#{projectId,jdbcType=VARCHAR}, #{period,jdbcType=INTEGER}, #{keyinData,jdbcType=VARCHAR},
#{validateFormulaExp,jdbcType=VARCHAR}, #{validateResult,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellData">
<!--
......@@ -198,6 +200,12 @@
<if test="keyinData != null">
keyin_data,
</if>
<if test="validateFormulaExp != null">
validate_formula_exp,
</if>
<if test="validateResult != null">
validate_result,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -236,6 +244,12 @@
<if test="keyinData != null">
#{keyinData,jdbcType=VARCHAR},
</if>
<if test="validateFormulaExp != null">
#{validateFormulaExp,jdbcType=VARCHAR},
</if>
<if test="validateResult != null">
#{validateResult,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellDataExample" resultType="java.lang.Long">
......@@ -291,6 +305,12 @@
<if test="record.keyinData != null">
keyin_data = #{record.keyinData,jdbcType=VARCHAR},
</if>
<if test="record.validateFormulaExp != null">
validate_formula_exp = #{record.validateFormulaExp,jdbcType=VARCHAR},
</if>
<if test="record.validateResult != null">
validate_result = #{record.validateResult,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -313,7 +333,9 @@
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
project_id = #{record.projectId,jdbcType=VARCHAR},
period = #{record.period,jdbcType=INTEGER},
keyin_data = #{record.keyinData,jdbcType=VARCHAR}
keyin_data = #{record.keyinData,jdbcType=VARCHAR},
validate_formula_exp = #{record.validateFormulaExp,jdbcType=VARCHAR},
validate_result = #{record.validateResult,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -358,6 +380,12 @@
<if test="keyinData != null">
keyin_data = #{keyinData,jdbcType=VARCHAR},
</if>
<if test="validateFormulaExp != null">
validate_formula_exp = #{validateFormulaExp,jdbcType=VARCHAR},
</if>
<if test="validateResult != null">
validate_result = #{validateResult,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -377,7 +405,9 @@
update_time = #{updateTime,jdbcType=TIMESTAMP},
project_id = #{projectId,jdbcType=VARCHAR},
period = #{period,jdbcType=INTEGER},
keyin_data = #{keyinData,jdbcType=VARCHAR}
keyin_data = #{keyinData,jdbcType=VARCHAR},
validate_formula_exp = #{validateFormulaExp,jdbcType=VARCHAR},
validate_result = #{validateResult,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellDataExample" resultMap="BaseResultMap">
......
<?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
......@@ -74,5 +74,125 @@
order by detail.emptyCode
</select>
<insert id="generateFinalData" >
insert
into trial_balance_final
select balance.id,
balance.organization_id,
balance.project_id,
balance.date,
balance.source,
balance.tms_period,
balance.period,
balance.ledger_id,
balance.ledger_name,
balance.currency_code,
balance.status,
balance.category,
balance.account_category,
balance.acct_code1,
balance.acct_name1,
balance.acct_name2,
balance.acct_name3,
balance.segment1,
balance.segment2,
balance.segment3,
balance.segment4,
balance.segment5,
balance.segment6,
balance.segment7,
balance.segment8,
balance.segment9,
balance.segment10,
balance.segment1_name,
balance.segment2_name,
balance.segment3_name,
balance.segment4_name,
balance.segment5_name,
balance.segment6_name,
balance.segment7_name,
balance.segment8_name,
balance.segment9_name,
balance.segment10_name,
balance.beg_bal,
balance.period_dr,
balance.period_cr,
balance.end_bal,
balance.qtd_dr,
balance.qtd_cr,
balance.ytd_dr,
balance.ytd_cr,
balance.beg_bal_beq,
balance.period_dr_beq + if(adjustment.period_dr_beq is null, 0, adjustment.period_dr_beq) -
if(last_adjustment.period_dr_beq is null, 0, last_adjustment.period_dr_beq),
balance.period_cr_beq + if(adjustment.period_cr_beq is null, 0, adjustment.period_cr_beq) -
if(last_adjustment.period_cr_beq is null, 0, last_adjustment.period_cr_beq),
balance.end_bal_beq + if(adjustment.end_bal_beq is null, 0, adjustment.end_bal_beq) -
if(last_adjustment.end_bal_beq is null, 0, last_adjustment.end_bal_beq),
balance.qtd_dr_beq,
balance.qtd_cr_beq,
balance.ytd_dr_beq,
balance.ytd_cr_beq,
sysdate(),
sysdate()
from trial_balance balance
left join
adjustment_table adjustment
on
balance.project_id = adjustment.project_id
and
balance.period = adjustment.period
and
balance.segment1 = adjustment.segment1
and
balance.segment2 = adjustment.segment2
and
balance.segment3 = adjustment.segment3
and
balance.segment4 = adjustment.segment4
and
balance.segment5 = adjustment.segment5
and
balance.segment6 = adjustment.segment6
and
balance.segment7 = adjustment.segment7
and
balance.segment8 = adjustment.segment8
and
balance.segment9 = adjustment.segment9
and
balance.segment10 = adjustment.segment10
left join
(
select *
from adjustment_table
where project_id = #{lastProjectId}
and period = #{lastPeriod}
) last_adjustment
on
balance.segment1 = last_adjustment.segment1
and
balance.segment2 = last_adjustment.segment2
and
balance.segment3 = last_adjustment.segment3
and
balance.segment4 = last_adjustment.segment4
and
balance.segment5 = last_adjustment.segment5
and
balance.segment6 = last_adjustment.segment6
and
balance.segment7 = last_adjustment.segment7
and
balance.segment8 = last_adjustment.segment8
and
balance.segment9 = last_adjustment.segment9
and
balance.segment10 = last_adjustment.segment10
where balance.project_id = #{projectId}
and balance.period = #{period}
</insert>
</mapper>
\ No newline at end of file
......@@ -38,7 +38,7 @@
});
scope.$watchGroup(['reportSource', 'formulaBlocks', 'manualDataSources', 'templateId'], function (newVal, oldValue) {
if (scope.templateId && scope.reportSource && scope.hasLoadSpread) {
if (scope.templateId && scope.reportSource) {
setData();
}
});
......@@ -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){
setData("true")
loadSheet(scope.templateId, true)
}
});
var loadSheet = function (templateId, init) {
......@@ -177,10 +177,19 @@
}
spread.resumePaint();
scope.spread = spread;
if (scope.templateId && scope.reportSource && scope.hasLoadSpread) {
setData("false");
if (scope.templateId && scope.reportSource ) {
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);
};
......@@ -346,6 +355,7 @@
// Get spreadJS control.
var getSpreadControl = function () {
scope.relation.sheetArea = GC.Spread.Sheets.SheetArea;
return new GC.Spread.Sheets.Workbook(getSpreadControlElement());
};
......@@ -525,30 +535,27 @@
var loadEbitCell = function(sheet, type){
for( var r = 37; r<= 43; r++ ){
for(var c = 1; c<=3; c++){
if( c == 1){
sheet.setValue(r,c, profileList[r-37]);
}
if(c == 3 && type){
if(r == 37){
sheet.setValue(r, c,scope.relation.data.ebitSubtraction);
sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.ebitSubtraction));
}
if(r == 38){
sheet.setValue(r, c,scope.relation.data.specialConsiderations );
sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.specialConsiderations));
}
if(r == 39){
sheet.setValue(r, c,scope.relation.data.specialFactors);
sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.specialFactors));
}
if(r == 40){
sheet.setValue(r, c,scope.relation.data.ebitRate);
sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.ebitRate));
}
if(r == 41){
sheet.setValue(r, c,scope.relation.data.transactionAmount);
sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.transactionAmount));
}
if(r == 42){
sheet.setValue(r, c,scope.relation.data.sixAddTax);
sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.sixAddTa));
}
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 @@
BSPLService.getReportData();
};
var getReportData = function (cb) {
vatReportService.getReportEbitData($scope.reportId, $scope.relation.orgId, $scope.relation.period ).success(function (reportData) {
var getReportData = function (cb, period) {
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) {
_.each(reportData.data.cellData, function (x) {
x.value = x.cellValue;
......@@ -1110,14 +1110,17 @@
$scope.formulaBlocks = reportData.data.formulaBlocks;
$scope.manualDataSources = reportData.data.manualDataSources;
$scope.relation.data = reportData.data.ebitData;
cb();
if(cb)
cb();
} else {
$scope.reportData = [];
$scope.formulaBlocks = [];
$scope.manualDataSources = [];
$scope.relation.data = reportData.data.ebitData;
if(cb)
cb();
}
});
};
var loadCellData = function (period, orgId,cb) {
......@@ -1127,7 +1130,7 @@
vatReportService.getReportByTemplateIdEbit($scope.templateId, period, orgId).success(function (report) {
if (report.result) {
$scope.reportId = report.data.id;
getReportData(cb);
getReportData(cb, period);
} else if (!(report.result && report.data)) {
$scope.reportData = [];
$scope.formulaBlocks = [];
......@@ -2849,7 +2852,6 @@
});
},
onInitialized: function (e) {
debugger;
$scope.dataSourceIndustryListInstance = e.component;
}
}
......@@ -2923,7 +2925,6 @@
$scope.relation.data = res.data;
}
}).error(function(error){
deferred.reject(error);
});
}
......@@ -2931,29 +2932,90 @@
$scope.upload($scope.file);
});
//上传模板
//Upload.setDefaults( {ngf-keep:false ngf-accept:'image/*', ...} );
$scope.upload = function (file) {
var _file = $scope.importExcelFile;
if(file == null)
return
frontImport(_file);
var token = $('input[name="__RequestVerificationToken"]').val();
var url = apiInterceptor.webApiHostUrl + '/templateGroup/ebitTemplateImport';
var url = apiInterceptor.vatWebApiHostUrl + '/templateGroup/ebitTemplateImport';
Upload.upload(
{
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: {
'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()
},
__RequestVerificationToken: token,
},
__RequestVerificationToken: token,
withCredentials: true
})
.progress(function (evt) {
})
.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) {
SweetAlert.error(status + '错误' + ",上传失败")
})
};
//前端导入
var frontImport = function(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 -------------------------------------------
(function initialize() {
......
......@@ -22,19 +22,18 @@
</div>
</div>
<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"
ngf-validate="{size: {min:'10KB', max:'20MB'}}"><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span>
<span ngf-select="" type="file" ng-model="importExcelFile" ngf-change="upload($files)" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" ><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="singleExport();"><i
<span ng-click="singleExport()"><i
class="fa fa-upload"></i>&nbsp;{{'singleExport' | translate}}</span>
<span ng-click="manyExport()"><i
class="fa fa-cloud-upload"></i>&nbsp;{{'manyExport' | translate}}</span>
</div>
</div>
<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'
relation="relation">
</table-report-sheet>
......
......@@ -61,8 +61,18 @@
return $http.get('/Report/reportData/' + reportId, apiConfig.createVat());
},
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) {
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