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 { ...@@ -73,8 +73,12 @@ public class POIUtil {
if (null != cell.getCellComment()) { if (null != cell.getCellComment()) {
targetCell.setCellComment(cell.getCellComment()); targetCell.setCellComment(cell.getCellComment());
} }
if (null != cell.getCellStyle()) { if (null != cell.getCellStyle() && targetCell.getCellStyle() != null ) {
try{
targetCell.getCellStyle().cloneStyleFrom(cell.getCellStyle()); targetCell.getCellStyle().cloneStyleFrom(cell.getCellStyle());
}catch (Exception e){
//e.printStackTrace();
}
} }
if (null != cell.getHyperlink()) { if (null != cell.getHyperlink()) {
targetCell.setHyperlink(cell.getHyperlink()); targetCell.setHyperlink(cell.getHyperlink());
......
...@@ -61,7 +61,7 @@ public class SpringContextUtil implements ApplicationContextAware { ...@@ -61,7 +61,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public static ProfitLossStatementMapper profitLossStatementMapper; public static ProfitLossStatementMapper profitLossStatementMapper;
public static RevenueTypeMappingMapper revenueTypeMappingMapper; public static RevenueTypeMappingMapper revenueTypeMappingMapper;
public static InvoiceRecordMapper invoiceRecordMapper; public static InvoiceRecordMapper invoiceRecordMapper;
public static CertifiedInvoicesListMapper certifiedInvoicesListMapper;
...@@ -146,7 +146,7 @@ public class SpringContextUtil implements ApplicationContextAware { ...@@ -146,7 +146,7 @@ public class SpringContextUtil implements ApplicationContextAware {
balanceSheetMapper = webApplicationContext.getBean(BalanceSheetMapper.class); balanceSheetMapper = webApplicationContext.getBean(BalanceSheetMapper.class);
revenueTypeMappingMapper = webApplicationContext.getBean(RevenueTypeMappingMapper.class); revenueTypeMappingMapper = webApplicationContext.getBean(RevenueTypeMappingMapper.class);
invoiceRecordMapper = webApplicationContext.getBean(InvoiceRecordMapper.class); invoiceRecordMapper = webApplicationContext.getBean(InvoiceRecordMapper.class);
certifiedInvoicesListMapper = webApplicationContext.getBean(CertifiedInvoicesListMapper.class);
/* map.put("balance_sheet", balanceMapper); /* map.put("balance_sheet", balanceMapper);
map.put("profit_loss_statement",profitLossStatementMapper); map.put("profit_loss_statement",profitLossStatementMapper);
map.put("cash_flow", cashFlowMapper); map.put("cash_flow", cashFlowMapper);
......
...@@ -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 + '\'' +
'}';
}
}
...@@ -13,18 +13,21 @@ import java.util.Map; ...@@ -13,18 +13,21 @@ import java.util.Map;
public class TableRule { public class TableRule {
public static Map<String, String> map = new HashMap<String, String>(); public static Map<String, String> map = new HashMap<String, String>();
static { static {
map.put("EBSZCFZB", "balance_sheet"); map.put("EBSZCFZB", "balance_sheet_prc");
map.put("EBSLRB", "profit_loss_statement"); map.put("EBSLRB", "profit_loss_statement_prc");
map.put("EBSXJLLB", "cash_flow"); map.put("EBSXJLLB", "cash_flow");
map.put("RGDRZCFZB", "balance_sheet_manual"); map.put("RGDRZCFZB", "balance_sheet_prc_manual");
map.put("RGDRLRB", "profit_loss_statement_manual"); map.put("RGDRLRB", "profit_loss_statement_prc_manual");
map.put("RGDRXJLLB", "cash_flow_manual"); map.put("RGDRXJLLB", "cash_flow_manual");
map.put("HZXXB", "red_letter_info_table");
map.put("ZXZCFZB", "balance_sheet_final"); map.put("ZXZCFZB", "balance_sheet_final");
map.put("ZXLLB", "profit_loss_statement_final"); map.put("ZXLLB", "profit_loss_statement_final");
map.put("ZXXJLLB", "cash_flow_final"); map.put("ZXXJLLB", "cash_flow_final");
map.put("HZXXB", "red_letter_info_table");
map.put("CITZCFZB", "cit_balance_sheet_prc_adjust"); map.put("CITZCFZB", "cit_balance_sheet_prc_adjust");
map.put("CITLRB", "cit_profit_prc_adjust"); map.put("CITLRB", "cit_profit_prc_adjust");
map.put("CIT_TBAM", "cit_tbam"); map.put("CIT_TBAM", "cit_tbam");
......
...@@ -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;
}
}
}
} }
...@@ -6,12 +6,9 @@ import org.springframework.stereotype.Service; ...@@ -6,12 +6,9 @@ import org.springframework.stereotype.Service;
import pwc.taxtech.atms.invoice.InputInvoiceMapper; import pwc.taxtech.atms.invoice.InputInvoiceMapper;
import pwc.taxtech.atms.vat.entity.InputInvoice; import pwc.taxtech.atms.vat.entity.InputInvoice;
import pwc.taxtech.atms.vat.entity.InputInvoiceExample; 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.Calendar;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class InputInvoiceDao { public class InputInvoiceDao {
...@@ -25,16 +22,19 @@ public class InputInvoiceDao { ...@@ -25,16 +22,19 @@ public class InputInvoiceDao {
if (period != null) { if (period != null) {
Calendar date = Calendar.getInstance(); Calendar date = Calendar.getInstance();
String year = String.valueOf(date.get(Calendar.YEAR)); String year = String.valueOf(date.get(Calendar.YEAR));
//认证期间
criteria.andRZSQEqualTo(year + (period > 9 ? period.toString() : "0" + period.toString())); criteria.andRZSQEqualTo(year + (period > 9 ? period.toString() : "0" + period.toString()));
} }
if (invoiceType != null) { if (invoiceType != null) {
//发票类型
criteria.andFPLXEqualTo(String.valueOf(invoiceType)); criteria.andFPLXEqualTo(String.valueOf(invoiceType));
// criteria1.andFPLXEqualTo(String.valueOf(invoiceType)); // criteria1.andFPLXEqualTo(String.valueOf(invoiceType));
} }
if (StringUtils.isNotBlank(notPass)) { if (StringUtils.isNotBlank(notPass)) {
String unPass = "2"; String unPass = "2";
//认证结果
criteria.andRZJGEqualTo(unPass); criteria.andRZJGEqualTo(unPass);
// criteria1.andRZJGEqualTo(unPass); // criteria1.andRZJGEqualTo(unPass);
} else if (StringUtils.isNotBlank(checkPass) && StringUtils.isNotBlank(scanPass)) { } else if (StringUtils.isNotBlank(checkPass) && StringUtils.isNotBlank(scanPass)) {
...@@ -43,6 +43,7 @@ public class InputInvoiceDao { ...@@ -43,6 +43,7 @@ public class InputInvoiceDao {
// criteria1.andRZJGEqualTo(pass); // criteria1.andRZJGEqualTo(pass);
// example.or(criteria1); // example.or(criteria1);
} }
//发票状态
criteria.andFPZTNotEqualTo("1"); // 过滤作废状态 criteria.andFPZTNotEqualTo("1"); // 过滤作废状态
// List<InputInvoice> list = inputInvoiceMapper.selectByExample(example).stream().filter(x -> { // List<InputInvoice> list = inputInvoiceMapper.selectByExample(example).stream().filter(x -> {
......
...@@ -16,7 +16,6 @@ import org.springframework.beans.BeanUtils; ...@@ -16,7 +16,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.POIUtil; import pwc.taxtech.atms.common.POIUtil;
...@@ -36,7 +35,6 @@ import pwc.taxtech.atms.dto.ReportAttachDto; ...@@ -36,7 +35,6 @@ import pwc.taxtech.atms.dto.ReportAttachDto;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam; import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult; import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.dto.vatdto.*; import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.dto.vatdto.dd.ProfitLossStatementExportDto;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.NotFoundException; import pwc.taxtech.atms.exception.NotFoundException;
...@@ -136,7 +134,10 @@ public class ReportServiceImpl extends BaseService { ...@@ -136,7 +134,10 @@ public class ReportServiceImpl extends BaseService {
private HttpFileService httpFileService; private HttpFileService httpFileService;
@Autowired @Autowired
DidiFileUploadService didiFileUploadService; DidiFileUploadService didiFileUploadService;
@Resource
TrialBalanceFinalMapper trialBalanceFinalMapper;
@Autowired
FormulaAgent agent;
public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) { public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) {
OperationResultDto<List<ReportDto>> result = new OperationResultDto<>(); OperationResultDto<List<ReportDto>> result = new OperationResultDto<>();
CommonUtils.copyProperties(getReportTemplate(projectId, serviceType, periodParam), result); CommonUtils.copyProperties(getReportTemplate(projectId, serviceType, periodParam), result);
...@@ -301,13 +302,32 @@ public class ReportServiceImpl extends BaseService { ...@@ -301,13 +302,32 @@ public class ReportServiceImpl extends BaseService {
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate(); List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
//根据收入类型映射生成开票记录关联数据 //根据收入类型映射生成开票记录关联数据
assembleInvoiceRecord(projectId, period); assembleInvoiceRecord(projectId, period);
//生成trial_balance_final数据
assembleTrialBalanceFinal(projectId,period);
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData); clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
copyTemplateAndConfigFromAdmin(projectId, templates, period); copyTemplateAndConfigFromAdmin(projectId, templates, period);
setStatus(job, STATUS_END); setStatus(job, STATUS_END);
periodJobMapper.updateByPrimaryKey(job); periodJobMapper.updateByPrimaryKey(job);
} }
public void assembleTrialBalanceFinal(String projectId,Integer period){
public void assembleInvoiceRecord(String projectId, Integer period) { Project project = projectMapper.selectByPrimaryKey(projectId);
MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION);
String queryPeriod = project.getYear()+""+(period<10?("0"+period):(period+""));
Project lastProject = agent.getFixedProject(projectId, project.getYear());
String lastPeriod = "0";
if(lastProject!=null) {
if (project.getId().equals(lastProject.getId())) {
lastPeriod = project.getYear() + "" + (period - 1 < 10 ? ("0" + (period - 1)) : ((period - 1) + ""));
} else {
lastPeriod = lastProject.getYear() + "12";
}
}
TrialBalanceFinalExample example = new TrialBalanceFinalExample();
example.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(Integer.valueOf(queryPeriod));
trialBalanceFinalMapper.deleteByExample(example);
trialBalanceFinalMapper.generateFinalData(projectId,Integer.valueOf(queryPeriod),lastProject==null?"0":lastProject.getId(),Integer.valueOf(lastPeriod));
}
public void assembleInvoiceRecord(String projectId,Integer period){
Project project = projectMapper.selectByPrimaryKey(projectId); Project project = projectMapper.selectByPrimaryKey(projectId);
MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION); MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION);
String queryDate = project.getYear() + "-" + (period < 10 ? ("0" + period) : (period + "")); String queryDate = project.getYear() + "-" + (period < 10 ? ("0" + period) : (period + ""));
...@@ -1077,44 +1097,77 @@ public class ReportServiceImpl extends BaseService { ...@@ -1077,44 +1097,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 +1397,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1344,7 +1397,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 +1406,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1353,7 +1406,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 +1527,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1474,7 +1527,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 +2139,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -2086,7 +2139,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);
} }
......
...@@ -4,24 +4,19 @@ import org.apache.poi.ss.formula.OperationEvaluationContext; ...@@ -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.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction; 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.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant; import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.EnumOperationType; import pwc.taxtech.atms.constant.enums.EnumOperationType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType; import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.dto.vatdto.InputInvoiceDataSourceDto; 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.math.BigDecimal;
import java.text.ParsePosition; import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/// <summary> /// <summary>
...@@ -84,24 +79,24 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -84,24 +79,24 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
calendar.add(Calendar.YEAR, 1); calendar.add(Calendar.YEAR, 1);
Date endDate = calendar.getTime(); Date endDate = calendar.getTime();
List<InputInvoice> inputInvoices; List<CertifiedInvoicesList> inputInvoices;
if (authenticationType == 1 && formulaContext.getIsYear()) { if (authenticationType == 1 && formulaContext.getIsYear()) {
inputInvoices = SpringContextUtil.inputInvoiceDao.getInputInvoice(null, invoiceType, inputInvoices = getInvoice(null, invoiceType,
Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass, Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass,
null); null);
} else if (authenticationType == 1) { } else if (authenticationType == 1) {
inputInvoices = SpringContextUtil.inputInvoiceDao.getInputInvoice(period, invoiceType, inputInvoices =getInvoice(period, invoiceType,
Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass, Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass,
null); null);
} }
// 认证未通过与未认证暂认为是同一个意思 // 认证未通过与未认证暂认为是同一个意思
else if (authenticationType == 2 && formulaContext.getIsYear()) { else if (authenticationType == 2 && formulaContext.getIsYear()) {
inputInvoices = SpringContextUtil.inputInvoiceDao.getInputInvoice(null, invoiceType, inputInvoices = getInvoice(null, invoiceType,
null, null, Constant.InputInvoiceCertificationResult.NotPass); null, null, Constant.InputInvoiceCertificationResult.NotPass);
} }
// 认证未通过与未认证暂认为是同一个意思 // 认证未通过与未认证暂认为是同一个意思
else if (authenticationType == 0 || authenticationType == 2) { else if (authenticationType == 0 || authenticationType == 2) {
inputInvoices = SpringContextUtil.inputInvoiceDao.getInputInvoice(period, invoiceType, null, inputInvoices =getInvoice(period, invoiceType, null,
null, Constant.InputInvoiceCertificationResult.NotPass); null, Constant.InputInvoiceCertificationResult.NotPass);
} else { } else {
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L, formulaContext.getProjectId()); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L, formulaContext.getProjectId());
...@@ -118,7 +113,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -118,7 +113,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
endDate = calendar.getTime(); endDate = calendar.getTime();
Date finalEndDate = endDate; Date finalEndDate = endDate;
inputInvoices = inputInvoices.stream() inputInvoices = inputInvoices.stream()
.filter(a -> DateUtils.strToDate(a.getRZSJ()).before(finalEndDate)) .filter(a -> a.getCertifiedDate().before(finalEndDate))
.collect(Collectors.toList()); .collect(Collectors.toList());
} else if (certificationPeriod != 99) { } else if (certificationPeriod != 99) {
calendar.set(formulaContext.getYear(), certificationPeriod - 1, 1); calendar.set(formulaContext.getYear(), certificationPeriod - 1, 1);
...@@ -129,26 +124,26 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -129,26 +124,26 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
Date finalEndDate1 = endDate; Date finalEndDate1 = endDate;
Date finalStartDate = startDate; Date finalStartDate = startDate;
inputInvoices = inputInvoices.stream() inputInvoices = inputInvoices.stream()
.filter(a -> strToDate(a.getRZSQ()).after(finalStartDate) .filter(a -> a.getCertifiedDate().after(finalStartDate)
&& strToDate(a.getRZSQ()).before(finalEndDate1)) && a.getCertifiedDate().before(finalEndDate1))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
List<InputInvoiceDataSourceDto> dataSource = new ArrayList<>(); List<InputInvoiceDataSourceDto> dataSource = new ArrayList<>();
for (InputInvoice x : inputInvoices) { for (CertifiedInvoicesList x : inputInvoices) {
InputInvoiceDataSourceDto inputInvoiceDataSourceDto = new InputInvoiceDataSourceDto(); InputInvoiceDataSourceDto inputInvoiceDataSourceDto = new InputInvoiceDataSourceDto();
inputInvoiceDataSourceDto.setAmount(FormulaHelper.roundValue(new BigDecimal(x.getHJJE()), KeyValueConfigResultType.Accounting, inputInvoiceDataSourceDto.setAmount(FormulaHelper.roundValue(x.getAmount(), KeyValueConfigResultType.Accounting,
null, formulaContext)); null, formulaContext));
inputInvoiceDataSourceDto.setResultType(KeyValueConfigResultType.Accounting.getCode()); 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)); null, formulaContext));
inputInvoiceDataSourceDto.setCertificationDate(DateUtils.strToDate(x.getRZSJ())); inputInvoiceDataSourceDto.setCertificationDate(x.getCertifiedDate());
inputInvoiceDataSourceDto.setInvoiceCode(x.getFPDM()); inputInvoiceDataSourceDto.setInvoiceCode(x.getInvoiceCode());
inputInvoiceDataSourceDto.setInvoiceNumber(x.getFPHM()); inputInvoiceDataSourceDto.setInvoiceNumber(x.getInvoiceNum());
inputInvoiceDataSourceDto.setInvoiceType(Integer.parseInt(x.getFPLX())); inputInvoiceDataSourceDto.setInvoiceType(Integer.parseInt(x.getInvoiceType()));
inputInvoiceDataSourceDto.setPeriod(period); inputInvoiceDataSourceDto.setPeriod(period);
inputInvoiceDataSourceDto.setSellerTaxNumber(x.getXFSH()); inputInvoiceDataSourceDto.setSellerTaxNumber(x.getSalesTaxNum());
inputInvoiceDataSourceDto.setName(Constant.DataSourceName.InputDetailInvoiceDataSource); inputInvoiceDataSourceDto.setName(Constant.DataSourceName.InputDetailInvoiceDataSource);
inputInvoiceDataSourceDto.setOperationType(EnumOperationType.Single.getCode()); inputInvoiceDataSourceDto.setOperationType(EnumOperationType.Single.getCode());
dataSource.add(inputInvoiceDataSourceDto); dataSource.add(inputInvoiceDataSourceDto);
...@@ -199,4 +194,40 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -199,4 +194,40 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
return strtodate; 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 @@ ...@@ -40,10 +40,10 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java"> <javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java">
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" /> <property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator> </javaClientGenerator>
<table tableName="ebit_cell_data" domainObjectName="EbitCellData"> <!--<table tableName="ebit_cell_data" domainObjectName="EbitCellData">-->
<property name="useActualColumnNames" value="false"/> <!--<property name="useActualColumnNames" value="false"/>-->
<property name="ignoreQualifiersAtRuntime" value="true"/> <!--<property name="ignoreQualifiersAtRuntime" value="true"/>-->
</table> <!--</table>-->
<!-- <!--
...@@ -546,14 +546,14 @@ ...@@ -546,14 +546,14 @@
<table tableName="period_cell_comment" domainObjectName="PeriodCellComment"> <table tableName="period_cell_comment" domainObjectName="PeriodCellComment">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/> <property name="ignoreQualifiersAtRuntime" value="true"/>
</table> </table>-->
<table tableName="period_cell_data" domainObjectName="PeriodCellData"> <table tableName="period_cell_data" domainObjectName="PeriodCellData">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/> <property name="ignoreQualifiersAtRuntime" value="true"/>
</table> </table>
<table tableName="period_cell_data_source" domainObjectName="PeriodCellDataSource"> <!--<table tableName="period_cell_data_source" domainObjectName="PeriodCellDataSource">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/> <property name="ignoreQualifiersAtRuntime" value="true"/>
</table> </table>
......
...@@ -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
...@@ -121,4 +121,9 @@ public interface TrialBalanceFinalMapper extends MyVatMapper { ...@@ -121,4 +121,9 @@ public interface TrialBalanceFinalMapper extends MyVatMapper {
@Param("projectId") String projectId, @Param("projectId") String projectId,
@Param("period") Integer period, @Param("period") Integer period,
@Param("queryDate") String queryDate); @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; package pwc.taxtech.atms.vat.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -10,7 +12,7 @@ import java.util.Date; ...@@ -10,7 +12,7 @@ import java.util.Date;
* *
* @mbg.generated do_not_delete_during_merge * @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. * This field was generated by MyBatis Generator.
...@@ -119,6 +121,24 @@ public class PeriodCellData implements Serializable { ...@@ -119,6 +121,24 @@ public class PeriodCellData implements Serializable {
*/ */
private String keyinData; 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 was generated by MyBatis Generator.
* This field corresponds to the database table period_cell_data * This field corresponds to the database table period_cell_data
...@@ -415,6 +435,54 @@ public class PeriodCellData implements Serializable { ...@@ -415,6 +435,54 @@ public class PeriodCellData implements Serializable {
this.keyinData = keyinData == null ? null : keyinData.trim(); 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 was generated by MyBatis Generator.
* This method corresponds to the database table period_cell_data * This method corresponds to the database table period_cell_data
...@@ -439,6 +507,8 @@ public class PeriodCellData implements Serializable { ...@@ -439,6 +507,8 @@ public class PeriodCellData implements Serializable {
sb.append(", projectId=").append(projectId); sb.append(", projectId=").append(projectId);
sb.append(", period=").append(period); sb.append(", period=").append(period);
sb.append(", keyinData=").append(keyinData); sb.append(", keyinData=").append(keyinData);
sb.append(", validateFormulaExp=").append(validateFormulaExp);
sb.append(", validateResult=").append(validateResult);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
......
...@@ -974,6 +974,146 @@ public class PeriodCellDataExample { ...@@ -974,6 +974,146 @@ public class PeriodCellDataExample {
addCriterion("keyin_data not between", value1, value2, "keyinData"); addCriterion("keyin_data not between", value1, value2, "keyinData");
return (Criteria) this; 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 @@ ...@@ -18,6 +18,8 @@
<result column="project_id" jdbcType="VARCHAR" property="projectId" /> <result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="period" jdbcType="INTEGER" property="period" /> <result column="period" jdbcType="INTEGER" property="period" />
<result column="keyin_data" jdbcType="VARCHAR" property="keyinData" /> <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> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -91,7 +93,7 @@ ...@@ -91,7 +93,7 @@
This element is automatically generated by MyBatis Generator, do not modify. 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, 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> </sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellDataExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellDataExample" resultMap="BaseResultMap">
<!-- <!--
...@@ -147,13 +149,13 @@ ...@@ -147,13 +149,13 @@
insert into period_cell_data (id, report_id, cell_template_id, insert into period_cell_data (id, report_id, cell_template_id,
`data`, formula_exp, create_by, `data`, formula_exp, create_by,
create_time, update_by, update_time, 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}, values (#{id,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT}, #{cellTemplateId,jdbcType=BIGINT},
#{data,jdbcType=VARCHAR}, #{formulaExp,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{data,jdbcType=VARCHAR}, #{formulaExp,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{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>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellData"> <insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellData">
<!-- <!--
...@@ -198,6 +200,12 @@ ...@@ -198,6 +200,12 @@
<if test="keyinData != null"> <if test="keyinData != null">
keyin_data, keyin_data,
</if> </if>
<if test="validateFormulaExp != null">
validate_formula_exp,
</if>
<if test="validateResult != null">
validate_result,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -236,6 +244,12 @@ ...@@ -236,6 +244,12 @@
<if test="keyinData != null"> <if test="keyinData != null">
#{keyinData,jdbcType=VARCHAR}, #{keyinData,jdbcType=VARCHAR},
</if> </if>
<if test="validateFormulaExp != null">
#{validateFormulaExp,jdbcType=VARCHAR},
</if>
<if test="validateResult != null">
#{validateResult,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellDataExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellDataExample" resultType="java.lang.Long">
...@@ -291,6 +305,12 @@ ...@@ -291,6 +305,12 @@
<if test="record.keyinData != null"> <if test="record.keyinData != null">
keyin_data = #{record.keyinData,jdbcType=VARCHAR}, keyin_data = #{record.keyinData,jdbcType=VARCHAR},
</if> </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> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -313,7 +333,9 @@ ...@@ -313,7 +333,9 @@
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
period = #{record.period,jdbcType=INTEGER}, 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"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -358,6 +380,12 @@ ...@@ -358,6 +380,12 @@
<if test="keyinData != null"> <if test="keyinData != null">
keyin_data = #{keyinData,jdbcType=VARCHAR}, keyin_data = #{keyinData,jdbcType=VARCHAR},
</if> </if>
<if test="validateFormulaExp != null">
validate_formula_exp = #{validateFormulaExp,jdbcType=VARCHAR},
</if>
<if test="validateResult != null">
validate_result = #{validateResult,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -377,7 +405,9 @@ ...@@ -377,7 +405,9 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
project_id = #{projectId,jdbcType=VARCHAR}, project_id = #{projectId,jdbcType=VARCHAR},
period = #{period,jdbcType=INTEGER}, 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} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellDataExample" resultMap="BaseResultMap"> <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 @@ ...@@ -74,5 +74,125 @@
order by detail.emptyCode order by detail.emptyCode
</select> </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> </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,17 @@ ...@@ -2931,14 +2932,17 @@
$scope.upload($scope.file); $scope.upload($scope.file);
}); });
//上传模板 //上传模板
//Upload.setDefaults( {ngf-keep:false ngf-accept:'image/*', ...} );
$scope.upload = function (file) { $scope.upload = function (file) {
var _file = $scope.importExcelFile;
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 +2953,69 @@ ...@@ -2949,11 +2953,69 @@
.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){
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,18 @@ ...@@ -22,19 +22,18 @@
</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="" type="file" ng-model="importExcelFile" ngf-change="upload($files)" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false"
ngf-validate="{size: {min:'10KB', max:'20MB'}}"><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span> 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="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>
<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