Commit b099a0aa authored by eddie.woo's avatar eddie.woo

modify

parent 22f66510
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
......@@ -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());
......
......@@ -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