Commit e7a7133a authored by sherlock's avatar sherlock

Merge branch 'dev_oracle_sherlock' into 'dev_oracle'

Dev oracle sherlock

See merge request root/atms!204
parents b83c00dd fc04d20f
......@@ -156,7 +156,7 @@ public class InputInvoiceImportController {
inputInvoiceDetailExportDto.setAmount(inputInvoiceDetail.getJE() != null ? new BigDecimal(inputInvoiceDetail.getJE().replace(",","")) : BigDecimal.ZERO);
inputInvoiceDetailExportDto.setInvoiceCode(inputInvoiceDetail.getFPDM());
inputInvoiceDetailExportDto.setInvoiceNumber(inputInvoiceDetail.getFPHM());
inputInvoiceDetailExportDto.setPeriodId(Integer.parseInt(item.getRZSJ().substring(5, 7)));
inputInvoiceDetailExportDto.setPeriodId(Integer.parseInt(item.getRZSQ().substring(4, 6)));
inputInvoiceDetailExportDto.setProductionName(inputInvoiceDetail.getSPMC());
inputInvoiceDetailExportDto.setTaxAmount(inputInvoiceDetail.getSE() != null ? new BigDecimal(inputInvoiceDetail.getSE().replace(",","")) : BigDecimal.ZERO);
inputInvoiceDetailExportDto.setTaxRate(inputInvoiceDetail.getSLV());
......
......@@ -104,6 +104,7 @@ public class OutputInvoiceController {
new pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto();
d = beanUtil.copyProperties(x,d);
d.setInvoiceTypeName(d.getInvoiceTypeName());
d.setTaxRate(x.getTaxRate().toString() + "%");
list2.add(d);
});
Map<String, String> header = new LinkedHashMap<>();
......@@ -117,13 +118,13 @@ public class OutputInvoiceController {
header.put("InvoiceDate", "开票日期");
// header.put("CodeVersion", "商品编码版本号");
// header.put("DocumentNum", "单据号");
// header.put("ProductName", "商品名称");
header.put("ProductName", "商品名称");
// header.put("ProductStandar", "规格");
// header.put("Unit", "单位");
// header.put("Quantity", "数量");
// header.put("UnitPrice", "单价");
header.put("Quantity", "数量");
header.put("UnitPrice", "单价");
header.put("Amount", "金额");
// header.put("TaxRate", "税率");
header.put("TaxRate", "税率");
header.put("TaxAmount", "税额");
// header.put("TaxClassCode", "税收分类编码");
......
......@@ -30,7 +30,7 @@ public class OutputVATInvoiceInfoDto {
private Date invoiceDate;
// @ExcelCell(index=9)
private String codeVersion;
// @ExcelCell(index=11)
@ExcelCell(index=7)
private String productName;
// @ExcelCell(index=10)
private String documentNum;
......@@ -38,15 +38,15 @@ public class OutputVATInvoiceInfoDto {
private String productStandard;
// @ExcelCell(index=13)
private String unit;
// @ExcelCell(index=14)
@ExcelCell(index=8)
private Integer quantity;
// @ExcelCell(index=15)
@ExcelCell(index=9)
private Double unitPrice;
@ExcelCell(index=7)
@ExcelCell(index=10)
private BigDecimal amount;
// @ExcelCell(index=17)
private BigDecimal taxRate;
@ExcelCell(index=8)
@ExcelCell(index=11)
private String taxRate;
@ExcelCell(index=12)
private BigDecimal taxAmount;
private String taxClassCode;
@JsonProperty("periodID")
......@@ -194,11 +194,11 @@ public class OutputVATInvoiceInfoDto {
this.amount = amount;
}
public BigDecimal getTaxRate() {
public String getTaxRate() {
return taxRate;
}
public void setTaxRate(BigDecimal taxRate) {
public void setTaxRate(String taxRate) {
this.taxRate = taxRate;
}
......
......@@ -212,7 +212,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
templateGroupMapper.insertSelective(templateGroup);
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
String sheetName = workbook.getSheetName(i);
if(!templateGroupDto.getSheetNameList().contains(sheetName)){
if(!sheetNameList.contains(sheetName)){
continue;
}
String newName = sheetName + CommonUtils.getUUID() + POIUtil.getFileSuffix(fileName).get();
......@@ -347,6 +347,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
int length = templateMapper.selectByExample(t).size();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
String sheetName = workbook.getSheetName(i);
if(!sheetNameList.contains(sheetName)){
continue;
}
String newName = sheetName + CommonUtils.getUUID() + POIUtil.getFileSuffix(fileName).get();
Sheet sheet = workbook.getSheetAt(i);
Optional<Workbook> optional = POIUtil.cloneNewSheet(sheet, fileName);
......
package pwc.taxtech.atms.vat.service.impl;
import com.google.common.collect.Lists;
import jdk.nashorn.internal.runtime.options.Option;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
......@@ -20,16 +18,13 @@ import org.springframework.transaction.annotation.Transactional;
import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto;
import pwc.taxtech.atms.dto.vatdto.PeriodResources;
import pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.service.impl.HttpFileService;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.dpo.MergerManaualCellData;
import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.report.functions.*;
......@@ -44,7 +39,6 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static pwc.taxtech.atms.common.util.SpringContextUtil.reportMapper;
import static pwc.taxtech.atms.constant.Constant.EMPTY;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component
......@@ -518,7 +512,8 @@ public class ReportGeneratorImpl {
public void addFunctionsAndContext(Workbook workbook, String[] functions, FormulaContext formulaContext) {
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext),
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new ProjectContext(formulaContext)
, new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext) ,new DFFS(formulaContext)};
, new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext) ,new DFFS(formulaContext),
new JFFS(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls);
UDFFinder udfToolpack = new AggregatingUDFFinder(udfs);
workbook.addToolPack(udfToolpack);
......
......@@ -50,7 +50,7 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
public class ReportServiceImpl {
private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>();
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "ProjectContext", "JXFPMX", "JXFP","PSUM","DFFS"};
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "ProjectContext", "JXFPMX", "JXFP","PSUM","DFFS", "JFFS"};
@Autowired
private ReportGeneratorImpl reportGenerator;
......
......@@ -53,12 +53,11 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
period = FormulaHelper.getPeriod(period, yearOffset, formulaContext);
String orgId = formulaContext.getOrganizationId();
year = year + yearOffset;
Date date = DateUtils.strToDate(year + "-" + period + "-" + 15);
List<ReportCellDataSourceDto> dataSource = Lists.newArrayList();
if(type == 0){
EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample();
example.createCriteria().andEffectiveDateLessThanOrEqualTo(date).andExpiredDateGreaterThanOrEqualTo(date).andOrganizationIdEqualTo(orgId);
example.createCriteria().andEffectiveDateLessThanOrEqualTo(DateUtils.getNow()).andExpiredDateGreaterThanOrEqualTo(DateUtils.getNow()).andOrganizationIdEqualTo(orgId);
List<EnterpriseAccountSetOrg> enterpriseAccountSetOrgs = SpringContextUtil.enterpriseAccountSetOrgMapper.selectByExample(example);
if(CollectionUtils.isEmpty(enterpriseAccountSetOrgs)){
return NumberEval.ZERO;
......@@ -69,7 +68,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
double result = 0;
for(AccountMapping a : accountMappings){
result += count(a.getEnterpriseAccountCode(), dataSource, period);
result += count(a.getEnterpriseAccountCode(), dataSource, period, year);
}
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto,
......@@ -79,7 +78,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
return new NumberEval(result);
} else if(type == 1){
double result = count(code, dataSource, period);
double result = count(code, dataSource, period, year);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto,
new BigDecimal(result), period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
......@@ -90,10 +89,14 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
return NumberEval.ZERO;
}
private double count(String code, List<ReportCellDataSourceDto> contain, int period){
private String periodName(int period, int year){
return year + "-" + (period > 9 ? period : ("0" + period));
}
private double count(String code, List<ReportCellDataSourceDto> contain, int period, int year){
GlBalanceExample glBalanceExample = new GlBalanceExample();
GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code);
GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code);
GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code).andPeriodNameEqualTo(periodName(period, year));
GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code).andPeriodNameEqualTo(periodName(period, year));
glBalanceExample.or(c2);
List<GlBalance> list = SpringContextUtil.glBalanceMapper.selectByExample(glBalanceExample);
if(CollectionUtils.isEmpty(list)){
......
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.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
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.vat.entity.GlBalance;
import pwc.taxtech.atms.vat.entity.GlBalanceExample;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class JFFS extends FunctionBase implements FreeRefFunction {
public JFFS(FormulaContext formulaContext) {
super(formulaContext);
}
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
if (args.length < 4) {
return null;
}
int type = getIntParam(args[0], ec);
String code = getStringParam(args[1], ec);
int year = getIntParam(args[2], ec);
int period = getIntParam(args[3], ec);
String formulaExpression = "JFFS(" + type + ",\"" + code + "\","
+ year + "," + period + ")";
logger.debug(formulaExpression);
year = getYear(year);
Integer yearOffset = 0;
period = FormulaHelper.getPeriod(period, yearOffset, formulaContext);
String orgId = formulaContext.getOrganizationId();
year = year + yearOffset;
List<ReportCellDataSourceDto> dataSource = Lists.newArrayList();
if(type == 0){
EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample();
example.createCriteria().andEffectiveDateLessThanOrEqualTo(DateUtils.getNow()).andExpiredDateGreaterThanOrEqualTo(DateUtils.getNow()).andOrganizationIdEqualTo(orgId);
List<EnterpriseAccountSetOrg> enterpriseAccountSetOrgs = SpringContextUtil.enterpriseAccountSetOrgMapper.selectByExample(example);
if(CollectionUtils.isEmpty(enterpriseAccountSetOrgs)){
return NumberEval.ZERO;
}
AccountMappingExample accountMappingExample = new AccountMappingExample();
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(), dataSource, period, year);
}
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){
double result = count(code, dataSource, period, year);
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 String periodName(int period, int year){
return year + "-" + (period > 9 ? period : ("0" + period));
}
private double count(String code, List<ReportCellDataSourceDto> contain, int period, int year){
GlBalanceExample glBalanceExample = new GlBalanceExample();
GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code).andPeriodNameEqualTo(periodName(period, year));
GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code).andPeriodNameEqualTo(periodName(period, year));
glBalanceExample.or(c2);
List<GlBalance> list = SpringContextUtil.glBalanceMapper.selectByExample(glBalanceExample);
if(CollectionUtils.isEmpty(list)){
return 0.0;
}
List<GlBalance> temp = list.stream().filter(x -> code.equalsIgnoreCase(x.getSegment3())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(temp)){
temp = list;
}
for(GlBalance glBalance : temp){
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
dto.setAmount(glBalance.getPtdDr());
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
contain.add(dto);
}
return temp.stream().mapToDouble(a -> a.getPtdDr().doubleValue()).sum();
}
}
......@@ -6,8 +6,15 @@
$scope.startDate = new Date($scope.project.year, 0, 1);
$scope.endDate = new Date($scope.project.year, 11, 31);
$scope.dateFormat = $translate.instant('dateFormat4YearMonthDay');
$scope.isReadOnly = false;
$scope.isReadOnly = false;
$scope.totalBegDebitBal = 0;
$scope.totalBegCreditBal = 0;
$scope.totalDebitBal = 0;
$scope.totalCreditBal= 0;
$scope.totalEndDebitBal = 0;
$scope.totalEndCreditBal= 0;
var minDate = [1, $scope.project.year];
var maxDate = [12, $scope.project.year];
var setDate = [
......@@ -116,7 +123,7 @@
//************ EXCEL EXPORT FUNCTION ***************/
$scope.$on('ngRepeatFinished', function (ngRepeatFinishedEvent) {
if ($scope.isToPrint)
export_table_to_excel('exportTable', 'GL', 'xlsx', '');
export_table_to_excel('exportTable', '试算平衡表', 'xlsx', '');
$scope.isToPrint = false;
});
......@@ -149,7 +156,20 @@
if (isExportOnly !== null && isExportOnly) {
$scope.exportDataList = newTree;
_.each($scope.exportDataList, function(exportData){
if(exportData.begDebitBal && parseFloat(exportData.begDebitBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalBegDebitBal += parseFloat(exportData.begDebitBal.replace(/,/g, ""));
if(exportData.begCreditBal && parseFloat(exportData.begCreditBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalBegCreditBal += parseFloat(exportData.begCreditBal.replace(/,/g, ""));
if(exportData.debitBal && parseFloat(exportData.debitBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalDebitBal += parseFloat(exportData.debitBal.replace(/,/g, ""));
if(exportData.creditBal && parseFloat(exportData.creditBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalCreditBal += parseFloat(exportData.creditBal.replace(/,/g, ""));
if(exportData.endDebitBal && parseFloat(exportData.endDebitBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalEndDebitBal += parseFloat(exportData.endDebitBal.replace(/,/g, ""));
if(exportData.endCreditBal && parseFloat(exportData.endCreditBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalEndCreditBal += parseFloat(exportData.endCreditBal.replace(/,/g, ""));
})
}
else {
$scope.gridOptions.data = newTree;
......
......@@ -108,6 +108,16 @@
<td>{{exportData.endDebitBal}}</td>
<td>{{exportData.endCreditBal}}</td>
</tr>
<tr>
<td></td>
<td></td>
<td>{{totalBegDebitBal}}</td>
<td>{{totalBegCreditBal}}</td>
<td>{{totalDebitBal}}</td>
<td>{{totalCreditBal}}</td>
<td>{{totalEndDebitBal}}</td>
<td>{{totalEndCreditBal}}</td>
</tr>
</table>
</div>
<!--For Export ONLY-->
......
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