Commit 71cb4727 authored by sherlock's avatar sherlock

Merge branch 'dev_oracle_sherlock' into 'dev_oracle'

Dev oracle sherlock

See merge request root/atms!201
parents 231a7fee e6927810
......@@ -476,6 +476,14 @@
</includes>
<targetPath>${basedir}/target/classes/document</targetPath>
</resource>
<resource>
<directory>src/main/resources/userTemplate</directory>
<includes>
<include>**/*.xls</include>
<include>**/*.xlsx</include>
</includes>
<targetPath>${basedir}/target/classes/userTemplate</targetPath>
</resource>
</resources>
<plugins>
<plugin>
......
......@@ -4,11 +4,7 @@ import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import pwc.taxtech.atms.dao.FormulaAdminMapper;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectDao;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dao.ProjectServiceTypeMapper;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.invoice.InputInvoiceMapper;
import pwc.taxtech.atms.invoice.OutputInvoiceDetailMapper;
import pwc.taxtech.atms.invoice.OutputInvoiceMapper;
......@@ -33,6 +29,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public static PeriodTemplateMapper periodTemplateMapper;
public static PeriodStandardAccountMapper periodStandardAccountMapper;
public static ProjectDao projectDao;
public static GlBalanceMapper glBalanceMapper;
public static BalanceMapper balanceMapper;
// public static DataSourceMapper dataSourceMapper;
public static PeriodDataSourceMapper periodDataSourceMapper;
......@@ -54,6 +51,8 @@ public class SpringContextUtil implements ApplicationContextAware {
public static CellDataSourceMapper cellDataSourceMapper;
public static PeriodCellDataSourceMapper periodCellDataSourceMapper;
public static OrganizationMapper organizationMapper;
public static EnterpriseAccountSetOrgMapper enterpriseAccountSetOrgMapper;
public static AccountMappingMapper accountMappingMapper;
/**
* 获取bean
......@@ -66,6 +65,30 @@ public class SpringContextUtil implements ApplicationContextAware {
return SpringContextUtil.webApplicationContext.getBean(requiredType);
}
public static AccountMappingMapper getAccountMappingMapper() {
return accountMappingMapper;
}
public static void setAccountMappingMapper(AccountMappingMapper accountMappingMapper) {
SpringContextUtil.accountMappingMapper = accountMappingMapper;
}
public static EnterpriseAccountSetOrgMapper getEnterpriseAccountSetOrgMapper() {
return enterpriseAccountSetOrgMapper;
}
public static void setEnterpriseAccountSetOrgMapper(EnterpriseAccountSetOrgMapper enterpriseAccountSetOrgMapper) {
SpringContextUtil.enterpriseAccountSetOrgMapper = enterpriseAccountSetOrgMapper;
}
public static GlBalanceMapper getGlBalanceMapper() {
return glBalanceMapper;
}
public static void setGlBalanceMapper(GlBalanceMapper glBalanceMapper) {
SpringContextUtil.glBalanceMapper = glBalanceMapper;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
webApplicationContext = applicationContext;
......
......@@ -79,8 +79,11 @@ public class DataImportService extends BaseService {
GlBalanceExample example2 = new GlBalanceExample();
//明细段
example2.createCriteria().andSegment1EqualTo(organization.getClientCode())
.andPeriodNameEqualTo(dateFormat.format(calendar.getTime())).andSegment4In(etCodeList);
GlBalanceExample.Criteria c = example2.createCriteria().andSegment1EqualTo(organization.getClientCode())
.andPeriodNameEqualTo(dateFormat.format(calendar.getTime()));
if(CollectionUtils.isNotEmpty(etCodeList)){
c.andSegment4In(etCodeList);
}
List<GlBalance> sg4List = glBalanceMapper.selectByExample(example2);
for (StandardAccount standardAccount : stdAccountList) {
......
......@@ -212,6 +212,9 @@ 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)){
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.report.functions;
import com.grapecity.documents.excel.G;
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.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.util.Date;
import java.util.List;
import java.util.stream.Collectors;
public class DFFS extends FunctionBase implements FreeRefFunction {
public DFFS(FormulaContext formulaContext) {
......@@ -12,6 +26,63 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
return new NumberEval(0);
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 = "DFFS(" + type + "," + code + ","
+ year + "," + period + ")";
logger.debug(formulaExpression);
year = getIntParam(args[2], ec);
Integer yearOffset = 0;
period = FormulaHelper.getPeriod(period, yearOffset, formulaContext);
String orgId = formulaContext.getOrganizationId();
year = year + yearOffset;
Date date = DateUtils.strToDate(year + "-" + period + "-" + 15);
List<GlBalance> list;
if(type == 0){
EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample();
example.createCriteria().andEffectiveDateLessThanOrEqualTo(date).andExpiredDateGreaterThanOrEqualTo(date).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());
}
new NumberEval(result);
} else if(type == 1){
return new NumberEval(count(code));
}
return null;
}
private double count(String code){
GlBalanceExample glBalanceExample = new GlBalanceExample();
GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code);
GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code);
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;
}
return temp.stream().mapToDouble(a -> a.getPtdCr().doubleValue()).sum();
}
}
......@@ -99,14 +99,14 @@
<td><span translate="EndBal"></span><span translate="Creditor"></span></td>
</tr>
<tr ng-repeat="exportData in exportDataList" on-finish-render="ngRepeatFinished">
<td>{{exportData.accountCode}}</td>
<td>{{exportData.acctCode}}</td>
<td>{{exportData.accountName}}</td>
<td>{{exportData.debitOpeningBalance}}</td>
<td>{{exportData.creditOpeningBalance}}</td>
<td>{{exportData.accumulatedDebitAmount}}</td>
<td>{{exportData.accumulatedCreditAmount}}</td>
<td>{{exportData.debitClosingBalance}}</td>
<td>{{exportData.creditClosingBalance}}</td>
<td>{{exportData.begDebitBal}}</td>
<td>{{exportData.begCreditBal}}</td>
<td>{{exportData.debitBal}}</td>
<td>{{exportData.creditBal}}</td>
<td>{{exportData.endDebitBal}}</td>
<td>{{exportData.endCreditBal}}</td>
</tr>
</table>
</div>
......
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