Commit 6026c0e1 authored by neo's avatar neo

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

parents c05f0e54 a5209be3
package pwc.taxtech.atms.common.util;
import pwc.taxtech.atms.constant.Constant;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
......@@ -540,16 +542,36 @@ public class DateUtils {
return sdf.format(calendar.getTime());
}
public static String getPeriodBeginFormat(int year, int period, String format) {
SimpleDateFormat sdf = new SimpleDateFormat(format);
Calendar calendar = Calendar.getInstance();
calendar.set(year, period - 1, 1, 0, 0, 0);
return sdf.format(calendar.getTime());
}
public static String getPeriodBeginFormat(int year, int period) {
return getPeriodBeginFormat(year, period, Constant.DateFormat.DEFAULT);
}
public static String getPeriodEnd(int year, int period) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return getPeriodEndFormat(year, period, Constant.DateFormat.YYYY_MM_DD_HH_MM_SS);
}
public static String getPeriodEndFormat(int year, int period, String format) {
SimpleDateFormat sdf = new SimpleDateFormat(format);
Calendar calendar = Calendar.getInstance();
if (period < 12)
calendar.set(year, period, -1, 23, 59, 59);
else if (period == 12)
if (period < 12) {
calendar.set(year, period, 1, 23, 59, 59);
calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 1);
} else if (period == 12)
calendar.set(year, period - 1, 31, 23, 59, 59);
return sdf.format(calendar.getTime());
}
public static String getPeriodEndFormat(int year, int period) {
return getPeriodEndFormat(year, period, Constant.DateFormat.DEFAULT);
}
// /***************************************************************************
// * //nd=1表示返回的值中包含年度 //yf=1表示返回的值中包含月份 //rq=1表示返回的值中包含日期 //format表示返回的格式 1
// * 以年月日中文返回 2 以横线-返回 // 3 以斜线/返回 4 以缩写不带其它符号形式返回 // 5 以点号.返回
......
......@@ -112,5 +112,6 @@ public final class Constant {
public static class DateFormat {
public static final String DEFAULT = "yyyy-MM-dd";
public static final String YEAR_MONTH = "yyyy-MM";
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
}
}
\ No newline at end of file
......@@ -6,8 +6,10 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.config.SystemConfig;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.StdAccountEnum;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dao.AccountMappingDao;
import pwc.taxtech.atms.dao.EnterpriseAccountSetOrgDao;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.StandardAccountMapper;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam;
import pwc.taxtech.atms.entity.*;
......@@ -97,17 +99,14 @@ public class DataImportService extends BaseService {
continue;
}
tmp.forEach(o -> {
if (StdAccountEnum.Direction.Credit.getCode().equals(standardAccount.getDirection())) {
dto.setCreditBal(add(dto.getCreditBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getPtdCr()));
dto.setBegCreditBal(add(dto.getBegCreditBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getBeginCrBalance()));
dto.setEndCreditBal(add(dto.getEndCreditBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getEndCrBalance()));
dto.setYearCreditBal(add(dto.getYearCreditBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getYtdCr()));
} else {
dto.setDebitBal(add(dto.getDebitBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getPtdDr()));
dto.setBegDebitBal(add(dto.getBegDebitBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getBeginDrBalance()));
dto.setEndDebitBal(add(dto.getEndDebitBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getEndDrBalance()));
dto.setYearDebitBal(add(dto.getYearDebitBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getYtdDr()));
}
dto.setCreditBal(add(dto.getCreditBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getPtdCr()));
dto.setBegCreditBal(add(dto.getBegCreditBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getBeginCrBalance()));
dto.setEndCreditBal(add(dto.getEndCreditBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getEndCrBalance()));
dto.setYearCreditBal(add(dto.getYearCreditBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getYtdCr()));
dto.setDebitBal(add(dto.getDebitBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getPtdDr()));
dto.setBegDebitBal(add(dto.getBegDebitBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getBeginDrBalance()));
dto.setEndDebitBal(add(dto.getEndDebitBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getEndDrBalance()));
dto.setYearDebitBal(add(dto.getYearDebitBal(), getGlBalance(o.getEnterpriseAccountCode(), sg3List, sg4List).getYtdDr()));
});
}
}
......@@ -124,13 +123,13 @@ public class DataImportService extends BaseService {
private GlBalance getGlBalance(String code, List<GlBalance> seg3, List<GlBalance> seg4) {
for (GlBalance balance : seg3) {
if (StringUtils.equals(code, balance.getAttr3())) {
if (StringUtils.equals(code, balance.getSegment3())) {
return balance;
}
}
for (GlBalance balance : seg4) {
if (StringUtils.equals(code, balance.getAttr3())) {
if (StringUtils.equals(code, balance.getSegment3())) {
return balance;
}
}
......
......@@ -72,9 +72,10 @@ public class LgGlBalanceService extends BaseService {
GlBalance glBalance = new GlBalance();
beanUtil.copyProperties(list.get(0), glBalance);
glBalance.setPeriodName(period);
GlBalanceExample example = new GlBalanceExample();
example.createCriteria().andSegment1EqualTo(glBalance.getSegment1()).andSegment3EqualTo(glBalance.getSegment3())
.andSegment4EqualTo(glBalance.getSegment4()).andPeriodNameEqualTo(glBalance.getPeriodName());
.andSegment4EqualTo(glBalance.getSegment4()).andPeriodNameEqualTo(period);
List<GlBalance> tmpList;
if ((tmpList = glBalanceMapper.selectByExample(example)).size() > 0) {
glBalance.setId(tmpList.get(0).getId());
......
......@@ -266,7 +266,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
cellTemplate.setIsReadOnly(cell.getCellStyle().getLocked());
cellTemplateList.add(cellTemplate);
//todo: 这里没有Config数据只有在上传模板以后,在界面里面可以配置公式
if (!cell.getCellStyle().getLocked() && hasKeyIn(cell)) {
if (!cell.getCellStyle().getLocked() && hasKeyIn(cell) && allowManual) {
cell.setCellValue(StringUtils.EMPTY);
addManualConfig(cellTemplate, template, cell, now, cellTemplateConfigList);
}
......@@ -402,7 +402,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
cellTemplate.setIsReadOnly(cell.getCellStyle().getLocked() ? true : false);
cellTemplateList.add(cellTemplate);
//todo: 这里没有Config数据只有在上传模板以后,在界面里面可以配置公式
if (!cell.getCellStyle().getLocked() && hasKeyIn(cell)) {
if (!cell.getCellStyle().getLocked() && hasKeyIn(cell) && allowManual) {
cell.setCellValue(StringUtils.EMPTY);
addManualConfig(cellTemplate, template, cell, now, cellTemplateConfigList);
}
......
......@@ -58,8 +58,8 @@ public class InputInvoiceDataImportServiceImpl {
Project project = projectMapper.selectByPrimaryKey(projectId);
Organization organization = organizationMapper.selectByPrimaryKey(project.getOrganizationId());
InputInvoiceExample invoiceExample = new InputInvoiceExample();
invoiceExample.createCriteria().andGFSHEqualTo(organization.getTaxPayerNumber()).andRZSJBetween(DateUtils.getPeriodBegin(
project.getYear(), paras.getPeriodStart()), DateUtils.getPeriodEnd(project.getYear(), paras.getPeriodEnd()))
invoiceExample.createCriteria().andGFSHEqualTo(organization.getTaxPayerNumber()).andRZSJBetween(DateUtils.getPeriodBeginFormat(
project.getYear(), paras.getPeriodStart()), DateUtils.getPeriodEndFormat(project.getYear(), paras.getPeriodEnd()))
.andRZJGEqualTo(INPUT_RZJG_SUCCESS).andRZZTEqualTo(INPUT_RZZT_OVER);
PageHelper.startPage(paras.getPageInfo().getPageIndex(), paras.getPageInfo().getPageSize());
......
......@@ -985,6 +985,7 @@ public class ReportServiceImpl {
dataSource.setUpdateTime(new Date());
periodDataSourceMapper.updateByPrimaryKeySelective(dataSource);
if (!cellData.getData().equals("#VALUE!")) {
if(StringUtils.isBlank(cellData.getData())) cellData.setData("0");
cellData.setData(new BigDecimal(cellData.getData()).add(changeValue).toString());
} else {
cellData.setData(new BigDecimal("0.0").add(changeValue).toString());
......
......@@ -172,7 +172,7 @@ public class DataInitTest extends CommonIT {
@Test
public void initOutput() throws Exception {
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入/导入模板_销项主表_乐叶_201807(1).xlsx"));
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入/导入模板_销项主表_绿能_201809(1).xlsx"));
Sheet sheet = workbook.getSheetAt(0);
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
try {
......
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