Commit b3991e25 authored by sherlock's avatar sherlock

Merge branch 'dev_oracle_sherlock' into 'dev_oracle'

Dev oracle sherlock

See merge request root/atms!203
parents c8c8f041 c1ae7f3b
......@@ -94,7 +94,7 @@ public class InputInvoiceImportController {
}
}
private int getDownloadFilePath(InputInvoicePreviewQueryParam paras, OutputStream outputStream, String projectId) {
List<InputInvoice> list = inputInvoiceDataImportService.getInputInvoiceTreeViewData(paras, projectId).getList();
List<InputInvoice> list = inputInvoiceDataImportService.getInputInvoiceTree(paras, projectId);
if (list.size() == 0) {
return 0;
}
......@@ -107,9 +107,9 @@ public class InputInvoiceImportController {
inputInvoiceExportDto.setInvoiceDate(inputInvoice.getKPRQ());
inputInvoiceExportDto.setInvoiceNumber(inputInvoice.getFPHM());
inputInvoiceExportDto.setInvoiceTypeName(getFplx(inputInvoice.getFPLX()));
inputInvoiceExportDto.setPeriodId(Integer.parseInt(inputInvoice.getRZSJ().substring(5, 7)));
inputInvoiceExportDto.setPeriodId(Integer.parseInt(inputInvoice.getRZSQ().substring(4, 6)));
inputInvoiceExportDto.setSellerTaxNumber(inputInvoice.getXFSH());
inputInvoiceExportDto.setTaxAmount(inputInvoice.getHJSE() != null ? new BigDecimal(inputInvoice.getHJJE().replace(",","")) : BigDecimal.ZERO);
inputInvoiceExportDto.setTaxAmount(inputInvoice.getHJSE() != null ? new BigDecimal(inputInvoice.getHJSE().replace(",","")) : BigDecimal.ZERO);
inputInvoiceExportDtos.add(inputInvoiceExportDto);
}
Map<String, String> header = new LinkedHashMap<>();
......
......@@ -112,20 +112,20 @@ public class OutputInvoiceController {
header.put("InvoiceNumber", "发票号码");
header.put("BuyerName", "购方企业名称");
header.put("BuyerTaxNumber", "购方税号");
header.put("BankAccount", "银行账号");
header.put("PhoneNum", "地址电话");
// header.put("BankAccount", "银行账号");
// header.put("PhoneNum", "地址电话");
header.put("InvoiceDate", "开票日期");
header.put("CodeVersion", "商品编码版本号");
header.put("DocumentNum", "单据号");
header.put("ProductName", "商品名称");
header.put("ProductStandar", "规格");
header.put("Unit", "单位");
header.put("Quantity", "数量");
header.put("UnitPrice", "单价");
// header.put("CodeVersion", "商品编码版本号");
// header.put("DocumentNum", "单据号");
// header.put("ProductName", "商品名称");
// header.put("ProductStandar", "规格");
// header.put("Unit", "单位");
// header.put("Quantity", "数量");
// header.put("UnitPrice", "单价");
header.put("Amount", "金额");
header.put("TaxRate", "税率");
// header.put("TaxRate", "税率");
header.put("TaxAmount", "税额");
header.put("TaxClassCode", "税收分类编码");
// header.put("TaxClassCode", "税收分类编码");
ExcelUtil.exportExcel(header, list2, outputStream);
return list.size();
......
......@@ -22,33 +22,32 @@ public class OutputVATInvoiceInfoDto {
private String buyerName;
@ExcelCell(index=5)
private String buyerTaxNumber;
@ExcelCell(index=6)
// @ExcelCell(index=6)
private String bankAccount;
@ExcelCell(index=7)
// @ExcelCell(index=7)
private String phoneNum;
@ExcelCell(index=8)
@ExcelCell(index=6)
private Date invoiceDate;
@ExcelCell(index=9)
// @ExcelCell(index=9)
private String codeVersion;
@ExcelCell(index=11)
// @ExcelCell(index=11)
private String productName;
@ExcelCell(index=10)
// @ExcelCell(index=10)
private String documentNum;
@ExcelCell(index=12)
// @ExcelCell(index=12)
private String productStandard;
@ExcelCell(index=13)
// @ExcelCell(index=13)
private String unit;
@ExcelCell(index=14)
// @ExcelCell(index=14)
private Integer quantity;
@ExcelCell(index=15)
// @ExcelCell(index=15)
private Double unitPrice;
@ExcelCell(index=16)
@ExcelCell(index=7)
private BigDecimal amount;
@ExcelCell(index=17)
// @ExcelCell(index=17)
private BigDecimal taxRate;
@ExcelCell(index=18)
@ExcelCell(index=8)
private BigDecimal taxAmount;
@ExcelCell(index=19)
private String taxClassCode;
@JsonProperty("periodID")
private int periodId;
......
......@@ -75,18 +75,18 @@ public class DataImportService extends BaseService {
//科目段
GlBalanceExample.Criteria c = example.createCriteria().andSegment1EqualTo(organization.getClientCode())
.andPeriodNameEqualTo(dateFormat.format(calendar.getTime()));
if(CollectionUtils.isNotEmpty(etCodeList)){
// if(CollectionUtils.isNotEmpty(etCodeList)){
c.andSegment3In(etCodeList);
}
// }
List<GlBalance> sg3List = glBalanceMapper.selectByExample(example);
GlBalanceExample example2 = new GlBalanceExample();
//明细段
GlBalanceExample.Criteria c2 = example2.createCriteria().andSegment1EqualTo(organization.getClientCode())
.andPeriodNameEqualTo(dateFormat.format(calendar.getTime()));
if(CollectionUtils.isNotEmpty(etCodeList)){
// if(CollectionUtils.isNotEmpty(etCodeList)){
c2.andSegment4In(etCodeList);
}
// }
List<GlBalance> sg4List = glBalanceMapper.selectByExample(example2);
for (StandardAccount standardAccount : stdAccountList) {
......
......@@ -55,7 +55,7 @@ public class InputInvoiceDataImportServiceImpl {
@Autowired
private OrganizationMapper organizationMapper;
public PageInfo<InputInvoice> getInputInvoiceTreeViewData(InputInvoicePreviewQueryParam paras, String projectId) {
public List<InputInvoice> getInputInvoiceTree(InputInvoicePreviewQueryParam paras, String projectId){
Project project = projectMapper.selectByPrimaryKey(projectId);
Organization organization = organizationMapper.selectByPrimaryKey(project.getOrganizationId());
InputInvoiceExample invoiceExample = new InputInvoiceExample();
......@@ -64,7 +64,7 @@ public class InputInvoiceDataImportServiceImpl {
paras.getPeriodEnd(), Constant.DateFormat.YYYYMM)).andRZJGEqualTo(INPUT_RZJG_SUCCESS).andRZZTEqualTo(INPUT_RZZT_OVER)
.andFPZTNotEqualTo("1");
PageHelper.startPage(paras.getPageInfo().getPageIndex(), paras.getPageInfo().getPageSize());
List<InputInvoice> invoices = inputInvoiceMapper.selectByExample(invoiceExample);
DecimalFormat df = new DecimalFormat("#,###.00");
invoices.stream().forEach(x -> {
......@@ -73,7 +73,12 @@ public class InputInvoiceDataImportServiceImpl {
x.setRZJG(convertRzjg(x.getRZJG()));
}
);
PageInfo<InputInvoice> pageInfo = new PageInfo<>(invoices);
return invoices;
}
public PageInfo<InputInvoice> getInputInvoiceTreeViewData(InputInvoicePreviewQueryParam paras, String projectId) {
PageHelper.startPage(paras.getPageInfo().getPageIndex(), paras.getPageInfo().getPageSize());
PageInfo<InputInvoice> pageInfo = new PageInfo<>(getInputInvoiceTree(paras, projectId));
return pageInfo;
}
......
package pwc.taxtech.atms.vat.service.impl.report.functions;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
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.MyAsserts;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.entity.AccountMapping;
import pwc.taxtech.atms.entity.AccountMappingExample;
import pwc.taxtech.atms.entity.EnterpriseAccountSetOrg;
import pwc.taxtech.atms.entity.EnterpriseAccountSetOrgExample;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.entity.GlBalance;
import pwc.taxtech.atms.vat.entity.GlBalanceExample;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
......@@ -34,7 +43,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
int year = getIntParam(args[2], ec);
int period = getIntParam(args[3], ec);
String formulaExpression = "DFFS(" + type + "," + code + ","
String formulaExpression = "DFFS(" + type + ",\"" + code + "\","
+ year + "," + period + ")";
logger.debug(formulaExpression);
......@@ -46,7 +55,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
year = year + yearOffset;
Date date = DateUtils.strToDate(year + "-" + period + "-" + 15);
List<GlBalance> list;
List<ReportCellDataSourceDto> dataSource = Lists.newArrayList();
if(type == 0){
EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample();
example.createCriteria().andEffectiveDateLessThanOrEqualTo(date).andExpiredDateGreaterThanOrEqualTo(date).andOrganizationIdEqualTo(orgId);
......@@ -58,18 +67,30 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
accountMappingExample.createCriteria().andOrganizationIdEqualTo(orgId).andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetOrgs.get(0).getEnterpriseAccountSetId());
List<AccountMapping> accountMappings = SpringContextUtil.accountMappingMapper.selectByExample(accountMappingExample);
double result = 0;
for(AccountMapping a : accountMappings){
result += count(a.getEnterpriseAccountCode());
result += count(a.getEnterpriseAccountCode(), dataSource, period);
}
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto,
new BigDecimal(result), period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(result), dataSoureId, formulaContext.getProjectId());
return new NumberEval(result);
} else if(type == 1){
return new NumberEval(count(code));
double result = count(code, dataSource, period);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto,
new BigDecimal(result), period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(result), dataSoureId, formulaContext.getProjectId());
return new NumberEval(result);
}
return NumberEval.ZERO;
}
private double count(String code){
private double count(String code, List<ReportCellDataSourceDto> contain, int period){
GlBalanceExample glBalanceExample = new GlBalanceExample();
GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code);
GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code);
......@@ -82,6 +103,15 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
if(CollectionUtils.isEmpty(temp)){
temp = list;
}
for(GlBalance glBalance : temp){
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
dto.setAmount(glBalance.getPtdCr());
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
contain.add(dto);
}
return temp.stream().mapToDouble(a -> a.getPtdCr().doubleValue()).sum();
}
}
......@@ -14,6 +14,8 @@ import pwc.taxtech.atms.dto.vatdto.InputInvoiceDataSourceDto;
import pwc.taxtech.atms.vat.entity.InputInvoice;
import java.math.BigDecimal;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
......@@ -127,8 +129,8 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
Date finalEndDate1 = endDate;
Date finalStartDate = startDate;
inputInvoices = inputInvoices.stream()
.filter(a -> DateUtils.strToDate(a.getRZSJ()).after(finalStartDate)
&& DateUtils.strToDate(a.getRZSJ()).before(finalEndDate1))
.filter(a -> strToDate(a.getRZSQ()).after(finalStartDate)
&& strToDate(a.getRZSQ()).before(finalEndDate1))
.collect(Collectors.toList());
}
}
......@@ -188,4 +190,12 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
formulaContext.getProjectId());
return NumberEval.ZERO;
}
private static Date strToDate(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMM");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
}
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