feat(data): 更新公司记录计数服务并优化导入功能
- 在多个控制器中引入 CreditCompanyRecordCountService 依赖注入 - 添加 HashSet 和 Set 类型导入以支持公司ID集合操作 - 在Excel导入过程中跟踪受影响的公司ID集合 - 实现导入完成后批量刷新公司记录计数的功能 - 扩展 CreditCompany 实体类添加各类信用记录计数字段 - 优化导入逻辑确保公司记录计数实时更新
This commit is contained in:
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditAdministrativeLicense;
|
|||||||
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseImportParam;
|
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam;
|
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditAdministrativeLicenseService;
|
import com.gxwebsoft.credit.service.CreditAdministrativeLicenseService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,9 +24,11 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 行政许可控制器
|
* 行政许可控制器
|
||||||
@@ -46,6 +49,9 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询行政许可")
|
@Operation(summary = "分页查询行政许可")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditAdministrativeLicense>> page(CreditAdministrativeLicenseParam param) {
|
public ApiResult<PageResult<CreditAdministrativeLicense>> page(CreditAdministrativeLicenseParam param) {
|
||||||
@@ -187,6 +193,7 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExcelImportSupport.ImportResult<CreditAdministrativeLicenseImportParam> importResult = ExcelImportSupport.readAnySheet(
|
ExcelImportSupport.ImportResult<CreditAdministrativeLicenseImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||||
@@ -229,6 +236,9 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
}
|
}
|
||||||
@@ -251,6 +261,10 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -355,6 +369,8 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.ADMINISTRATIVE_LICENSE, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
@@ -377,6 +393,7 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史行政许可");
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史行政许可");
|
||||||
@@ -590,6 +607,8 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.ADMINISTRATIVE_LICENSE, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditBankruptcy;
|
|||||||
import com.gxwebsoft.credit.param.CreditBankruptcyImportParam;
|
import com.gxwebsoft.credit.param.CreditBankruptcyImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditBankruptcyParam;
|
import com.gxwebsoft.credit.param.CreditBankruptcyParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditBankruptcyService;
|
import com.gxwebsoft.credit.service.CreditBankruptcyService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,9 +24,11 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 破产重整控制器
|
* 破产重整控制器
|
||||||
@@ -46,6 +49,9 @@ public class CreditBankruptcyController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询破产重整")
|
@Operation(summary = "分页查询破产重整")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditBankruptcy>> page(CreditBankruptcyParam param) {
|
public ApiResult<PageResult<CreditBankruptcy>> page(CreditBankruptcyParam param) {
|
||||||
@@ -187,6 +193,7 @@ public class CreditBankruptcyController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExcelImportSupport.ImportResult<CreditBankruptcyImportParam> importResult = ExcelImportSupport.readAnySheet(
|
ExcelImportSupport.ImportResult<CreditBankruptcyImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||||
@@ -224,6 +231,9 @@ public class CreditBankruptcyController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
}
|
}
|
||||||
@@ -246,6 +256,10 @@ public class CreditBankruptcyController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -330,6 +344,8 @@ public class CreditBankruptcyController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BANKRUPTCY, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
@@ -352,6 +368,7 @@ public class CreditBankruptcyController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史破产重整");
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史破产重整");
|
||||||
@@ -531,6 +548,8 @@ public class CreditBankruptcyController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BANKRUPTCY, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditBranch;
|
|||||||
import com.gxwebsoft.credit.param.CreditBranchImportParam;
|
import com.gxwebsoft.credit.param.CreditBranchImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditBranchParam;
|
import com.gxwebsoft.credit.param.CreditBranchParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditBranchService;
|
import com.gxwebsoft.credit.service.CreditBranchService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分支机构控制器
|
* 分支机构控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditBranchController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询分支机构")
|
@Operation(summary = "分页查询分支机构")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditBranch>> page(CreditBranchParam param) {
|
public ApiResult<PageResult<CreditBranch>> page(CreditBranchParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditBranchController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExcelImportSupport.ImportResult<CreditBranchImportParam> importResult = ExcelImportSupport.readAnySheet(
|
ExcelImportSupport.ImportResult<CreditBranchImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||||
@@ -245,6 +252,10 @@ public class CreditBranchController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -329,6 +340,8 @@ public class CreditBranchController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BRANCH, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditBreachOfTrust;
|
|||||||
import com.gxwebsoft.credit.param.CreditBreachOfTrustImportParam;
|
import com.gxwebsoft.credit.param.CreditBreachOfTrustImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditBreachOfTrustParam;
|
import com.gxwebsoft.credit.param.CreditBreachOfTrustParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditBreachOfTrustService;
|
import com.gxwebsoft.credit.service.CreditBreachOfTrustService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -24,9 +25,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 失信被执行人控制器
|
* 失信被执行人控制器
|
||||||
@@ -47,6 +50,9 @@ public class CreditBreachOfTrustController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询失信被执行人")
|
@Operation(summary = "分页查询失信被执行人")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditBreachOfTrust>> page(CreditBreachOfTrustParam param) {
|
public ApiResult<PageResult<CreditBreachOfTrust>> page(CreditBreachOfTrustParam param) {
|
||||||
@@ -183,6 +189,7 @@ public class CreditBreachOfTrustController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "失信被执行人", 0);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "失信被执行人", 0);
|
||||||
@@ -221,6 +228,9 @@ public class CreditBreachOfTrustController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
}
|
}
|
||||||
@@ -243,6 +253,10 @@ public class CreditBreachOfTrustController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -327,6 +341,8 @@ public class CreditBreachOfTrustController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BREACH_OF_TRUST, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
@@ -349,6 +365,7 @@ public class CreditBreachOfTrustController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史失信被执行人");
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史失信被执行人");
|
||||||
@@ -529,6 +546,8 @@ public class CreditBreachOfTrustController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BREACH_OF_TRUST, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditCaseFiling;
|
|||||||
import com.gxwebsoft.credit.param.CreditCaseFilingImportParam;
|
import com.gxwebsoft.credit.param.CreditCaseFilingImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditCaseFilingParam;
|
import com.gxwebsoft.credit.param.CreditCaseFilingParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditCaseFilingService;
|
import com.gxwebsoft.credit.service.CreditCaseFilingService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 司法大数据控制器
|
* 司法大数据控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询司法大数据")
|
@Operation(summary = "分页查询司法大数据")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditCaseFiling>> page(CreditCaseFilingParam param) {
|
public ApiResult<PageResult<CreditCaseFiling>> page(CreditCaseFilingParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "立案信息", 0);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "立案信息", 0);
|
||||||
@@ -247,6 +254,10 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -331,6 +342,8 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.CASE_FILING, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditCompetitor;
|
|||||||
import com.gxwebsoft.credit.param.CreditCompetitorImportParam;
|
import com.gxwebsoft.credit.param.CreditCompetitorImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditCompetitorParam;
|
import com.gxwebsoft.credit.param.CreditCompetitorParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditCompetitorService;
|
import com.gxwebsoft.credit.service.CreditCompetitorService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 竞争对手控制器
|
* 竞争对手控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询竞争对手")
|
@Operation(summary = "分页查询竞争对手")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditCompetitor>> page(CreditCompetitorParam param) {
|
public ApiResult<PageResult<CreditCompetitor>> page(CreditCompetitorParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "竞争对手", 2);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "竞争对手", 2);
|
||||||
@@ -248,6 +255,10 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -332,6 +343,8 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COMPETITOR, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditCourtAnnouncement;
|
|||||||
import com.gxwebsoft.credit.param.CreditCourtAnnouncementImportParam;
|
import com.gxwebsoft.credit.param.CreditCourtAnnouncementImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam;
|
import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditCourtAnnouncementService;
|
import com.gxwebsoft.credit.service.CreditCourtAnnouncementService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 法院公告司法大数据控制器
|
* 法院公告司法大数据控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditCourtAnnouncementController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询法院公告司法大数据")
|
@Operation(summary = "分页查询法院公告司法大数据")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditCourtAnnouncement>> page(CreditCourtAnnouncementParam param) {
|
public ApiResult<PageResult<CreditCourtAnnouncement>> page(CreditCourtAnnouncementParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditCourtAnnouncementController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 兼容多 sheet 文件:优先定位“法院公告”sheet,否则默认第 0 个。
|
// 兼容多 sheet 文件:优先定位“法院公告”sheet,否则默认第 0 个。
|
||||||
@@ -247,6 +254,10 @@ public class CreditCourtAnnouncementController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -331,6 +342,8 @@ public class CreditCourtAnnouncementController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_ANNOUNCEMENT, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditCourtSession;
|
|||||||
import com.gxwebsoft.credit.param.CreditCourtSessionImportParam;
|
import com.gxwebsoft.credit.param.CreditCourtSessionImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditCourtSessionParam;
|
import com.gxwebsoft.credit.param.CreditCourtSessionParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditCourtSessionService;
|
import com.gxwebsoft.credit.service.CreditCourtSessionService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,9 +24,11 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开庭公告司法大数据控制器
|
* 开庭公告司法大数据控制器
|
||||||
@@ -46,6 +49,9 @@ public class CreditCourtSessionController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询开庭公告司法大数据")
|
@Operation(summary = "分页查询开庭公告司法大数据")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditCourtSession>> page(CreditCourtSessionParam param) {
|
public ApiResult<PageResult<CreditCourtSession>> page(CreditCourtSessionParam param) {
|
||||||
@@ -187,6 +193,7 @@ public class CreditCourtSessionController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 兼容多 sheet 文件:优先定位“开庭公告”sheet,否则默认第 0 个。
|
// 兼容多 sheet 文件:优先定位“开庭公告”sheet,否则默认第 0 个。
|
||||||
@@ -226,6 +233,9 @@ public class CreditCourtSessionController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
}
|
}
|
||||||
@@ -248,6 +258,10 @@ public class CreditCourtSessionController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -332,6 +346,8 @@ public class CreditCourtSessionController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_SESSION, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
@@ -354,6 +370,7 @@ public class CreditCourtSessionController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史开庭公告");
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史开庭公告");
|
||||||
@@ -533,6 +550,8 @@ public class CreditCourtSessionController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_SESSION, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditCustomer;
|
|||||||
import com.gxwebsoft.credit.param.CreditCustomerImportParam;
|
import com.gxwebsoft.credit.param.CreditCustomerImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditCustomerParam;
|
import com.gxwebsoft.credit.param.CreditCustomerParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditCustomerService;
|
import com.gxwebsoft.credit.service.CreditCustomerService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -24,8 +25,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户控制器
|
* 客户控制器
|
||||||
@@ -46,6 +49,9 @@ public class CreditCustomerController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询客户")
|
@Operation(summary = "分页查询客户")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditCustomer>> page(CreditCustomerParam param) {
|
public ApiResult<PageResult<CreditCustomer>> page(CreditCustomerParam param) {
|
||||||
@@ -182,6 +188,7 @@ public class CreditCustomerController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "客户", 4);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "客户", 4);
|
||||||
@@ -242,6 +249,10 @@ public class CreditCustomerController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -475,6 +486,8 @@ public class CreditCustomerController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.CUSTOMER, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditDeliveryNotice;
|
|||||||
import com.gxwebsoft.credit.param.CreditDeliveryNoticeImportParam;
|
import com.gxwebsoft.credit.param.CreditDeliveryNoticeImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam;
|
import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditDeliveryNoticeService;
|
import com.gxwebsoft.credit.service.CreditDeliveryNoticeService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 送达公告司法大数据控制器
|
* 送达公告司法大数据控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditDeliveryNoticeController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询送达公告司法大数据")
|
@Operation(summary = "分页查询送达公告司法大数据")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditDeliveryNotice>> page(CreditDeliveryNoticeParam param) {
|
public ApiResult<PageResult<CreditDeliveryNotice>> page(CreditDeliveryNoticeParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditDeliveryNoticeController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "送达公告", 0);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "送达公告", 0);
|
||||||
@@ -248,6 +255,10 @@ public class CreditDeliveryNoticeController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -332,6 +343,8 @@ public class CreditDeliveryNoticeController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.DELIVERY_NOTICE, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditExternal;
|
|||||||
import com.gxwebsoft.credit.param.CreditExternalImportParam;
|
import com.gxwebsoft.credit.param.CreditExternalImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditExternalParam;
|
import com.gxwebsoft.credit.param.CreditExternalParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditExternalService;
|
import com.gxwebsoft.credit.service.CreditExternalService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对外投资控制器
|
* 对外投资控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditExternalController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询对外投资")
|
@Operation(summary = "分页查询对外投资")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditExternal>> page(CreditExternalParam param) {
|
public ApiResult<PageResult<CreditExternal>> page(CreditExternalParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditExternalController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "对外投资", 0);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "对外投资", 0);
|
||||||
@@ -246,6 +253,10 @@ public class CreditExternalController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -330,6 +341,8 @@ public class CreditExternalController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.EXTERNAL, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditFinalVersion;
|
|||||||
import com.gxwebsoft.credit.param.CreditFinalVersionImportParam;
|
import com.gxwebsoft.credit.param.CreditFinalVersionImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditFinalVersionParam;
|
import com.gxwebsoft.credit.param.CreditFinalVersionParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditFinalVersionService;
|
import com.gxwebsoft.credit.service.CreditFinalVersionService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,9 +24,11 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 终本案件控制器
|
* 终本案件控制器
|
||||||
@@ -46,6 +49,9 @@ public class CreditFinalVersionController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询终本案件")
|
@Operation(summary = "分页查询终本案件")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditFinalVersion>> page(CreditFinalVersionParam param) {
|
public ApiResult<PageResult<CreditFinalVersion>> page(CreditFinalVersionParam param) {
|
||||||
@@ -187,6 +193,7 @@ public class CreditFinalVersionController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 按选项卡名称读取(客户提供的文件可能不是把目标 sheet 放在第一个)
|
// 按选项卡名称读取(客户提供的文件可能不是把目标 sheet 放在第一个)
|
||||||
@@ -226,6 +233,9 @@ public class CreditFinalVersionController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
}
|
}
|
||||||
@@ -248,6 +258,10 @@ public class CreditFinalVersionController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -332,6 +346,8 @@ public class CreditFinalVersionController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.FINAL_VERSION, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
@@ -354,6 +370,7 @@ public class CreditFinalVersionController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史终本案件");
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史终本案件");
|
||||||
@@ -533,6 +550,8 @@ public class CreditFinalVersionController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.FINAL_VERSION, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditGqdj;
|
|||||||
import com.gxwebsoft.credit.param.CreditGqdjImportParam;
|
import com.gxwebsoft.credit.param.CreditGqdjImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditGqdjParam;
|
import com.gxwebsoft.credit.param.CreditGqdjParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditGqdjService;
|
import com.gxwebsoft.credit.service.CreditGqdjService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,9 +24,11 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 股权冻结控制器
|
* 股权冻结控制器
|
||||||
@@ -46,6 +49,9 @@ public class CreditGqdjController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询股权冻结")
|
@Operation(summary = "分页查询股权冻结")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditGqdj>> page(CreditGqdjParam param) {
|
public ApiResult<PageResult<CreditGqdj>> page(CreditGqdjParam param) {
|
||||||
@@ -187,6 +193,7 @@ public class CreditGqdjController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "股权冻结", 0);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "股权冻结", 0);
|
||||||
@@ -247,6 +254,9 @@ public class CreditGqdjController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
}
|
}
|
||||||
@@ -269,6 +279,10 @@ public class CreditGqdjController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -353,6 +367,8 @@ public class CreditGqdjController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.GQDJ, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
@@ -375,6 +391,7 @@ public class CreditGqdjController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史股权冻结");
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史股权冻结");
|
||||||
@@ -575,6 +592,8 @@ public class CreditGqdjController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.GQDJ, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson;
|
|||||||
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonImportParam;
|
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam;
|
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditHistoricalLegalPersonService;
|
import com.gxwebsoft.credit.service.CreditHistoricalLegalPersonService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 历史法定代表人控制器
|
* 历史法定代表人控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询历史法定代表人")
|
@Operation(summary = "分页查询历史法定代表人")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditHistoricalLegalPerson>> page(CreditHistoricalLegalPersonParam param) {
|
public ApiResult<PageResult<CreditHistoricalLegalPerson>> page(CreditHistoricalLegalPersonParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExcelImportSupport.ImportResult<CreditHistoricalLegalPersonImportParam> importResult = ExcelImportSupport.readAnySheet(
|
ExcelImportSupport.ImportResult<CreditHistoricalLegalPersonImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||||
@@ -245,6 +252,10 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -424,6 +435,8 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.HISTORICAL_LEGAL_PERSON, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditJudgmentDebtor;
|
|||||||
import com.gxwebsoft.credit.param.CreditJudgmentDebtorImportParam;
|
import com.gxwebsoft.credit.param.CreditJudgmentDebtorImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam;
|
import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditJudgmentDebtorService;
|
import com.gxwebsoft.credit.service.CreditJudgmentDebtorService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -30,9 +31,11 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
@@ -55,6 +58,9 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询被执行人")
|
@Operation(summary = "分页查询被执行人")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditJudgmentDebtor>> page(CreditJudgmentDebtorParam param) {
|
public ApiResult<PageResult<CreditJudgmentDebtor>> page(CreditJudgmentDebtorParam param) {
|
||||||
@@ -209,6 +215,9 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
if (!outcome.anyDataRead) {
|
if (!outcome.anyDataRead) {
|
||||||
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDGMENT_DEBTOR, outcome.touchedCompanyIds);
|
||||||
|
|
||||||
if (outcome.errorMessages.isEmpty()) {
|
if (outcome.errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + outcome.successCount + "条数据", null);
|
return success("成功导入" + outcome.successCount + "条数据", null);
|
||||||
}
|
}
|
||||||
@@ -243,6 +252,9 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
if (!outcome.anyDataRead) {
|
if (!outcome.anyDataRead) {
|
||||||
return fail("未读取到数据,请确认文件中存在“历史被执行人”选项卡且表头与示例格式一致", null);
|
return fail("未读取到数据,请确认文件中存在“历史被执行人”选项卡且表头与示例格式一致", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDGMENT_DEBTOR, outcome.touchedCompanyIds);
|
||||||
|
|
||||||
if (outcome.errorMessages.isEmpty()) {
|
if (outcome.errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + outcome.successCount + "条数据", null);
|
return success("成功导入" + outcome.successCount + "条数据", null);
|
||||||
}
|
}
|
||||||
@@ -331,17 +343,20 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
private final boolean anyDataRead;
|
private final boolean anyDataRead;
|
||||||
private final int successCount;
|
private final int successCount;
|
||||||
private final List<String> errorMessages;
|
private final List<String> errorMessages;
|
||||||
|
private final Set<Integer> touchedCompanyIds;
|
||||||
|
|
||||||
private ImportOutcome(boolean anyDataRead, int successCount, List<String> errorMessages) {
|
private ImportOutcome(boolean anyDataRead, int successCount, List<String> errorMessages, Set<Integer> touchedCompanyIds) {
|
||||||
this.anyDataRead = anyDataRead;
|
this.anyDataRead = anyDataRead;
|
||||||
this.successCount = successCount;
|
this.successCount = successCount;
|
||||||
this.errorMessages = errorMessages;
|
this.errorMessages = errorMessages;
|
||||||
|
this.touchedCompanyIds = touchedCompanyIds != null ? touchedCompanyIds : new HashSet<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImportOutcome importFromExcel(MultipartFile excelFile, String fileLabel, Integer currentUserId, Integer currentTenantId, Integer companyId, boolean strictDebtorSheet) throws Exception {
|
private ImportOutcome importFromExcel(MultipartFile excelFile, String fileLabel, Integer currentUserId, Integer currentTenantId, Integer companyId, boolean strictDebtorSheet) throws Exception {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
ExcelImportSupport.ImportResult<CreditJudgmentDebtorImportParam> importResult = readDebtorImport(excelFile, strictDebtorSheet);
|
ExcelImportSupport.ImportResult<CreditJudgmentDebtorImportParam> importResult = readDebtorImport(excelFile, strictDebtorSheet);
|
||||||
List<CreditJudgmentDebtorImportParam> list = importResult.getData();
|
List<CreditJudgmentDebtorImportParam> list = importResult.getData();
|
||||||
@@ -350,7 +365,7 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
int usedSheetIndex = importResult.getSheetIndex();
|
int usedSheetIndex = importResult.getSheetIndex();
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
return new ImportOutcome(false, 0, errorMessages);
|
return new ImportOutcome(false, 0, errorMessages, touchedCompanyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "案号");
|
Map<String, String> urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "案号");
|
||||||
@@ -383,6 +398,9 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
}
|
}
|
||||||
@@ -404,6 +422,10 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -420,16 +442,17 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
if (!chunkItems.isEmpty()) {
|
if (!chunkItems.isEmpty()) {
|
||||||
successCount += persistImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages);
|
successCount += persistImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages);
|
||||||
}
|
}
|
||||||
return new ImportOutcome(true, successCount, errorMessages);
|
return new ImportOutcome(true, successCount, errorMessages, touchedCompanyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImportOutcome importHistoryFromExcel(MultipartFile excelFile, String fileLabel, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception {
|
private ImportOutcome importHistoryFromExcel(MultipartFile excelFile, String fileLabel, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
int historySheetIndex = ExcelImportSupport.findSheetIndex(excelFile, "历史被执行人");
|
int historySheetIndex = ExcelImportSupport.findSheetIndex(excelFile, "历史被执行人");
|
||||||
if (historySheetIndex < 0) {
|
if (historySheetIndex < 0) {
|
||||||
return new ImportOutcome(false, 0, errorMessages);
|
return new ImportOutcome(false, 0, errorMessages, touchedCompanyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExcelImportSupport.ImportResult<CreditJudgmentDebtorImportParam> importResult = ExcelImportSupport.readBest(
|
ExcelImportSupport.ImportResult<CreditJudgmentDebtorImportParam> importResult = ExcelImportSupport.readBest(
|
||||||
@@ -446,7 +469,7 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
int usedSheetIndex = importResult.getSheetIndex();
|
int usedSheetIndex = importResult.getSheetIndex();
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
return new ImportOutcome(false, 0, errorMessages);
|
return new ImportOutcome(false, 0, errorMessages, touchedCompanyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "案号");
|
Map<String, String> urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "案号");
|
||||||
@@ -512,7 +535,7 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (latestByCaseNumber.isEmpty()) {
|
if (latestByCaseNumber.isEmpty()) {
|
||||||
return new ImportOutcome(true, 0, errorMessages);
|
return new ImportOutcome(true, 0, errorMessages, touchedCompanyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int chunkSize = 500;
|
final int chunkSize = 500;
|
||||||
@@ -536,7 +559,7 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
successCount += persistHistoryImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages);
|
successCount += persistHistoryImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ImportOutcome(true, successCount, errorMessages);
|
return new ImportOutcome(true, successCount, errorMessages, touchedCompanyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int persistHistoryImportChunk(List<CreditJudgmentDebtor> items,
|
private int persistHistoryImportChunk(List<CreditJudgmentDebtor> items,
|
||||||
@@ -708,6 +731,7 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
boolean anyDataRead = false;
|
boolean anyDataRead = false;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try (InputStream is = zipFile.getInputStream(); ZipInputStream zis = new ZipInputStream(is, charset)) {
|
try (InputStream is = zipFile.getInputStream(); ZipInputStream zis = new ZipInputStream(is, charset)) {
|
||||||
ZipEntry entry;
|
ZipEntry entry;
|
||||||
@@ -730,13 +754,14 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
anyDataRead = true;
|
anyDataRead = true;
|
||||||
successCount += outcome.successCount;
|
successCount += outcome.successCount;
|
||||||
errorMessages.addAll(outcome.errorMessages);
|
errorMessages.addAll(outcome.errorMessages);
|
||||||
|
touchedCompanyIds.addAll(outcome.touchedCompanyIds);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errorMessages.add("【" + entryFileName + "】解析失败:" + e.getMessage());
|
errorMessages.add("【" + entryFileName + "】解析失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ImportOutcome(anyDataRead, successCount, errorMessages);
|
return new ImportOutcome(anyDataRead, successCount, errorMessages, touchedCompanyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImportOutcome importHistoryFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception {
|
private ImportOutcome importHistoryFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception {
|
||||||
@@ -751,6 +776,7 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
boolean anyDataRead = false;
|
boolean anyDataRead = false;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try (InputStream is = zipFile.getInputStream(); ZipInputStream zis = new ZipInputStream(is, charset)) {
|
try (InputStream is = zipFile.getInputStream(); ZipInputStream zis = new ZipInputStream(is, charset)) {
|
||||||
ZipEntry entry;
|
ZipEntry entry;
|
||||||
@@ -773,13 +799,14 @@ public class CreditJudgmentDebtorController extends BaseController {
|
|||||||
anyDataRead = true;
|
anyDataRead = true;
|
||||||
successCount += outcome.successCount;
|
successCount += outcome.successCount;
|
||||||
errorMessages.addAll(outcome.errorMessages);
|
errorMessages.addAll(outcome.errorMessages);
|
||||||
|
touchedCompanyIds.addAll(outcome.touchedCompanyIds);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errorMessages.add("【" + entryFileName + "】解析失败:" + e.getMessage());
|
errorMessages.add("【" + entryFileName + "】解析失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ImportOutcome(anyDataRead, successCount, errorMessages);
|
return new ImportOutcome(anyDataRead, successCount, errorMessages, touchedCompanyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isZip(MultipartFile file) {
|
private static boolean isZip(MultipartFile file) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditJudicialDocument;
|
|||||||
import com.gxwebsoft.credit.param.CreditJudicialDocumentImportParam;
|
import com.gxwebsoft.credit.param.CreditJudicialDocumentImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditJudicialDocumentParam;
|
import com.gxwebsoft.credit.param.CreditJudicialDocumentParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditJudicialDocumentService;
|
import com.gxwebsoft.credit.service.CreditJudicialDocumentService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,9 +24,11 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 裁判文书司法大数据控制器
|
* 裁判文书司法大数据控制器
|
||||||
@@ -46,6 +49,9 @@ public class CreditJudicialDocumentController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询裁判文书司法大数据")
|
@Operation(summary = "分页查询裁判文书司法大数据")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditJudicialDocument>> page(CreditJudicialDocumentParam param) {
|
public ApiResult<PageResult<CreditJudicialDocument>> page(CreditJudicialDocumentParam param) {
|
||||||
@@ -187,6 +193,7 @@ public class CreditJudicialDocumentController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 支持按选项卡名称导入:默认读取“裁判文书”sheet(不存在则回退到第 0 个sheet)
|
// 支持按选项卡名称导入:默认读取“裁判文书”sheet(不存在则回退到第 0 个sheet)
|
||||||
@@ -231,6 +238,9 @@ public class CreditJudicialDocumentController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
}
|
}
|
||||||
@@ -253,6 +263,10 @@ public class CreditJudicialDocumentController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -337,6 +351,8 @@ public class CreditJudicialDocumentController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDICIAL_DOCUMENT, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
@@ -359,6 +375,7 @@ public class CreditJudicialDocumentController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史裁判文书");
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史裁判文书");
|
||||||
@@ -545,6 +562,8 @@ public class CreditJudicialDocumentController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDICIAL_DOCUMENT, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.gxwebsoft.credit.entity.CreditJudiciary;
|
|||||||
import com.gxwebsoft.credit.param.CreditJudiciaryImportParam;
|
import com.gxwebsoft.credit.param.CreditJudiciaryImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditJudiciaryParam;
|
import com.gxwebsoft.credit.param.CreditJudiciaryParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditJudiciaryService;
|
import com.gxwebsoft.credit.service.CreditJudiciaryService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -27,8 +28,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 司法案件控制器
|
* 司法案件控制器
|
||||||
@@ -49,6 +52,9 @@ public class CreditJudiciaryController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询司法案件")
|
@Operation(summary = "分页查询司法案件")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditJudiciary>> page(CreditJudiciaryParam param) {
|
public ApiResult<PageResult<CreditJudiciary>> page(CreditJudiciaryParam param) {
|
||||||
@@ -185,6 +191,7 @@ public class CreditJudiciaryController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 支持按选项卡名称导入:默认读取“司法案件”sheet(不存在则回退到第 0 个sheet)
|
// 支持按选项卡名称导入:默认读取“司法案件”sheet(不存在则回退到第 0 个sheet)
|
||||||
@@ -283,6 +290,10 @@ public class CreditJudiciaryController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -361,6 +372,8 @@ public class CreditJudiciaryController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDICIARY, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditMediation;
|
|||||||
import com.gxwebsoft.credit.param.CreditMediationImportParam;
|
import com.gxwebsoft.credit.param.CreditMediationImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditMediationParam;
|
import com.gxwebsoft.credit.param.CreditMediationParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditMediationService;
|
import com.gxwebsoft.credit.service.CreditMediationService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 诉前调解司法大数据控制器
|
* 诉前调解司法大数据控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditMediationController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询诉前调解司法大数据")
|
@Operation(summary = "分页查询诉前调解司法大数据")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditMediation>> page(CreditMediationParam param) {
|
public ApiResult<PageResult<CreditMediation>> page(CreditMediationParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditMediationController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "诉前调解", 0);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "诉前调解", 0);
|
||||||
@@ -246,6 +253,10 @@ public class CreditMediationController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -330,6 +341,8 @@ public class CreditMediationController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.MEDIATION, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditNearbyCompany;
|
|||||||
import com.gxwebsoft.credit.param.CreditNearbyCompanyImportParam;
|
import com.gxwebsoft.credit.param.CreditNearbyCompanyImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditNearbyCompanyParam;
|
import com.gxwebsoft.credit.param.CreditNearbyCompanyParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditNearbyCompanyService;
|
import com.gxwebsoft.credit.service.CreditNearbyCompanyService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 附近企业控制器
|
* 附近企业控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditNearbyCompanyController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询附近企业")
|
@Operation(summary = "分页查询附近企业")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditNearbyCompany>> page(CreditNearbyCompanyParam param) {
|
public ApiResult<PageResult<CreditNearbyCompany>> page(CreditNearbyCompanyParam param) {
|
||||||
@@ -188,6 +194,7 @@ public class CreditNearbyCompanyController extends BaseController {
|
|||||||
@RequestParam(value = "type", required = false) Integer type) {
|
@RequestParam(value = "type", required = false) Integer type) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExcelImportSupport.ImportResult<CreditNearbyCompanyImportParam> importResult = ExcelImportSupport.readAnySheet(
|
ExcelImportSupport.ImportResult<CreditNearbyCompanyImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||||
@@ -237,6 +244,9 @@ public class CreditNearbyCompanyController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
}
|
}
|
||||||
@@ -277,6 +287,8 @@ public class CreditNearbyCompanyController extends BaseController {
|
|||||||
successCount += persistImportChunk(chunkItems, chunkRowNumbers, companyId, parentId, type, currentTenantId, mpBatchSize, errorMessages);
|
successCount += persistImportChunk(chunkItems, chunkRowNumbers, companyId, parentId, type, currentTenantId, mpBatchSize, errorMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.NEARBY_COMPANY, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditPatent;
|
|||||||
import com.gxwebsoft.credit.param.CreditPatentImportParam;
|
import com.gxwebsoft.credit.param.CreditPatentImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditPatentParam;
|
import com.gxwebsoft.credit.param.CreditPatentParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditPatentService;
|
import com.gxwebsoft.credit.service.CreditPatentService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 专利控制器
|
* 专利控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditPatentController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询专利")
|
@Operation(summary = "分页查询专利")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditPatent>> page(CreditPatentParam param) {
|
public ApiResult<PageResult<CreditPatent>> page(CreditPatentParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditPatentController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExcelImportSupport.ImportResult<CreditPatentImportParam> importResult = ExcelImportSupport.readAnySheet(
|
ExcelImportSupport.ImportResult<CreditPatentImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||||
@@ -250,6 +257,10 @@ public class CreditPatentController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -334,6 +345,8 @@ public class CreditPatentController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.PATENT, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditRiskRelation;
|
|||||||
import com.gxwebsoft.credit.param.CreditRiskRelationImportParam;
|
import com.gxwebsoft.credit.param.CreditRiskRelationImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditRiskRelationParam;
|
import com.gxwebsoft.credit.param.CreditRiskRelationParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditRiskRelationService;
|
import com.gxwebsoft.credit.service.CreditRiskRelationService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 风险关系表控制器
|
* 风险关系表控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditRiskRelationController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询风险关系表")
|
@Operation(summary = "分页查询风险关系表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditRiskRelation>> page(CreditRiskRelationParam param) {
|
public ApiResult<PageResult<CreditRiskRelation>> page(CreditRiskRelationParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditRiskRelationController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "风险关系", 1);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "风险关系", 1);
|
||||||
@@ -238,6 +245,10 @@ public class CreditRiskRelationController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -322,6 +333,8 @@ public class CreditRiskRelationController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.RISK_RELATION, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditSupplier;
|
|||||||
import com.gxwebsoft.credit.param.CreditSupplierImportParam;
|
import com.gxwebsoft.credit.param.CreditSupplierImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditSupplierParam;
|
import com.gxwebsoft.credit.param.CreditSupplierParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditSupplierService;
|
import com.gxwebsoft.credit.service.CreditSupplierService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 供应商控制器
|
* 供应商控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditSupplierController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询供应商")
|
@Operation(summary = "分页查询供应商")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditSupplier>> page(CreditSupplierParam param) {
|
public ApiResult<PageResult<CreditSupplier>> page(CreditSupplierParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditSupplierController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "供应商", 3);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "供应商", 3);
|
||||||
@@ -246,6 +253,10 @@ public class CreditSupplierController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -330,6 +341,8 @@ public class CreditSupplierController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.SUPPLIER, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.credit.entity.CreditSuspectedRelationship;
|
|||||||
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipImportParam;
|
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam;
|
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditSuspectedRelationshipService;
|
import com.gxwebsoft.credit.service.CreditSuspectedRelationshipService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -23,8 +24,10 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 疑似关系控制器
|
* 疑似关系控制器
|
||||||
@@ -45,6 +48,9 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询疑似关系")
|
@Operation(summary = "分页查询疑似关系")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditSuspectedRelationship>> page(CreditSuspectedRelationshipParam param) {
|
public ApiResult<PageResult<CreditSuspectedRelationship>> page(CreditSuspectedRelationshipParam param) {
|
||||||
@@ -186,6 +192,7 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExcelImportSupport.ImportResult<CreditSuspectedRelationshipImportParam> importResult = ExcelImportSupport.readAnySheet(
|
ExcelImportSupport.ImportResult<CreditSuspectedRelationshipImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||||
@@ -249,6 +256,10 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
chunkItems.add(item);
|
chunkItems.add(item);
|
||||||
chunkRowNumbers.add(excelRowNumber);
|
chunkRowNumbers.add(excelRowNumber);
|
||||||
if (chunkItems.size() >= chunkSize) {
|
if (chunkItems.size() >= chunkSize) {
|
||||||
@@ -455,6 +466,8 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.SUSPECTED_RELATIONSHIP, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.gxwebsoft.credit.entity.CreditUser;
|
|||||||
import com.gxwebsoft.credit.param.CreditUserImportParam;
|
import com.gxwebsoft.credit.param.CreditUserImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditUserParam;
|
import com.gxwebsoft.credit.param.CreditUserParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||||
|
import com.gxwebsoft.credit.service.CreditCompanyRecordCountService;
|
||||||
import com.gxwebsoft.credit.service.CreditUserService;
|
import com.gxwebsoft.credit.service.CreditUserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -37,8 +38,10 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 招投标信息表控制器
|
* 招投标信息表控制器
|
||||||
@@ -61,6 +64,9 @@ public class CreditUserController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CreditCompanyService creditCompanyService;
|
private CreditCompanyService creditCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CreditCompanyRecordCountService creditCompanyRecordCountService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询招投标信息表")
|
@Operation(summary = "分页查询招投标信息表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CreditUser>> page(CreditUserParam param) {
|
public ApiResult<PageResult<CreditUser>> page(CreditUserParam param) {
|
||||||
@@ -198,6 +204,7 @@ public class CreditUserController extends BaseController {
|
|||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
Set<Integer> touchedCompanyIds = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "招投标", 0);
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "招投标", 0);
|
||||||
@@ -240,6 +247,9 @@ public class CreditUserController extends BaseController {
|
|||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
}
|
}
|
||||||
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
}
|
||||||
|
|
||||||
// 设置默认值
|
// 设置默认值
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
@@ -345,6 +355,8 @@ public class CreditUserController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.USER, touchedCompanyIds);
|
||||||
|
|
||||||
if (errorMessages.isEmpty()) {
|
if (errorMessages.isEmpty()) {
|
||||||
return success("成功导入" + successCount + "条数据", null);
|
return success("成功导入" + successCount + "条数据", null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -182,6 +182,81 @@ public class CreditCompany implements Serializable {
|
|||||||
@Schema(description = "所在国家")
|
@Schema(description = "所在国家")
|
||||||
private String country;
|
private String country;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditAdministrativeLicense;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditBankruptcy;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditBranch;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditBreachOfTrust;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditCaseFiling;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditCompetitor;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditCourtAnnouncement;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditCourtSession;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditCustomer;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditDeliveryNotice;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditExternal;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditFinalVersion;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditGqdj;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditHistoricalLegalPerson;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditJudgmentDebtor;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditJudicialDocument;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditJudiciary;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditMediation;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditNearbyCompany;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditPatent;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditRiskRelation;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditSupplier;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditSuspectedRelationship;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditUser;
|
||||||
|
|
||||||
|
@Schema(description = "记录数")
|
||||||
|
private Integer creditXgxf;
|
||||||
|
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
private String comments;
|
private String comments;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package com.gxwebsoft.credit.service;
|
||||||
|
|
||||||
|
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||||
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新 credit_company 表内的“关联记录数”字段。
|
||||||
|
*
|
||||||
|
* <p>这些字段是通过统计:credit_company.id = 关联表.company_id(且 deleted=0) 得到。</p>
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CreditCompanyRecordCountService {
|
||||||
|
|
||||||
|
public enum CountType {
|
||||||
|
ADMINISTRATIVE_LICENSE("credit_administrative_license", "credit_administrative_license"),
|
||||||
|
BANKRUPTCY("credit_bankruptcy", "credit_bankruptcy"),
|
||||||
|
BRANCH("credit_branch", "credit_branch"),
|
||||||
|
BREACH_OF_TRUST("credit_breach_of_trust", "credit_breach_of_trust"),
|
||||||
|
CASE_FILING("credit_case_filing", "credit_case_filing"),
|
||||||
|
COMPETITOR("credit_competitor", "credit_competitor"),
|
||||||
|
COURT_ANNOUNCEMENT("credit_court_announcement", "credit_court_announcement"),
|
||||||
|
COURT_SESSION("credit_court_session", "credit_court_session"),
|
||||||
|
CUSTOMER("credit_customer", "credit_customer"),
|
||||||
|
DELIVERY_NOTICE("credit_delivery_notice", "credit_delivery_notice"),
|
||||||
|
EXTERNAL("credit_external", "credit_external"),
|
||||||
|
FINAL_VERSION("credit_final_version", "credit_final_version"),
|
||||||
|
GQDJ("credit_gqdj", "credit_gqdj"),
|
||||||
|
HISTORICAL_LEGAL_PERSON("credit_historical_legal_person", "credit_historical_legal_person"),
|
||||||
|
JUDGMENT_DEBTOR("credit_judgment_debtor", "credit_judgment_debtor"),
|
||||||
|
JUDICIAL_DOCUMENT("credit_judicial_document", "credit_judicial_document"),
|
||||||
|
JUDICIARY("credit_judiciary", "credit_judiciary"),
|
||||||
|
MEDIATION("credit_mediation", "credit_mediation"),
|
||||||
|
NEARBY_COMPANY("credit_nearby_company", "credit_nearby_company"),
|
||||||
|
PATENT("credit_patent", "credit_patent"),
|
||||||
|
RISK_RELATION("credit_risk_relation", "credit_risk_relation"),
|
||||||
|
SUPPLIER("credit_supplier", "credit_supplier"),
|
||||||
|
SUSPECTED_RELATIONSHIP("credit_suspected_relationship", "credit_suspected_relationship"),
|
||||||
|
USER("credit_user", "credit_user"),
|
||||||
|
XGXF("credit_xgxf", "credit_xgxf");
|
||||||
|
|
||||||
|
private final String companyColumn;
|
||||||
|
private final String sourceTable;
|
||||||
|
|
||||||
|
CountType(String companyColumn, String sourceTable) {
|
||||||
|
this.companyColumn = companyColumn;
|
||||||
|
this.sourceTable = sourceTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompanyColumn() {
|
||||||
|
return companyColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSourceTable() {
|
||||||
|
return sourceTable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final NamedParameterJdbcTemplate namedJdbc;
|
||||||
|
|
||||||
|
public CreditCompanyRecordCountService(NamedParameterJdbcTemplate namedJdbc) {
|
||||||
|
this.namedJdbc = namedJdbc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新某个“记录数”字段(只更新传入 companyIds)。
|
||||||
|
*/
|
||||||
|
public void refresh(CountType type, Collection<Integer> companyIds) {
|
||||||
|
if (type == null || CollectionUtils.isEmpty(companyIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Integer> ids = normalizeCompanyIds(companyIds);
|
||||||
|
if (ids.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表/字段名来自固定枚举,不允许外部传入,避免 SQL 注入。
|
||||||
|
String sql = ""
|
||||||
|
+ "UPDATE credit_company c "
|
||||||
|
+ "SET " + type.getCompanyColumn() + " = ("
|
||||||
|
+ " SELECT COUNT(1) "
|
||||||
|
+ " FROM " + type.getSourceTable() + " t "
|
||||||
|
+ " WHERE t.company_id = c.id AND t.deleted = 0"
|
||||||
|
+ ") "
|
||||||
|
+ "WHERE c.id IN (:ids)";
|
||||||
|
|
||||||
|
final int inChunkSize = 1000;
|
||||||
|
for (int i = 0; i < ids.size(); i += inChunkSize) {
|
||||||
|
List<Integer> chunk = ids.subList(i, Math.min(ids.size(), i + inChunkSize));
|
||||||
|
namedJdbc.update(sql, new MapSqlParameterSource("ids", chunk));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新全部“记录数”字段(只更新传入 companyIds)。
|
||||||
|
*/
|
||||||
|
public void refreshAll(Collection<Integer> companyIds) {
|
||||||
|
if (CollectionUtils.isEmpty(companyIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (CountType type : CountType.values()) {
|
||||||
|
refresh(type, companyIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Integer> normalizeCompanyIds(Collection<Integer> companyIds) {
|
||||||
|
Set<Integer> unique = new LinkedHashSet<>();
|
||||||
|
for (Integer id : companyIds) {
|
||||||
|
if (id != null && id > 0) {
|
||||||
|
unique.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayList<>(unique);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user