|
@@ -6,19 +6,17 @@ import com.malk.lanyun.service.NCService;
|
|
|
import com.malk.server.aliwork.YDConf;
|
|
|
import com.malk.server.aliwork.YDParam;
|
|
|
import com.malk.service.aliwork.YDClient;
|
|
|
-import com.malk.service.aliwork.YDService;
|
|
|
import com.malk.utils.UtilDateTime;
|
|
|
-import com.malk.utils.UtilMap;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.sql.*;
|
|
|
+import java.sql.Connection;
|
|
|
+import java.sql.DriverManager;
|
|
|
+import java.sql.ResultSet;
|
|
|
+import java.sql.Statement;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.time.temporal.TemporalAdjusters;
|
|
|
-import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -32,14 +30,14 @@ public class NCServiceImpl implements NCService {
|
|
|
@Autowired
|
|
|
private SqlServerBean sqlBean;
|
|
|
|
|
|
-
|
|
|
// 获取当前日期
|
|
|
- LocalDate today = LocalDate.now();
|
|
|
+ LocalDate lastMonth = LocalDate.now().minusMonths(1);
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
@Override
|
|
|
public void getNcInfo() {
|
|
|
- // 获取当前年
|
|
|
- int year = today.getYear();
|
|
|
+ // 获取上月年,月
|
|
|
+ int year = lastMonth.getYear();
|
|
|
+ int month = lastMonth.getMonthValue();
|
|
|
|
|
|
Connection connection = null;
|
|
|
Statement statement = null;
|
|
@@ -54,7 +52,7 @@ public class NCServiceImpl implements NCService {
|
|
|
|
|
|
// 执行查询
|
|
|
String sql = "SELECT b.adjustperiod AS adjustperiod, b.pk_accasoa AS pk_accasoa, a.name AS accasoa_name, SUM ( b.creditamount ) AS creditamount\n" +
|
|
|
- " FROM gl_detail b JOIN bd_accasoa a ON b.pk_accasoa = a.pk_accasoa WHERE b.yearv = "+year+"\n" +
|
|
|
+ " FROM gl_detail b JOIN bd_accasoa a ON b.pk_accasoa = a.pk_accasoa WHERE b.yearv = "+year+"\n AND b.adjustperiod = "+ month +
|
|
|
" AND b.accountcode IN ( '50010101', '500102', '500103', '500117', '500114', '500115', '500118', '500119', '500109', '500133' )\n" +
|
|
|
" AND b.pk_accountingbook IN ( SELECT pk_accountingbook FROM org_accountingbook WHERE code IN ( 'A01-0004', 'A02-0004', 'A03-0004', 'A04-0004', 'A05-0004', 'A06-0004', 'A10-0004', 'A11-0004' ) )\n" +
|
|
|
" GROUP BY b.adjustperiod, b.pk_accasoa, a.name";
|
|
@@ -103,7 +101,8 @@ public class NCServiceImpl implements NCService {
|
|
|
@Override
|
|
|
public void getNcCgInfo() {
|
|
|
// 获取当前年
|
|
|
- int year = today.getYear();
|
|
|
+ int year = lastMonth.getYear();
|
|
|
+ int month = lastMonth.getMonthValue();
|
|
|
|
|
|
Connection connection = null;
|
|
|
Statement statement = null;
|
|
@@ -119,7 +118,8 @@ public class NCServiceImpl implements NCService {
|
|
|
|
|
|
// 测试sql 执行查询
|
|
|
String sql = "SELECT b.adjustperiod AS adjustperiod, b.pk_accasoa AS pk_accasoa,a.name AS accasoa_name, SUM ( b.creditamount ) AS creditamount\n" +
|
|
|
- " FROM gl_detail b JOIN bd_accasoa a ON b.pk_accasoa = a.pk_accasoa WHERE b.yearv = "+year+" AND b.accountcode IN ( '500114', '500115' )\n" +
|
|
|
+ " FROM gl_detail b JOIN bd_accasoa a ON b.pk_accasoa = a.pk_accasoa WHERE b.yearv = "+year+" AND b.adjustperiod = "+ month +
|
|
|
+ " AND b.accountcode IN ( '500114', '500115' )\n" +
|
|
|
" AND b.pk_accountingbook IN ( SELECT pk_accountingbook FROM org_accountingbook WHERE code IN ( 'A01-0004', 'A02-0004', 'A03-0004', 'A04-0004', 'A05-0004', 'A06-0004', 'A10-0004', 'A11-0004' ))\n" +
|
|
|
" GROUP BY b.adjustperiod, b.pk_accasoa, a.name";
|
|
|
|
|
@@ -170,7 +170,8 @@ public class NCServiceImpl implements NCService {
|
|
|
@Override
|
|
|
public void getNcCost() {
|
|
|
// 获取当前年
|
|
|
- int year = today.getYear();
|
|
|
+ int year = lastMonth.getYear();
|
|
|
+ int month = lastMonth.getMonthValue();
|
|
|
|
|
|
Connection connection = null;
|
|
|
Statement statement = null;
|
|
@@ -186,7 +187,8 @@ public class NCServiceImpl implements NCService {
|
|
|
|
|
|
// 测试sql 执行查询
|
|
|
String sql = "SELECT b.adjustperiod AS adjustperiod, b.pk_accasoa AS pk_accasoa,a.name AS accasoa_name, SUM ( b.creditamount ) AS creditamount\n" +
|
|
|
- " FROM gl_detail b JOIN bd_accasoa a ON b.pk_accasoa = a.pk_accasoa WHERE b.yearv = "+year+" AND b.accountcode IN ( '500114', '500115' )\n" +
|
|
|
+ " FROM gl_detail b JOIN bd_accasoa a ON b.pk_accasoa = a.pk_accasoa WHERE b.yearv = "+year+" AND b.adjustperiod = "+ month +
|
|
|
+ " AND b.accountcode IN ( '500114', '500115' )\n" +
|
|
|
" AND b.pk_accountingbook IN ( SELECT pk_accountingbook FROM org_accountingbook WHERE code IN ( 'A01-0004', 'A02-0004', 'A03-0004', 'A04-0004', 'A05-0004', 'A06-0004', 'A10-0004', 'A11-0004' ))\n" +
|
|
|
" GROUP BY b.adjustperiod, b.pk_accasoa, a.name";
|
|
|
|
|
@@ -235,7 +237,8 @@ public class NCServiceImpl implements NCService {
|
|
|
@Override
|
|
|
public void getNcCollection() {
|
|
|
// 获取当前年
|
|
|
- int year = today.getYear();
|
|
|
+ int year = lastMonth.getYear();
|
|
|
+ int month = lastMonth.getMonthValue();
|
|
|
|
|
|
Connection connection = null;
|
|
|
Statement statement = null;
|
|
@@ -251,7 +254,8 @@ public class NCServiceImpl implements NCService {
|
|
|
|
|
|
// 测试sql 执行查询
|
|
|
String sql = "SELECT b.adjustperiod AS adjustperiod, b.pk_accasoa AS pk_accasoa,a.name AS accasoa_name, SUM ( b.creditamount ) AS creditamount\n" +
|
|
|
- " FROM gl_detail b JOIN bd_accasoa a ON b.pk_accasoa = a.pk_accasoa WHERE b.yearv = "+year+" AND b.accountcode like '6602%' " +
|
|
|
+ " FROM gl_detail b JOIN bd_accasoa a ON b.pk_accasoa = a.pk_accasoa WHERE b.yearv = "+year+" AND b.adjustperiod = "+ month +
|
|
|
+ " AND b.accountcode like '6602%' " +
|
|
|
" AND b.pk_accountingbook IN ( SELECT pk_accountingbook FROM org_accountingbook WHERE code IN ( 'A01-0004', 'A02-0004', 'A03-0004', 'A04-0004', 'A05-0004', 'A06-0004', 'A10-0004', 'A11-0004' ))\n" +
|
|
|
" GROUP BY b.adjustperiod, b.pk_accasoa, a.name";
|
|
|
|
|
@@ -300,7 +304,9 @@ public class NCServiceImpl implements NCService {
|
|
|
@Override
|
|
|
public void getSupplierPay() {
|
|
|
// 获取当前年
|
|
|
- int year = today.getYear();
|
|
|
+ int year = lastMonth.getYear();
|
|
|
+ int month = lastMonth.getMonthValue();
|
|
|
+
|
|
|
LocalDate firstDayOfYear = LocalDate.of(year, 1, 1);
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
String formattedBeginDate = firstDayOfYear.format(formatter);
|