diff --git a/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java b/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java deleted file mode 100644 index fcaae57..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java +++ /dev/null @@ -1,1529 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.TableInfo; -import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.extension.toolkit.SqlRunner; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.service.CreditCompanyService; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.stereotype.Component; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.support.TransactionTemplate; -import org.springframework.util.CollectionUtils; - -import java.io.Serializable; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.ArrayDeque; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.function.BiConsumer; -import java.util.function.BiFunction; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.regex.Pattern; - -/** - * credit 模块 Excel 导入批处理支持: - * - 分批 upsert(批内一次查库 + 批量 insert/update) - * - 每批独立事务(REQUIRES_NEW),避免单次导入事务过大拖垮数据库 - */ -@Component -public class BatchImportSupport { - - private final TransactionTemplate requiresNewTx; - private static final Pattern PARTY_SPLIT_PATTERN = Pattern.compile("[,,;;、\\n\\r\\t/|]+"); - - public BatchImportSupport(PlatformTransactionManager transactionManager) { - TransactionTemplate template = new TransactionTemplate(transactionManager); - template.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); - this.requiresNewTx = template; - } - - public int runInNewTx(Supplier supplier) { - return requiresNewTx.execute(status -> supplier.get()); - } - - /** - * 硬删除(物理删除),用于替代 MyBatis-Plus 的 @TableLogic 逻辑删除。 - * - *

注意:SQL 仍会经过 MyBatis-Plus 拦截器(如 TenantLine),用于保证租户隔离。

- */ - public boolean hardRemoveById(Class entityClass, Serializable id) { - if (entityClass == null || id == null) { - return false; - } - TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass); - if (tableInfo == null) { - throw new IllegalArgumentException("MyBatis-Plus TableInfo not found for entityClass=" + entityClass.getName()); - } - String tableName = tableInfo.getTableName(); - String keyColumn = tableInfo.getKeyColumn(); - if (keyColumn == null || keyColumn.trim().isEmpty()) { - keyColumn = "id"; - } - String sql = "DELETE FROM " + tableName + " WHERE " + keyColumn + " = {0}"; - return SqlRunner.db().delete(sql, id); - } - - /** - * 硬删除(物理删除)- 批量 - */ - public boolean hardRemoveByIds(Class entityClass, List ids) { - if (entityClass == null || CollectionUtils.isEmpty(ids)) { - return false; - } - TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass); - if (tableInfo == null) { - throw new IllegalArgumentException("MyBatis-Plus TableInfo not found for entityClass=" + entityClass.getName()); - } - String tableName = tableInfo.getTableName(); - String keyColumn = tableInfo.getKeyColumn(); - if (keyColumn == null || keyColumn.trim().isEmpty()) { - keyColumn = "id"; - } - - // Keep IN-list size under common DB/driver limits. - final int chunkSize = 900; - boolean anyDeleted = false; - for (int i = 0; i < ids.size(); i += chunkSize) { - List chunk = ids.subList(i, Math.min(ids.size(), i + chunkSize)); - if (CollectionUtils.isEmpty(chunk)) { - continue; - } - StringBuilder inPlaceholders = new StringBuilder(); - for (int j = 0; j < chunk.size(); j++) { - if (j > 0) { - inPlaceholders.append(","); - } - inPlaceholders.append("{").append(j).append("}"); - } - String sql = "DELETE FROM " + tableName + " WHERE " + keyColumn + " IN (" + inPlaceholders + ")"; - anyDeleted = SqlRunner.db().delete(sql, chunk.toArray()) || anyDeleted; - } - return anyDeleted; - } - - public static final class CompanyIdRefreshStats { - public final boolean anyDataRead; - public final int updated; - public final int matched; - public final int notFound; - public final int ambiguous; - - private CompanyIdRefreshStats(boolean anyDataRead, int updated, int matched, int notFound, int ambiguous) { - this.anyDataRead = anyDataRead; - this.updated = updated; - this.matched = matched; - this.notFound = notFound; - this.ambiguous = ambiguous; - } - - public Map toMap() { - Map result = new LinkedHashMap<>(); - result.put("updated", updated); - result.put("matched", matched); - result.put("notFound", notFound); - result.put("ambiguous", ambiguous); - return result; - } - } - - /** - * 按企业名称匹配 CreditCompany(name / matchName) 并回填 companyId。 - * - *

默认仅更新 companyId 为空/0 的记录(onlyNull=true);onlyNull=false 时会覆盖更新(仅当 companyId 不同)。

- * - *

注意:为避免跨租户误更新,当 currentTenantId 为空时会按记录自身 tenantId 维度匹配, - * tenantId 为空的记录将被跳过并计入 notFound。

- */ - public CompanyIdRefreshStats refreshCompanyIdByCompanyName(IService service, - CreditCompanyService creditCompanyService, - Integer currentTenantId, - Boolean onlyNull, - Integer limit, - SFunction idGetter, - BiConsumer idSetter, - SFunction nameGetter, - SFunction companyIdGetter, - BiConsumer companyIdSetter, - SFunction hasDataGetter, - BiConsumer hasDataSetter, - SFunction tenantIdGetter, - Supplier patchFactory) { - // Keep existing API; delegate to the multi-column implementation. - return refreshCompanyIdByCompanyNames(service, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - idGetter, - idSetter, - companyIdGetter, - companyIdSetter, - hasDataGetter, - hasDataSetter, - tenantIdGetter, - patchFactory, - nameGetter); - } - - /** - * 按企业名称匹配 CreditCompany(name / matchName) 并回填 companyId + companyName。 - * - *

companyNameSetter 为空时等价于仅回填 companyId。

- */ - public CompanyIdRefreshStats refreshCompanyIdByCompanyName(IService service, - CreditCompanyService creditCompanyService, - Integer currentTenantId, - Boolean onlyNull, - Integer limit, - SFunction idGetter, - BiConsumer idSetter, - SFunction nameGetter, - SFunction companyIdGetter, - BiConsumer companyIdSetter, - BiConsumer companyNameSetter, - SFunction hasDataGetter, - BiConsumer hasDataSetter, - SFunction tenantIdGetter, - Supplier patchFactory) { - return refreshCompanyIdByCompanyNames(service, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - idGetter, - idSetter, - companyIdGetter, - companyIdSetter, - companyNameSetter, - hasDataGetter, - hasDataSetter, - tenantIdGetter, - patchFactory, - nameGetter); - } - - /** - * 按多列“当事人/企业名称”匹配 CreditCompany(name / matchName) 并回填 companyId。 - * - *

按传入列顺序优先匹配:原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人等。

- * - *

同一列若匹配到多个不同企业则视为歧义;若最终无法得到唯一 companyId,则跳过并计入 ambiguous/notFound。

- */ - @SafeVarargs - public final CompanyIdRefreshStats refreshCompanyIdByCompanyNames(IService service, - CreditCompanyService creditCompanyService, - Integer currentTenantId, - Boolean onlyNull, - Integer limit, - SFunction idGetter, - BiConsumer idSetter, - SFunction companyIdGetter, - BiConsumer companyIdSetter, - SFunction hasDataGetter, - BiConsumer hasDataSetter, - SFunction tenantIdGetter, - Supplier patchFactory, - SFunction... nameGetters) { - return refreshCompanyIdByCompanyNames(service, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - idGetter, - idSetter, - companyIdGetter, - companyIdSetter, - null, - hasDataGetter, - hasDataSetter, - tenantIdGetter, - patchFactory, - nameGetters); - } - - /** - * 按多列“当事人/企业名称”匹配 CreditCompany(name / matchName) 并回填 companyId + companyName。 - * - *

companyNameSetter 为空时等价于仅回填 companyId。

- */ - @SafeVarargs - public final CompanyIdRefreshStats refreshCompanyIdByCompanyNames(IService service, - CreditCompanyService creditCompanyService, - Integer currentTenantId, - Boolean onlyNull, - Integer limit, - SFunction idGetter, - BiConsumer idSetter, - SFunction companyIdGetter, - BiConsumer companyIdSetter, - BiConsumer companyNameSetter, - SFunction hasDataGetter, - BiConsumer hasDataSetter, - SFunction tenantIdGetter, - Supplier patchFactory, - SFunction... nameGetters) { - boolean onlyNullFlag = (onlyNull == null) || Boolean.TRUE.equals(onlyNull); - - if (nameGetters == null || nameGetters.length == 0) { - return new CompanyIdRefreshStats(false, 0, 0, 0, 0); - } - - // 1) 读取待处理数据(仅取必要字段,避免一次性拉全表字段) - @SuppressWarnings({"rawtypes", "unchecked"}) - SFunction[] selectColumns = (SFunction[]) new SFunction[4 + nameGetters.length]; - int colIdx = 0; - selectColumns[colIdx++] = idGetter; - selectColumns[colIdx++] = companyIdGetter; - selectColumns[colIdx++] = hasDataGetter; - selectColumns[colIdx++] = tenantIdGetter; - for (SFunction ng : nameGetters) { - selectColumns[colIdx++] = ng; - } - - var query = service.lambdaQuery() - .select(selectColumns) - .eq(currentTenantId != null, tenantIdGetter, currentTenantId) - .and(w -> { - // Only process rows that have at least one name column populated. - for (int i = 0; i < nameGetters.length; i++) { - if (i == 0) { - w.isNotNull(nameGetters[i]); - } else { - w.or().isNotNull(nameGetters[i]); - } - } - }); - if (onlyNullFlag) { - // Historically some tables used 0 as the "unset" companyId, while others left it NULL. - // Treat both as "unset" so refresh won't silently do nothing. - query.and(w -> w.isNull(companyIdGetter).or().eq(companyIdGetter, 0)); - } - if (limit != null && limit > 0) { - query.last("limit " + Math.min(limit, 200000)); - } - List rows = query.list(); - - if (CollectionUtils.isEmpty(rows)) { - return new CompanyIdRefreshStats(false, 0, 0, 0, 0); - } - - // 2) 按租户维度匹配(避免管理员/跨租户场景误匹配) - Map> rowsByTenant = new LinkedHashMap<>(); - int missingTenant = 0; - for (T row : rows) { - if (row == null) { - continue; - } - Integer tenantId = currentTenantId != null ? currentTenantId : tenantIdGetter.apply(row); - if (tenantId == null) { - // 未知租户下不做跨租户匹配,避免误更新 - missingTenant++; - continue; - } - rowsByTenant.computeIfAbsent(tenantId, k -> new ArrayList<>()).add(row); - } - - // 3) 批量更新 companyId - int updated = 0; - int matched = 0; - int notFound = 0; - int ambiguous = 0; - final int batchSize = 500; - List updates = new ArrayList<>(batchSize); - - final int inChunkSize = 900; - for (Map.Entry> entry : rowsByTenant.entrySet()) { - Integer tenantId = entry.getKey(); - List tenantRows = entry.getValue(); - if (tenantId == null || CollectionUtils.isEmpty(tenantRows)) { - continue; - } - - // 3.1) 查询当前租户下的 companyId 映射 - LinkedHashMap companyIdByName = new LinkedHashMap<>(); - LinkedHashMap ambiguousByName = new LinkedHashMap<>(); - // For display: prefer matchName (normalized) then name. - HashMap companyNameById = new HashMap<>(); - LinkedHashSet nameSet = new LinkedHashSet<>(); - for (T row : tenantRows) { - if (row == null) { - continue; - } - for (SFunction ng : nameGetters) { - for (String name : splitPartyNames(ng.apply(row))) { - if (name != null) { - nameSet.add(name); - } - } - } - } - List allNames = new ArrayList<>(nameSet); - for (int i = 0; i < allNames.size(); i += inChunkSize) { - List chunk = allNames.subList(i, Math.min(allNames.size(), i + inChunkSize)); - if (CollectionUtils.isEmpty(chunk)) { - continue; - } - List companies = creditCompanyService.lambdaQuery() - .select(CreditCompany::getId, CreditCompany::getName, CreditCompany::getMatchName, CreditCompany::getTenantId) - .eq(CreditCompany::getTenantId, tenantId) - .and(w -> w.in(CreditCompany::getName, chunk).or().in(CreditCompany::getMatchName, chunk)) - .list(); - - for (CreditCompany c : companies) { - if (c == null || c.getId() == null) { - continue; - } - String displayName = c.getMatchName(); - if (displayName == null || displayName.trim().isEmpty()) { - displayName = c.getName(); - } - if (displayName != null && !displayName.trim().isEmpty()) { - companyNameById.putIfAbsent(c.getId(), displayName.trim()); - } - addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getName()), c.getId()); - addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getMatchName()), c.getId()); - } - } - - // 3.2) 更新当前租户下的数据 companyId - for (T row : tenantRows) { - if (row == null) { - continue; - } - - Integer companyId = null; - boolean hasAmbiguousName = false; - for (SFunction ng : nameGetters) { - LinkedHashSet idsForColumn = new LinkedHashSet<>(); - for (String key : splitPartyNames(ng.apply(row))) { - if (key == null) { - continue; - } - Integer amb = ambiguousByName.get(key); - if (amb != null && amb > 0) { - hasAmbiguousName = true; - continue; - } - Integer cid = companyIdByName.get(key); - if (cid != null) { - idsForColumn.add(cid); - } - } - if (idsForColumn.size() == 1) { - companyId = idsForColumn.iterator().next(); - break; - } - if (idsForColumn.size() > 1) { - // Multiple companies matched within one column (e.g. multiple plaintiffs) -> ambiguous. - hasAmbiguousName = true; - } - } - - if (companyId == null) { - if (hasAmbiguousName) { - ambiguous++; - } else { - notFound++; - } - continue; - } - matched++; - - Integer oldCompanyId = row != null ? companyIdGetter.apply(row) : null; - Boolean oldHasData = row != null ? hasDataGetter.apply(row) : null; - boolean needUpdate; - if (onlyNullFlag) { - needUpdate = (oldCompanyId == null) || oldCompanyId == 0; - } else { - needUpdate = oldCompanyId == null || !companyId.equals(oldCompanyId); - } - // 若已匹配到企业,但 hasData 未标记,则也需要回填 hasData=1 - if (!Boolean.TRUE.equals(oldHasData)) { - needUpdate = true; - } - if (!needUpdate) { - continue; - } - - Integer id = row != null ? idGetter.apply(row) : null; - if (id == null) { - continue; - } - T patch = patchFactory.get(); - idSetter.accept(patch, id); - companyIdSetter.accept(patch, companyId); - if (companyNameSetter != null) { - String companyName = companyNameById.get(companyId); - if (companyName != null && !companyName.trim().isEmpty()) { - companyNameSetter.accept(patch, companyName.trim()); - } - } - hasDataSetter.accept(patch, Boolean.TRUE); - updates.add(patch); - if (updates.size() >= batchSize) { - List batch = new ArrayList<>(updates); - updates.clear(); - updated += runInNewTx(() -> service.updateBatchById(batch, batchSize) ? batch.size() : 0); - } - } - } - - // currentTenantId 为空时,租户缺失的数据不做匹配更新,避免误更新 - if (currentTenantId == null && missingTenant > 0) { - notFound += missingTenant; - } - - if (!updates.isEmpty()) { - List batch = new ArrayList<>(updates); - updates.clear(); - updated += runInNewTx(() -> service.updateBatchById(batch, batchSize) ? batch.size() : 0); - } - - return new CompanyIdRefreshStats(true, updated, matched, notFound, ambiguous); - } - - /** - * 按“文本字段包含企业名称”的方式匹配 CreditCompany(name / matchName) 并回填 companyId。 - * - *

适用场景:某些表的“当事人/第三人”字段会包含多个角色+姓名/企业,例如: - * 申请执行人 - 张三 被执行人 - 某某有限公司。此时无法按整格等值匹配。

- * - *

实现:按租户加载企业 name/matchName 构建多模式匹配(AC 自动机),在文本中查找出现的企业名。

- * - *

列优先级:按 textGetters 的顺序尝试;若某列匹配到唯一企业则采用,否则继续下一列。

- */ - @SafeVarargs - public final CompanyIdRefreshStats refreshCompanyIdByCompanyNameContainedInText(IService service, - CreditCompanyService creditCompanyService, - Integer currentTenantId, - Boolean onlyNull, - Integer limit, - SFunction idGetter, - BiConsumer idSetter, - SFunction companyIdGetter, - BiConsumer companyIdSetter, - SFunction hasDataGetter, - BiConsumer hasDataSetter, - SFunction tenantIdGetter, - Supplier patchFactory, - SFunction... textGetters) { - return refreshCompanyIdByCompanyNameContainedInText( - service, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - idGetter, - idSetter, - companyIdGetter, - companyIdSetter, - hasDataGetter, - hasDataSetter, - tenantIdGetter, - patchFactory, - null, - textGetters - ); - } - - /** - * refreshCompanyIdByCompanyNameContainedInText 的增强版:支持对 CreditCompany 查询追加条件(例如仅匹配一级企业)。 - */ - @SafeVarargs - public final CompanyIdRefreshStats refreshCompanyIdByCompanyNameContainedInText(IService service, - CreditCompanyService creditCompanyService, - Integer currentTenantId, - Boolean onlyNull, - Integer limit, - SFunction idGetter, - BiConsumer idSetter, - SFunction companyIdGetter, - BiConsumer companyIdSetter, - SFunction hasDataGetter, - BiConsumer hasDataSetter, - SFunction tenantIdGetter, - Supplier patchFactory, - Consumer> companyQueryCustomizer, - SFunction... textGetters) { - boolean onlyNullFlag = (onlyNull == null) || Boolean.TRUE.equals(onlyNull); - if (textGetters == null || textGetters.length == 0) { - return new CompanyIdRefreshStats(false, 0, 0, 0, 0); - } - - // 1) 读取待处理数据(仅取必要字段) - @SuppressWarnings({"rawtypes", "unchecked"}) - SFunction[] selectColumns = (SFunction[]) new SFunction[4 + textGetters.length]; - int colIdx = 0; - selectColumns[colIdx++] = idGetter; - selectColumns[colIdx++] = companyIdGetter; - selectColumns[colIdx++] = hasDataGetter; - selectColumns[colIdx++] = tenantIdGetter; - for (SFunction tg : textGetters) { - selectColumns[colIdx++] = tg; - } - - var query = service.lambdaQuery() - .select(selectColumns) - .eq(currentTenantId != null, tenantIdGetter, currentTenantId) - .and(w -> { - for (int i = 0; i < textGetters.length; i++) { - if (i == 0) { - w.isNotNull(textGetters[i]); - } else { - w.or().isNotNull(textGetters[i]); - } - } - }); - if (onlyNullFlag) { - query.and(w -> w.isNull(companyIdGetter).or().eq(companyIdGetter, 0)); - } - if (limit != null && limit > 0) { - query.last("limit " + Math.min(limit, 200000)); - } - List rows = query.list(); - if (CollectionUtils.isEmpty(rows)) { - return new CompanyIdRefreshStats(false, 0, 0, 0, 0); - } - - // 2) 按租户分组(避免跨租户误匹配) - Map> rowsByTenant = new LinkedHashMap<>(); - int missingTenant = 0; - for (T row : rows) { - if (row == null) { - continue; - } - Integer tenantId = currentTenantId != null ? currentTenantId : tenantIdGetter.apply(row); - if (tenantId == null) { - missingTenant++; - continue; - } - rowsByTenant.computeIfAbsent(tenantId, k -> new ArrayList<>()).add(row); - } - - int updated = 0; - int matched = 0; - int notFound = 0; - int ambiguous = 0; - final int batchSize = 500; - List updates = new ArrayList<>(batchSize); - - for (Map.Entry> entry : rowsByTenant.entrySet()) { - Integer tenantId = entry.getKey(); - List tenantRows = entry.getValue(); - if (tenantId == null || CollectionUtils.isEmpty(tenantRows)) { - continue; - } - - // 2.1) 构建当前租户的企业名匹配器 - LambdaQueryChainWrapper companyQuery = creditCompanyService.lambdaQuery() - .select(CreditCompany::getId, CreditCompany::getName, CreditCompany::getMatchName, CreditCompany::getTenantId) - .eq(CreditCompany::getTenantId, tenantId) - ; - if (companyQueryCustomizer != null) { - companyQueryCustomizer.accept(companyQuery); - } - List companies = companyQuery.list(); - CompanyNameMatcher matcher = CompanyNameMatcher.build(companies); - - // 2.2) 匹配并回填 - for (T row : tenantRows) { - if (row == null) { - continue; - } - - Integer resolvedCompanyId = null; - boolean hasAmbiguous = false; - for (SFunction tg : textGetters) { - String text = tg.apply(row); - CompanyNameMatcher.MatchResult r = matcher.match(text); - if (r.ambiguous) { - hasAmbiguous = true; - continue; - } - if (r.companyId != null) { - resolvedCompanyId = r.companyId; - break; - } - } - - if (resolvedCompanyId == null) { - if (hasAmbiguous) { - ambiguous++; - } else { - notFound++; - } - continue; - } - matched++; - - Integer oldCompanyId = companyIdGetter.apply(row); - Boolean oldHasData = hasDataGetter.apply(row); - boolean needUpdate; - if (onlyNullFlag) { - needUpdate = (oldCompanyId == null) || oldCompanyId == 0; - } else { - needUpdate = oldCompanyId == null || !resolvedCompanyId.equals(oldCompanyId); - } - if (!Boolean.TRUE.equals(oldHasData)) { - needUpdate = true; - } - if (!needUpdate) { - continue; - } - - Integer id = idGetter.apply(row); - if (id == null) { - continue; - } - T patch = patchFactory.get(); - idSetter.accept(patch, id); - companyIdSetter.accept(patch, resolvedCompanyId); - hasDataSetter.accept(patch, Boolean.TRUE); - updates.add(patch); - if (updates.size() >= batchSize) { - List batch = new ArrayList<>(updates); - updates.clear(); - updated += runInNewTx(() -> service.updateBatchById(batch, batchSize) ? batch.size() : 0); - } - } - } - - if (currentTenantId == null && missingTenant > 0) { - notFound += missingTenant; - } - - if (!updates.isEmpty()) { - List batch = new ArrayList<>(updates); - updates.clear(); - updated += runInNewTx(() -> service.updateBatchById(batch, batchSize) ? batch.size() : 0); - } - - return new CompanyIdRefreshStats(true, updated, matched, notFound, ambiguous); - } - - /** - * 批量 upsert:优先按 code 匹配;code 为空时按 name 匹配。 - */ - public int upsertByCodeOrName(IService service, - List items, - SFunction idColumn, - BiConsumer idSetter, - SFunction codeColumn, - Function codeGetter, - SFunction nameColumn, - Function nameGetter, - Consumer> extraConditions, - int batchSize) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - - List codes = new ArrayList<>(); - List names = new ArrayList<>(); - for (T item : items) { - if (item == null) { - continue; - } - String code = normalize(codeGetter.apply(item)); - if (code != null) { - codes.add(code); - } else { - String name = normalize(nameGetter.apply(item)); - if (name != null) { - names.add(name); - } - } - } - - Map idByCode = new HashMap<>(); - if (!codes.isEmpty()) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (extraConditions != null) { - extraConditions.accept(wrapper); - } - wrapper.in(codeColumn, codes); - wrapper.select(idColumn, codeColumn); - for (T dbRow : service.list(wrapper)) { - String code = normalize(codeGetter.apply(dbRow)); - Integer id = extractId(dbRow, idColumn); - if (code != null && id != null) { - idByCode.putIfAbsent(code, id); - } - } - } - - Map idByName = new HashMap<>(); - if (!names.isEmpty()) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (extraConditions != null) { - extraConditions.accept(wrapper); - } - wrapper.in(nameColumn, names); - wrapper.select(idColumn, nameColumn); - for (T dbRow : service.list(wrapper)) { - String name = normalize(nameGetter.apply(dbRow)); - Integer id = extractId(dbRow, idColumn); - if (name != null && id != null) { - idByName.putIfAbsent(name, id); - } - } - } - - List updates = new ArrayList<>(); - List inserts = new ArrayList<>(); - for (T item : items) { - if (item == null) { - continue; - } - String code = normalize(codeGetter.apply(item)); - Integer id = null; - if (code != null) { - id = idByCode.get(code); - } else { - String name = normalize(nameGetter.apply(item)); - if (name != null) { - id = idByName.get(name); - } - } - - if (id != null) { - idSetter.accept(item, id); - updates.add(item); - } else { - inserts.add(item); - } - } - - if (!updates.isEmpty()) { - service.updateBatchById(updates, batchSize); - } - if (!inserts.isEmpty()) { - service.saveBatch(inserts, batchSize); - } - return updates.size() + inserts.size(); - } - - /** - * 批量 upsert:按单字段 key 匹配(key 非空)。 - */ - public int upsertBySingleKey(IService service, - List items, - SFunction idColumn, - BiConsumer idSetter, - SFunction keyColumn, - Function keyGetter, - Consumer> extraConditions, - int batchSize) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - - List keys = new ArrayList<>(items.size()); - for (T item : items) { - if (item == null) { - continue; - } - String key = normalize(keyGetter.apply(item)); - if (key != null) { - keys.add(key); - } - } - - Map idByKey = new HashMap<>(); - if (!keys.isEmpty()) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (extraConditions != null) { - extraConditions.accept(wrapper); - } - wrapper.in(keyColumn, keys); - wrapper.select(idColumn, keyColumn); - for (T dbRow : service.list(wrapper)) { - String key = normalize(keyGetter.apply(dbRow)); - Integer id = extractId(dbRow, idColumn); - if (key != null && id != null) { - idByKey.putIfAbsent(key, id); - } - } - } - - List updates = new ArrayList<>(); - List inserts = new ArrayList<>(); - for (T item : items) { - if (item == null) { - continue; - } - String key = normalize(keyGetter.apply(item)); - Integer id = key != null ? idByKey.get(key) : null; - if (id != null) { - idSetter.accept(item, id); - updates.add(item); - } else { - inserts.add(item); - } - } - - if (!updates.isEmpty()) { - service.updateBatchById(updates, batchSize); - } - if (!inserts.isEmpty()) { - service.saveBatch(inserts, batchSize); - } - return updates.size() + inserts.size(); - } - - /** - * 批量 upsert:按单字段 key 匹配(key 非空)。当匹配到已存在记录时: - * - 覆盖更新 - * - 将 counter(通常是 recommend)在数据库原值基础上 +1,用于记录“被更新次数” - * - *

注意:counter 会被覆盖写入(不是 SQL 自增),因此该方法适合导入场景。

- */ - public int upsertBySingleKeyAndIncrementCounterOnUpdate(IService service, - List items, - SFunction idColumn, - BiConsumer idSetter, - SFunction keyColumn, - Function keyGetter, - SFunction counterColumn, - BiConsumer counterSetter, - Consumer> extraConditions, - int batchSize) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - - List keys = new ArrayList<>(items.size()); - for (T item : items) { - if (item == null) { - continue; - } - String key = normalize(keyGetter.apply(item)); - if (key != null) { - keys.add(key); - } - } - - Map idByKey = new HashMap<>(); - Map counterByKey = new HashMap<>(); - if (!keys.isEmpty()) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (extraConditions != null) { - extraConditions.accept(wrapper); - } - wrapper.in(keyColumn, keys); - wrapper.select(idColumn, keyColumn, counterColumn); - for (T dbRow : service.list(wrapper)) { - String key = normalize(keyGetter.apply(dbRow)); - Integer id = extractId(dbRow, idColumn); - if (key == null || id == null) { - continue; - } - idByKey.putIfAbsent(key, id); - if (counterColumn != null) { - counterByKey.putIfAbsent(key, counterColumn.apply(dbRow)); - } - } - } - - List updates = new ArrayList<>(); - List inserts = new ArrayList<>(); - for (T item : items) { - if (item == null) { - continue; - } - String key = normalize(keyGetter.apply(item)); - Integer id = key != null ? idByKey.get(key) : null; - if (id != null) { - idSetter.accept(item, id); - Integer old = key != null ? counterByKey.get(key) : null; - if (counterSetter != null) { - counterSetter.accept(item, old == null ? 1 : old + 1); - } - updates.add(item); - } else { - // insert:如果未提供 counterSetter,则不做处理;如果提供则默认 0。 - if (counterSetter != null) { - counterSetter.accept(item, 0); - } - inserts.add(item); - } - } - - if (!updates.isEmpty()) { - service.updateBatchById(updates, batchSize); - } - if (!inserts.isEmpty()) { - service.saveBatch(inserts, batchSize); - } - return updates.size() + inserts.size(); - } - - /** - * 批量 upsert:优先按 code 匹配;code 为空时按 name 匹配。匹配到已存在记录时 counter +1。 - */ - public int upsertByCodeOrNameAndIncrementCounterOnUpdate(IService service, - List items, - SFunction idColumn, - BiConsumer idSetter, - SFunction codeColumn, - Function codeGetter, - SFunction nameColumn, - Function nameGetter, - SFunction counterColumn, - BiConsumer counterSetter, - Consumer> extraConditions, - int batchSize) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - - List codes = new ArrayList<>(); - List names = new ArrayList<>(); - for (T item : items) { - if (item == null) { - continue; - } - String code = normalize(codeGetter.apply(item)); - if (code != null) { - codes.add(code); - } else { - String name = normalize(nameGetter.apply(item)); - if (name != null) { - names.add(name); - } - } - } - - Map idByCode = new HashMap<>(); - Map counterByCode = new HashMap<>(); - if (!codes.isEmpty()) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (extraConditions != null) { - extraConditions.accept(wrapper); - } - wrapper.in(codeColumn, codes); - wrapper.select(idColumn, codeColumn, counterColumn); - for (T dbRow : service.list(wrapper)) { - String code = normalize(codeGetter.apply(dbRow)); - Integer id = extractId(dbRow, idColumn); - if (code == null || id == null) { - continue; - } - idByCode.putIfAbsent(code, id); - if (counterColumn != null) { - counterByCode.putIfAbsent(code, counterColumn.apply(dbRow)); - } - } - } - - Map idByName = new HashMap<>(); - Map counterByName = new HashMap<>(); - if (!names.isEmpty()) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (extraConditions != null) { - extraConditions.accept(wrapper); - } - wrapper.in(nameColumn, names); - wrapper.select(idColumn, nameColumn, counterColumn); - for (T dbRow : service.list(wrapper)) { - String name = normalize(nameGetter.apply(dbRow)); - Integer id = extractId(dbRow, idColumn); - if (name == null || id == null) { - continue; - } - idByName.putIfAbsent(name, id); - if (counterColumn != null) { - counterByName.putIfAbsent(name, counterColumn.apply(dbRow)); - } - } - } - - List updates = new ArrayList<>(); - List inserts = new ArrayList<>(); - for (T item : items) { - if (item == null) { - continue; - } - String code = normalize(codeGetter.apply(item)); - Integer id = null; - Integer old = null; - if (code != null) { - id = idByCode.get(code); - old = counterByCode.get(code); - } else { - String name = normalize(nameGetter.apply(item)); - if (name != null) { - id = idByName.get(name); - old = counterByName.get(name); - } - } - - if (id != null) { - idSetter.accept(item, id); - if (counterSetter != null) { - counterSetter.accept(item, old == null ? 1 : old + 1); - } - updates.add(item); - } else { - if (counterSetter != null) { - counterSetter.accept(item, 0); - } - inserts.add(item); - } - } - - if (!updates.isEmpty()) { - service.updateBatchById(updates, batchSize); - } - if (!inserts.isEmpty()) { - service.saveBatch(inserts, batchSize); - } - return updates.size() + inserts.size(); - } - - /** - * 批量失败时降级逐行,尽量保留“第 N 行”错误定位。 - */ - public int persistChunkWithFallback(List items, - List excelRowNumbers, - Supplier batchPersist, - BiFunction rowPersist, - List errorMessages) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - try { - return runInNewTx(batchPersist); - } catch (Exception batchException) { - int successCount = 0; - for (int i = 0; i < items.size(); i++) { - T item = items.get(i); - int excelRowNumber = (excelRowNumbers != null && i < excelRowNumbers.size()) ? excelRowNumbers.get(i) : -1; - try { - int delta = runInNewTx(() -> rowPersist.apply(item, excelRowNumber) ? 1 : 0); - successCount += delta; - } catch (Exception e) { - if (errorMessages != null) { - if (excelRowNumber > 0) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - } else { - errorMessages.add(e.getMessage()); - } - } - } - } - return successCount; - } - } - - /** - * Insert-only batch persist with "unique index" duplicate handling: - * - try saveBatch - * - on failure, fallback to row-by-row save - * - if a row hits duplicate-key constraint, add a friendly error and continue - * - *

This intentionally does NOT query the database for dedup/upsert.

- */ - public int persistInsertOnlyChunk(IService service, - List items, - List excelRowNumbers, - int batchSize, - Function rowLabelGetter, - String messagePrefix, - List errorMessages) { - String prefix = messagePrefix == null ? "" : messagePrefix; - return persistChunkWithFallback( - items, - excelRowNumbers, - () -> { - boolean ok = service.saveBatch(items, batchSize); - if (!ok) { - throw new RuntimeException("批量保存失败"); - } - return items.size(); - }, - (rowItem, rowNumber) -> { - try { - boolean ok = service.save(rowItem); - if (!ok) { - if (errorMessages != null) { - String p = (rowNumber != null && rowNumber > 0) ? (prefix + "第" + rowNumber + "行:") : prefix; - errorMessages.add(p + "保存失败"); - } - return false; - } - return true; - } catch (DataIntegrityViolationException e) { - if (!isDuplicateKey(e)) { - throw e; - } - if (errorMessages != null) { - String label = null; - if (rowLabelGetter != null && rowItem != null) { - try { - label = rowLabelGetter.apply(rowItem); - } catch (Exception ignore) { - // ignore label extraction failures - } - } - if (label != null) { - label = label.trim(); - } - String what = (label == null || label.isEmpty()) ? "数据" : ("【" + label + "】"); - String p = (rowNumber != null && rowNumber > 0) ? (prefix + "第" + rowNumber + "行:") : prefix; - errorMessages.add(p + what + "重复(唯一索引冲突)"); - } - return false; - } - }, - errorMessages - ); - } - - /** - * Best-effort duplicate-key detection across common drivers. - */ - public static boolean isDuplicateKey(DataIntegrityViolationException e) { - for (Throwable t = e; t != null; t = t.getCause()) { - if (t instanceof SQLException) { - SQLException se = (SQLException) t; - // MySQL: 1062 Duplicate entry; PostgreSQL/H2: SQLState 23505 unique_violation - if (se.getErrorCode() == 1062) { - return true; - } - if ("23505".equals(se.getSQLState())) { - return true; - } - } - } - Throwable mostSpecificCause = e.getMostSpecificCause(); - String message = mostSpecificCause != null ? mostSpecificCause.getMessage() : e.getMessage(); - if (message == null) { - return false; - } - String lower = message.toLowerCase(); - return lower.contains("duplicate") && lower.contains("key"); - } - - /** - * 批量失败时降级逐行:允许调用方自定义“成功条数”的计算口径(例如:仅统计 insert 入库条数)。 - * - *

batchPersistCount / rowPersistCount 返回的是“需要累计的条数增量”,并不等同于“是否成功”。

- */ - public int persistChunkWithFallbackCount(List items, - List excelRowNumbers, - Supplier batchPersistCount, - BiFunction rowPersistCount, - List errorMessages) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - try { - return runInNewTx(batchPersistCount); - } catch (Exception batchException) { - int count = 0; - for (int i = 0; i < items.size(); i++) { - T item = items.get(i); - int excelRowNumber = (excelRowNumbers != null && i < excelRowNumbers.size()) ? excelRowNumbers.get(i) : -1; - try { - Integer delta = runInNewTx(() -> rowPersistCount.apply(item, excelRowNumber)); - if (delta != null && delta > 0) { - count += delta; - } - } catch (Exception e) { - if (errorMessages != null) { - if (excelRowNumber > 0) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - } else { - errorMessages.add(e.getMessage()); - } - } - } - } - return count; - } - } - - private static String normalize(String value) { - if (value == null) { - return null; - } - String trimmed = value.trim(); - return trimmed.isEmpty() ? null : trimmed; - } - - private static String normalizeCompanyName(String name) { - if (name == null) { - return null; - } - // 兼容 Excel/网页复制带来的全角空格 - String v = name.replace(' ', ' ').trim(); - return v.isEmpty() ? null : v; - } - - /** - * Split a "party names" cell into normalized company name candidates. - * Supports common separators used in Excel/web copy (comma/semicolon/Chinese list delimiter/newlines). - */ - private static List splitPartyNames(String raw) { - List result = new ArrayList<>(); - String v = normalizeCompanyName(raw); - if (v == null) { - return result; - } - String[] parts = PARTY_SPLIT_PATTERN.split(v); - if (parts == null || parts.length == 0) { - result.add(v); - return result; - } - for (String p : parts) { - String item = normalizeCompanyName(p); - if (item != null) { - result.add(item); - } - } - return result; - } - - private static void addCompanyNameMapping(Map idByName, - Map ambiguousByName, - String key, - Integer companyId) { - if (key == null || companyId == null) { - return; - } - Integer existing = idByName.get(key); - if (existing == null) { - idByName.put(key, companyId); - return; - } - if (!existing.equals(companyId)) { - ambiguousByName.put(key, 1); - } - } - - private static Integer extractId(T entity, SFunction idColumn) { - // SFunction 是 getter method ref,直接调用即可 - return idColumn.apply(entity); - } - - /** - * Multi-pattern substring matcher for company names (CreditCompany.name / matchName). - * Uses an Aho–Corasick automaton to scan each text only once. - */ - private static final class CompanyNameMatcher { - private static final int MIN_PATTERN_LEN = 4; // Avoid false positives in free text (e.g. person names) - - private static final class Node { - final Map next = new HashMap<>(); - final List out = new ArrayList<>(); - int fail = 0; - } - - private final List nodes; - private final int[] patternCompanyId; // 0 means ambiguous - private final int[] patternLen; - - private CompanyNameMatcher(List nodes, int[] patternCompanyId, int[] patternLen) { - this.nodes = nodes; - this.patternCompanyId = patternCompanyId; - this.patternLen = patternLen; - } - - static CompanyNameMatcher build(List companies) { - List nodes = new ArrayList<>(); - nodes.add(new Node()); // root - - Map patternIndex = new HashMap<>(); - List companyIds = new ArrayList<>(); - List patternLens = new ArrayList<>(); - - if (!CollectionUtils.isEmpty(companies)) { - for (CreditCompany c : companies) { - if (c == null || c.getId() == null) { - continue; - } - addPattern(nodes, patternIndex, companyIds, patternLens, normalizeCompanyName(c.getName()), c.getId()); - addPattern(nodes, patternIndex, companyIds, patternLens, normalizeCompanyName(c.getMatchName()), c.getId()); - } - } - - int[] patternCompanyId = new int[companyIds.size()]; - for (int i = 0; i < companyIds.size(); i++) { - patternCompanyId[i] = companyIds.get(i) != null ? companyIds.get(i) : 0; - } - int[] patternLen = new int[patternLens.size()]; - for (int i = 0; i < patternLens.size(); i++) { - patternLen[i] = patternLens.get(i) != null ? patternLens.get(i) : 0; - } - - buildFailureLinks(nodes); - return new CompanyNameMatcher(nodes, patternCompanyId, patternLen); - } - - private static void addPattern(List nodes, - Map patternIndex, - List companyIds, - List patternLens, - String pattern, - Integer companyId) { - if (pattern == null || companyId == null) { - return; - } - if (pattern.length() < MIN_PATTERN_LEN) { - return; - } - - Integer existingIndex = patternIndex.get(pattern); - if (existingIndex != null) { - // Same pattern maps to multiple companies -> mark ambiguous. - Integer oldCompanyId = companyIds.get(existingIndex); - if (oldCompanyId != null && !oldCompanyId.equals(companyId)) { - companyIds.set(existingIndex, null); - } - return; - } - - int state = 0; - for (int i = 0; i < pattern.length(); i++) { - char ch = pattern.charAt(i); - Integer next = nodes.get(state).next.get(ch); - if (next == null) { - next = nodes.size(); - nodes.get(state).next.put(ch, next); - nodes.add(new Node()); - } - state = next; - } - int idx = companyIds.size(); - companyIds.add(companyId); - patternLens.add(pattern.length()); - nodes.get(state).out.add(idx); - patternIndex.put(pattern, idx); - } - - private static void buildFailureLinks(List nodes) { - Queue q = new ArrayDeque<>(); - // Init depth-1 nodes - for (Map.Entry e : nodes.get(0).next.entrySet()) { - int s = e.getValue(); - nodes.get(s).fail = 0; - q.add(s); - } - while (!q.isEmpty()) { - int r = q.poll(); - for (Map.Entry e : nodes.get(r).next.entrySet()) { - char a = e.getKey(); - int s = e.getValue(); - q.add(s); - - int state = nodes.get(r).fail; - while (state != 0 && !nodes.get(state).next.containsKey(a)) { - state = nodes.get(state).fail; - } - Integer fs = nodes.get(state).next.get(a); - nodes.get(s).fail = (fs != null) ? fs : 0; - // Merge outputs from fail state - List out = nodes.get(nodes.get(s).fail).out; - if (!out.isEmpty()) { - nodes.get(s).out.addAll(out); - } - } - } - } - - static final class MatchResult { - final Integer companyId; // unique match - final boolean ambiguous; - - MatchResult(Integer companyId, boolean ambiguous) { - this.companyId = companyId; - this.ambiguous = ambiguous; - } - } - - MatchResult match(String text) { - String v = normalizeCompanyName(text); - if (v == null) { - return new MatchResult(null, false); - } - - int state = 0; - Integer bestCompanyId = null; - int bestStart = Integer.MAX_VALUE; - int bestLen = -1; - boolean ambiguous = false; - for (int i = 0; i < v.length(); i++) { - char ch = v.charAt(i); - while (state != 0 && !nodes.get(state).next.containsKey(ch)) { - state = nodes.get(state).fail; - } - Integer next = nodes.get(state).next.get(ch); - state = next != null ? next : 0; - - List out = nodes.get(state).out; - if (out.isEmpty()) { - continue; - } - for (Integer idx : out) { - if (idx == null || idx < 0 || idx >= patternCompanyId.length) { - continue; - } - int cid = patternCompanyId[idx]; - // Pattern exists but maps to multiple companies -> ignore this hit, keep looking for a unique one. - if (cid == 0) { - continue; - } - int len = (idx < patternLen.length) ? patternLen[idx] : 0; - int start = len > 0 ? (i - len + 1) : i; - if (bestCompanyId == null) { - bestCompanyId = cid; - bestStart = start; - bestLen = len; - continue; - } - if (start < bestStart) { - bestCompanyId = cid; - bestStart = start; - bestLen = len; - continue; - } - if (start == bestStart) { - // Prefer the longer (more specific) match at the same position. - if (len > bestLen) { - bestCompanyId = cid; - bestLen = len; - continue; - } - // Same position + same length but different companyId -> truly ambiguous. - if (len == bestLen && !bestCompanyId.equals(cid)) { - ambiguous = true; - break; - } - } - } - if (ambiguous) { - break; - } - } - - if (ambiguous) { - return new MatchResult(null, true); - } - return new MatchResult(bestCompanyId, false); - } - } -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java deleted file mode 100644 index f37fb09..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java +++ /dev/null @@ -1,543 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditAdministrativeLicense; -import com.gxwebsoft.credit.param.CreditAdministrativeLicenseImportParam; -import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditAdministrativeLicenseService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 行政许可控制器 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Tag(name = "行政许可管理") -@RestController -@RequestMapping("/api/credit/credit-administrative-license") -public class CreditAdministrativeLicenseController extends BaseController { - @Resource - private CreditAdministrativeLicenseService creditAdministrativeLicenseService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询行政许可") - @GetMapping("/page") - public ApiResult> page(CreditAdministrativeLicenseParam param) { - // 使用关联查询 - return success(creditAdministrativeLicenseService.pageRel(param)); - } - - @Operation(summary = "查询全部行政许可") - @GetMapping() - public ApiResult> list(CreditAdministrativeLicenseParam param) { - // 使用关联查询 - return success(creditAdministrativeLicenseService.listRel(param)); - } - - @Operation(summary = "根据id查询行政许可") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditAdministrativeLicenseService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:save')") - @OperationLog - @Operation(summary = "添加行政许可") - @PostMapping() - public ApiResult save(@RequestBody CreditAdministrativeLicense creditAdministrativeLicense) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditAdministrativeLicense.setUserId(loginUser.getUserId()); - // } - if (creditAdministrativeLicenseService.save(creditAdministrativeLicense)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:update')") - @OperationLog - @Operation(summary = "修改行政许可") - @PutMapping() - public ApiResult update(@RequestBody CreditAdministrativeLicense creditAdministrativeLicense) { - if (creditAdministrativeLicenseService.updateById(creditAdministrativeLicense)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:remove')") - @OperationLog - @Operation(summary = "删除行政许可") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditAdministrativeLicense.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:save')") - @OperationLog - @Operation(summary = "批量添加行政许可") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditAdministrativeLicenseService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:update')") - @OperationLog - @Operation(summary = "批量修改行政许可") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditAdministrativeLicenseService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:remove')") - @OperationLog - @Operation(summary = "批量删除行政许可") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditAdministrativeLicense.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditAdministrativeLicenseService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditAdministrativeLicense::getId, - CreditAdministrativeLicense::setId, - CreditAdministrativeLicense::getName, - CreditAdministrativeLicense::getCompanyId, - CreditAdministrativeLicense::setCompanyId, - CreditAdministrativeLicense::setCompanyName, - CreditAdministrativeLicense::getHasData, - CreditAdministrativeLicense::setHasData, - CreditAdministrativeLicense::getTenantId, - CreditAdministrativeLicense::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入行政许可 - */ - @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:save')") - @Operation(summary = "批量导入行政许可") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( - file, CreditAdministrativeLicenseImportParam.class, this::isEmptyImportRow); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号"); - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditAdministrativeLicenseImportParam param = list.get(i); - try { - CreditAdministrativeLicense item = convertImportParamToEntity(param); - String link = null; - if (!ImportHelper.isBlank(item.getCode())) { - link = urlByCode.get(item.getCode().trim()); - } - if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { - link = urlByName.get(item.getName().trim()); - } - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getName())) { - errorMessages.add("第" + excelRowNumber + "行:决定文书/许可证名称不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditAdministrativeLicenseService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditAdministrativeLicense::getName, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditAdministrativeLicenseService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditAdministrativeLicense::getName, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.ADMINISTRATIVE_LICENSE, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史行政许可(仅解析“历史行政许可”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:save')") - @Operation(summary = "批量导入历史行政许可") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史行政许可"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史行政许可”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditAdministrativeLicenseImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号"); - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditAdministrativeLicenseImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditAdministrativeLicense item = convertImportParamToEntity(param); - if (item.getCode() != null) { - item.setCode(item.getCode().trim()); - } - if (item.getName() != null) { - item.setName(item.getName().trim()); - } - - if (ImportHelper.isBlank(item.getName())) { - errorMessages.add("第" + excelRowNumber + "行:决定文书/许可证名称不能为空"); - continue; - } - - String link = null; - if (!ImportHelper.isBlank(item.getCode())) { - link = urlByCode.get(item.getCode()); - } - if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { - link = urlByName.get(item.getName()); - } - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditAdministrativeLicenseService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditAdministrativeLicense::getName, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditAdministrativeLicenseService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditAdministrativeLicense::getName, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.ADMINISTRATIVE_LICENSE, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载行政许可导入模板 - */ - @Operation(summary = "下载行政许可导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditAdministrativeLicenseImportParam example = new CreditAdministrativeLicenseImportParam(); - example.setCode("(2024)示例许可编号"); - example.setName("示例行政许可名称"); - example.setStatusText("有效"); - example.setType("行政许可"); - example.setValidityStart("2024-01-01"); - example.setValidityEnd("2029-01-01"); - example.setLicensingAuthority("某某许可机关"); - example.setLicenseContent("许可内容示例"); - example.setDataSourceUnit("数据来源单位示例"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("行政许可导入模板", "行政许可", CreditAdministrativeLicenseImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_administrative_license_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditAdministrativeLicenseImportParam param) { - if (param == null) { - return true; - } - if (isImportHeaderRow(param)) { - return true; - } - return ImportHelper.isBlank(param.getCode()) - && ImportHelper.isBlank(param.getName()) - && ImportHelper.isBlank(param.getStatusText()); - } - - private boolean isImportHeaderRow(CreditAdministrativeLicenseImportParam param) { - return isHeaderValue(param.getCode(), "决定文书/许可编号") - || isHeaderValue(param.getName(), "决定文书/许可证名称") - || isHeaderValue(param.getStatusText(), "许可状态"); - } - - private static boolean isHeaderValue(String value, String headerText) { - if (value == null) { - return false; - } - return headerText.equals(value.trim()); - } - - private CreditAdministrativeLicense convertImportParamToEntity(CreditAdministrativeLicenseImportParam param) { - CreditAdministrativeLicense entity = new CreditAdministrativeLicense(); - - entity.setCode(param.getCode()); - entity.setName(param.getName()); - entity.setStatusText(param.getStatusText()); - entity.setType(param.getType()); - entity.setValidityStart(param.getValidityStart()); - entity.setValidityEnd(param.getValidityEnd()); - entity.setLicensingAuthority(param.getLicensingAuthority()); - entity.setLicenseContent(param.getLicenseContent()); - entity.setDataSourceUnit(param.getDataSourceUnit()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditBankruptcyController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditBankruptcyController.java deleted file mode 100644 index a1f38c7..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditBankruptcyController.java +++ /dev/null @@ -1,507 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditBankruptcy; -import com.gxwebsoft.credit.param.CreditBankruptcyImportParam; -import com.gxwebsoft.credit.param.CreditBankruptcyParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditBankruptcyService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 破产重整控制器 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Tag(name = "破产重整管理") -@RestController -@RequestMapping("/api/credit/credit-bankruptcy") -public class CreditBankruptcyController extends BaseController { - @Resource - private CreditBankruptcyService creditBankruptcyService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询破产重整") - @GetMapping("/page") - public ApiResult> page(CreditBankruptcyParam param) { - // 使用关联查询 - return success(creditBankruptcyService.pageRel(param)); - } - - @Operation(summary = "查询全部破产重整") - @GetMapping() - public ApiResult> list(CreditBankruptcyParam param) { - // 使用关联查询 - return success(creditBankruptcyService.listRel(param)); - } - - @Operation(summary = "根据id查询破产重整") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditBankruptcyService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditBankruptcy:save')") - @OperationLog - @Operation(summary = "添加破产重整") - @PostMapping() - public ApiResult save(@RequestBody CreditBankruptcy creditBankruptcy) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditBankruptcy.setUserId(loginUser.getUserId()); - // } - if (creditBankruptcyService.save(creditBankruptcy)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBankruptcy:update')") - @OperationLog - @Operation(summary = "修改破产重整") - @PutMapping() - public ApiResult update(@RequestBody CreditBankruptcy creditBankruptcy) { - if (creditBankruptcyService.updateById(creditBankruptcy)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBankruptcy:remove')") - @OperationLog - @Operation(summary = "删除破产重整") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditBankruptcy.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBankruptcy:save')") - @OperationLog - @Operation(summary = "批量添加破产重整") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditBankruptcyService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBankruptcy:update')") - @OperationLog - @Operation(summary = "批量修改破产重整") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditBankruptcyService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBankruptcy:remove')") - @OperationLog - @Operation(summary = "批量删除破产重整") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditBankruptcy.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditBankruptcy:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditBankruptcyService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditBankruptcy::getId, - CreditBankruptcy::setId, - CreditBankruptcy::getParty, - CreditBankruptcy::getCompanyId, - CreditBankruptcy::setCompanyId, - CreditBankruptcy::getHasData, - CreditBankruptcy::setHasData, - CreditBankruptcy::getTenantId, - CreditBankruptcy::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入破产重整 - */ - @PreAuthorize("hasAuthority('credit:creditBankruptcy:save')") - @Operation(summary = "批量导入破产重整") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - // Prefer importing from the explicit tab name "破产重整" when present. - // This avoids accidentally importing from other sheets (e.g. "历史破产重整") in multi-sheet workbooks. - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "破产重整"); - ExcelImportSupport.ImportResult importResult; - if (sheetIndex >= 0) { - importResult = ExcelImportSupport.read(file, CreditBankruptcyImportParam.class, this::isEmptyImportRow, sheetIndex); - } else { - // Backward compatible: try any sheet for older templates without the expected tab name. - importResult = ExcelImportSupport.readAnySheet(file, CreditBankruptcyImportParam.class, this::isEmptyImportRow); - } - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditBankruptcyImportParam param = list.get(i); - try { - CreditBankruptcy item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCode())) { - String link = urlByCode.get(item.getCode().trim()); - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCode())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBankruptcyService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBankruptcy::getCode, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBankruptcyService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBankruptcy::getCode, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BANKRUPTCY, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史破产重整(仅解析“历史破产重整”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditBankruptcy:save')") - @Operation(summary = "批量导入历史破产重整") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史破产重整"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史破产重整”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditBankruptcyImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditBankruptcyImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditBankruptcy item = convertImportParamToEntity(param); - if (item.getCode() != null) { - item.setCode(item.getCode().trim()); - } - if (ImportHelper.isBlank(item.getCode())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCode.get(item.getCode()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBankruptcyService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBankruptcy::getCode, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBankruptcyService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBankruptcy::getCode, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BANKRUPTCY, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载破产重整导入模板 - */ - @Operation(summary = "下载破产重整导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditBankruptcyImportParam example = new CreditBankruptcyImportParam(); - example.setCode("(2024)示例案号"); - example.setType("破产清算"); - example.setParty("某某公司"); - example.setCourt("某某人民法院"); - example.setPublicDate("2024-01-10"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("破产重整导入模板", "破产重整", CreditBankruptcyImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_bankruptcy_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditBankruptcyImportParam param) { - if (param == null) { - return true; - } - if (isImportHeaderRow(param)) { - return true; - } - return ImportHelper.isBlank(param.getCode()) - && ImportHelper.isBlank(param.getParty()) - && ImportHelper.isBlank(param.getCourt()); - } - - private boolean isImportHeaderRow(CreditBankruptcyImportParam param) { - return isHeaderValue(param.getCode(), "案号") - || isHeaderValue(param.getType(), "案件类型") - || isHeaderValue(param.getParty(), "当事人"); - } - - private static boolean isHeaderValue(String value, String headerText) { - if (value == null) { - return false; - } - return headerText.equals(value.trim()); - } - - private CreditBankruptcy convertImportParamToEntity(CreditBankruptcyImportParam param) { - CreditBankruptcy entity = new CreditBankruptcy(); - - entity.setCode(param.getCode()); - entity.setType(param.getType()); - entity.setParty(param.getParty()); - entity.setCourt(param.getCourt()); - entity.setPublicDate(param.getPublicDate()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java deleted file mode 100644 index f6f70cc..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java +++ /dev/null @@ -1,380 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditBranch; -import com.gxwebsoft.credit.param.CreditBranchImportParam; -import com.gxwebsoft.credit.param.CreditBranchParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditBranchService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 分支机构控制器 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Tag(name = "分支机构管理") -@RestController -@RequestMapping("/api/credit/credit-branch") -public class CreditBranchController extends BaseController { - @Resource - private CreditBranchService creditBranchService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询分支机构") - @GetMapping("/page") - public ApiResult> page(CreditBranchParam param) { - // 使用关联查询 - return success(creditBranchService.pageRel(param)); - } - - @Operation(summary = "查询全部分支机构") - @GetMapping() - public ApiResult> list(CreditBranchParam param) { - // 使用关联查询 - return success(creditBranchService.listRel(param)); - } - - @Operation(summary = "根据id查询分支机构") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditBranchService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditBranch:save')") - @OperationLog - @Operation(summary = "添加分支机构") - @PostMapping() - public ApiResult save(@RequestBody CreditBranch creditBranch) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditBranch.setUserId(loginUser.getUserId()); - // } - if (creditBranchService.save(creditBranch)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBranch:update')") - @OperationLog - @Operation(summary = "修改分支机构") - @PutMapping() - public ApiResult update(@RequestBody CreditBranch creditBranch) { - if (creditBranchService.updateById(creditBranch)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBranch:remove')") - @OperationLog - @Operation(summary = "删除分支机构") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditBranch.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBranch:save')") - @OperationLog - @Operation(summary = "批量添加分支机构") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditBranchService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBranch:update')") - @OperationLog - @Operation(summary = "批量修改分支机构") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditBranchService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBranch:remove')") - @OperationLog - @Operation(summary = "批量删除分支机构") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditBranch.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditBranch:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditBranchService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditBranch::getId, - CreditBranch::setId, - CreditBranch::getName, - CreditBranch::getCompanyId, - CreditBranch::setCompanyId, - CreditBranch::setCompanyName, - CreditBranch::getHasData, - CreditBranch::setHasData, - CreditBranch::getTenantId, - CreditBranch::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入分支机构 - */ - @PreAuthorize("hasAuthority('credit:creditBranch:save')") - @Operation(summary = "批量导入分支机构") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( - file, CreditBranchImportParam.class, this::isEmptyImportRow); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "分支机构名称"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditBranchImportParam param = list.get(i); - try { - CreditBranch item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getName())) { - String link = urlByName.get(item.getName().trim()); - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getName())) { - errorMessages.add("第" + excelRowNumber + "行:分支机构名称不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBranchService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBranch::getName, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBranchService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBranch::getName, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BRANCH, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载分支机构导入模板 - */ - @Operation(summary = "下载分支机构导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditBranchImportParam example = new CreditBranchImportParam(); - example.setName("某某公司分支机构"); - example.setCurator("张三"); - example.setRegion("广西南宁"); - example.setEstablishDate("2020-06-01"); - example.setStatusText("存续"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("分支机构导入模板", "分支机构", CreditBranchImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_branch_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditBranchImportParam param) { - if (param == null) { - return true; - } - if (isImportHeaderRow(param)) { - return true; - } - return ImportHelper.isBlank(param.getName()) - && ImportHelper.isBlank(param.getCurator()) - && ImportHelper.isBlank(param.getRegion()); - } - - private boolean isImportHeaderRow(CreditBranchImportParam param) { - return isHeaderValue(param.getName(), "分支机构名称") - || isHeaderValue(param.getCurator(), "负责人") - || isHeaderValue(param.getRegion(), "地区"); - } - - private static boolean isHeaderValue(String value, String headerText) { - if (value == null) { - return false; - } - return headerText.equals(value.trim()); - } - - private CreditBranch convertImportParamToEntity(CreditBranchImportParam param) { - CreditBranch entity = new CreditBranch(); - - entity.setName(param.getName()); - entity.setCurator(param.getCurator()); - entity.setRegion(param.getRegion()); - entity.setEstablishDate(param.getEstablishDate()); - entity.setStatusText(param.getStatusText()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditBreachOfTrustController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditBreachOfTrustController.java deleted file mode 100644 index 963d84a..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditBreachOfTrustController.java +++ /dev/null @@ -1,513 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditBreachOfTrust; -import com.gxwebsoft.credit.param.CreditBreachOfTrustImportParam; -import com.gxwebsoft.credit.param.CreditBreachOfTrustParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditBreachOfTrustService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 失信被执行人控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:46:14 - */ -@Tag(name = "失信被执行人管理") -@RestController -@RequestMapping("/api/credit/credit-breach-of-trust") -public class CreditBreachOfTrustController extends BaseController { - @Resource - private CreditBreachOfTrustService creditBreachOfTrustService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询失信被执行人") - @GetMapping("/page") - public ApiResult> page(CreditBreachOfTrustParam param) { - // 使用关联查询 - return success(creditBreachOfTrustService.pageRel(param)); - } - - @Operation(summary = "查询全部失信被执行人") - @GetMapping() - public ApiResult> list(CreditBreachOfTrustParam param) { - // 使用关联查询 - return success(creditBreachOfTrustService.listRel(param)); - } - - @Operation(summary = "根据id查询失信被执行人") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditBreachOfTrustService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:save')") - @OperationLog - @Operation(summary = "添加失信被执行人") - @PostMapping() - public ApiResult save(@RequestBody CreditBreachOfTrust creditBreachOfTrust) { - if (creditBreachOfTrustService.save(creditBreachOfTrust)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:update')") - @OperationLog - @Operation(summary = "修改失信被执行人") - @PutMapping() - public ApiResult update(@RequestBody CreditBreachOfTrust creditBreachOfTrust) { - if (creditBreachOfTrustService.updateById(creditBreachOfTrust)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:remove')") - @OperationLog - @Operation(summary = "删除失信被执行人") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditBreachOfTrust.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:save')") - @OperationLog - @Operation(summary = "批量添加失信被执行人") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditBreachOfTrustService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:update')") - @OperationLog - @Operation(summary = "批量修改失信被执行人") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditBreachOfTrustService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:remove')") - @OperationLog - @Operation(summary = "批量删除失信被执行人") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditBreachOfTrust.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Party columns may contain multiple roles/names; match if any company name is contained in the text. - // Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人 - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditBreachOfTrustService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditBreachOfTrust::getId, - CreditBreachOfTrust::setId, - CreditBreachOfTrust::getCompanyId, - CreditBreachOfTrust::setCompanyId, - CreditBreachOfTrust::getHasData, - CreditBreachOfTrust::setHasData, - CreditBreachOfTrust::getTenantId, - CreditBreachOfTrust::new, - CreditBreachOfTrust::getPlaintiffAppellant, - CreditBreachOfTrust::getAppellee, - CreditBreachOfTrust::getOtherPartiesThirdParty - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入失信被执行人 - */ - @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:save')") - @Operation(summary = "批量导入失信被执行人") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "失信被执行人", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditBreachOfTrustImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditBreachOfTrustImportParam param = list.get(i); - try { - CreditBreachOfTrust item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCaseNumber())) { - String link = urlByCaseNumber.get(item.getCaseNumber().trim()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBreachOfTrustService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBreachOfTrust::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBreachOfTrustService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBreachOfTrust::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BREACH_OF_TRUST, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史失信被执行人(仅解析“历史失信被执行人”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:save')") - @Operation(summary = "批量导入历史失信被执行人") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史失信被执行人"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史失信被执行人”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditBreachOfTrustImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - // 同案号多条:以导入文件中“最后一条”为准(视为最新) - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditBreachOfTrustImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditBreachOfTrust item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCaseNumber.get(item.getCaseNumber()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBreachOfTrustService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBreachOfTrust::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditBreachOfTrustService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditBreachOfTrust::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BREACH_OF_TRUST, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载失信被执行人导入模板 - */ - @Operation(summary = "下载失信被执行人导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditBreachOfTrustImportParam example = new CreditBreachOfTrustImportParam(); - example.setDataType("失信被执行人"); - example.setCaseNumber("(2024)示例案号"); - example.setPlaintiffAppellant("原告示例"); - example.setAppellee("被告示例"); - example.setOtherPartiesThirdParty("第三人示例"); - example.setInvolvedAmount("20,293.91"); - example.setDataStatus("正常"); - example.setOccurrenceTime("2024-01-01"); - example.setCourtName("示例法院"); - example.setReleaseDate("2024-01-01"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("失信被执行人导入模板", "失信被执行人", CreditBreachOfTrustImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_breach_of_trust_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditBreachOfTrustImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()) - && ImportHelper.isBlank(param.getPlaintiffAppellant()) - && ImportHelper.isBlank(param.getPlaintiffAppellant2()) - && ImportHelper.isBlank(param.getAppellee()) - && ImportHelper.isBlank(param.getAppellee2()); - } - - private CreditBreachOfTrust convertImportParamToEntity(CreditBreachOfTrustImportParam param) { - CreditBreachOfTrust entity = new CreditBreachOfTrust(); - - entity.setDataType(param.getDataType()); - entity.setCaseNumber(param.getCaseNumber()); - - String plaintiffAppellant = !ImportHelper.isBlank(param.getPlaintiffAppellant2()) - ? param.getPlaintiffAppellant2() - : param.getPlaintiffAppellant(); - entity.setPlaintiffAppellant(plaintiffAppellant); - - String appellee = !ImportHelper.isBlank(param.getAppellee2()) - ? param.getAppellee2() - : param.getAppellee(); - entity.setAppellee(appellee); - - entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty()); - entity.setDataStatus(param.getDataStatus()); - - entity.setInvolvedAmount(!ImportHelper.isBlank(param.getInvolvedAmount2()) - ? param.getInvolvedAmount2() - : param.getInvolvedAmount()); - entity.setOccurrenceTime(!ImportHelper.isBlank(param.getOccurrenceTime2()) - ? param.getOccurrenceTime2() - : param.getOccurrenceTime()); - entity.setCourtName(!ImportHelper.isBlank(param.getCourtName2()) - ? param.getCourtName2() - : param.getCourtName()); - entity.setReleaseDate(param.getReleaseDate()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCaseFilingController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCaseFilingController.java deleted file mode 100644 index faf3d21..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditCaseFilingController.java +++ /dev/null @@ -1,525 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCaseFiling; -import com.gxwebsoft.credit.param.CreditCaseFilingImportParam; -import com.gxwebsoft.credit.param.CreditCaseFilingParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditCaseFilingService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 司法大数据控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:47:23 - */ -@Tag(name = "司法大数据管理") -@RestController -@RequestMapping("/api/credit/credit-case-filing") -public class CreditCaseFilingController extends BaseController { - @Resource - private CreditCaseFilingService creditCaseFilingService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询司法大数据") - @GetMapping("/page") - public ApiResult> page(CreditCaseFilingParam param) { - // 使用关联查询 - return success(creditCaseFilingService.pageRel(param)); - } - - @Operation(summary = "查询全部司法大数据") - @GetMapping() - public ApiResult> list(CreditCaseFilingParam param) { - // 使用关联查询 - return success(creditCaseFilingService.listRel(param)); - } - - @Operation(summary = "根据id查询司法大数据") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditCaseFilingService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditCaseFiling:save')") - @OperationLog - @Operation(summary = "添加司法大数据") - @PostMapping() - public ApiResult save(@RequestBody CreditCaseFiling creditCaseFiling) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditCaseFiling.setUserId(loginUser.getUserId()); - // } - if (creditCaseFilingService.save(creditCaseFiling)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCaseFiling:update')") - @OperationLog - @Operation(summary = "修改司法大数据") - @PutMapping() - public ApiResult update(@RequestBody CreditCaseFiling creditCaseFiling) { - if (creditCaseFilingService.updateById(creditCaseFiling)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCaseFiling:remove')") - @OperationLog - @Operation(summary = "删除司法大数据") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditCaseFiling.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCaseFiling:save')") - @OperationLog - @Operation(summary = "批量添加司法大数据") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditCaseFilingService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCaseFiling:update')") - @OperationLog - @Operation(summary = "批量修改司法大数据") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditCaseFilingService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCaseFiling:remove')") - @OperationLog - @Operation(summary = "批量删除司法大数据") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditCaseFiling.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditCaseFiling:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Special: party columns may contain multiple roles/names; match if any company name is contained in the text. - // Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人 - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditCaseFilingService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditCaseFiling::getId, - CreditCaseFiling::setId, - CreditCaseFiling::getCompanyId, - CreditCaseFiling::setCompanyId, - CreditCaseFiling::getHasData, - CreditCaseFiling::setHasData, - CreditCaseFiling::getTenantId, - CreditCaseFiling::new, - CreditCaseFiling::getPlaintiffAppellant, - CreditCaseFiling::getAppellee, - CreditCaseFiling::getOtherPartiesThirdParty - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入立案信息 - */ - @PreAuthorize("hasAuthority('credit:creditCaseFiling:save')") - @Operation(summary = "批量导入立案信息") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "立案信息", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditCaseFilingImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - // easypoi 默认不会读取单元格超链接地址;url 通常挂在“案号”列的超链接中,需要额外读取回填。 - Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditCaseFilingImportParam param = list.get(i); - try { - CreditCaseFiling item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCaseNumber())) { - String link = urlByCaseNumber.get(item.getCaseNumber().trim()); - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCaseFilingService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCaseFiling::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCaseFilingService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCaseFiling::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.CASE_FILING, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史立案信息(仅解析“历史立案信息”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditCaseFiling:save')") - @Operation(summary = "批量导入历史立案信息") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史立案信息"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史立案信息”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditCaseFilingImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditCaseFilingImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditCaseFiling item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCaseNumber.get(item.getCaseNumber()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCaseFilingService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCaseFiling::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCaseFilingService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCaseFiling::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.CASE_FILING, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载立案信息导入模板 - */ - @Operation(summary = "下载立案信息导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditCaseFilingImportParam example = new CreditCaseFilingImportParam(); - example.setDataType("立案信息"); - example.setPlaintiffAppellant("原告示例"); - example.setAppellee("被告示例"); - example.setOtherPartiesThirdParty2("第三人示例"); - example.setInvolvedAmount("100000"); - example.setDataStatus("正常"); - example.setCaseNumber("(2024)示例案号"); - example.setCauseOfAction("案由示例"); - example.setCourtName("示例法院"); - example.setOccurrenceTime("2024-01-01"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("立案信息导入模板", "立案信息", CreditCaseFilingImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_case_filing_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditCaseFilingImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()) - && ImportHelper.isBlank(param.getPlaintiffAppellant()) - && ImportHelper.isBlank(param.getAppellee()) - && ImportHelper.isBlank(param.getCauseOfAction()) - && ImportHelper.isBlank(param.getOtherPartiesThirdParty()) - && ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) - && ImportHelper.isBlank(param.getCourtName()) - && ImportHelper.isBlank(param.getCourtName2()) - && ImportHelper.isBlank(param.getOccurrenceTime()) - && ImportHelper.isBlank(param.getOccurrenceTime2()) - && ImportHelper.isBlank(param.getInvolvedAmount()) - && ImportHelper.isBlank(param.getInvolvedAmount2()) - && ImportHelper.isBlank(param.getDataStatus()) - && ImportHelper.isBlank(param.getDataType()) - && ImportHelper.isBlank(param.getComments()); - } - - private CreditCaseFiling convertImportParamToEntity(CreditCaseFilingImportParam param) { - CreditCaseFiling entity = new CreditCaseFiling(); - - // Template compatibility: prefer new columns when present. - String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) - ? param.getOccurrenceTime2() - : param.getOccurrenceTime(); - String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) - ? param.getOtherPartiesThirdParty2() - : param.getOtherPartiesThirdParty(); - String courtName = !ImportHelper.isBlank(param.getCourtName2()) - ? param.getCourtName2() - : param.getCourtName(); - String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) - ? param.getInvolvedAmount2() - : param.getInvolvedAmount(); - - entity.setDataType(param.getDataType()); - entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); - entity.setAppellee(param.getAppellee()); - entity.setDataStatus(param.getDataStatus()); - - entity.setCaseNumber(param.getCaseNumber()); - entity.setCauseOfAction(param.getCauseOfAction()); - entity.setOtherPartiesThirdParty(otherPartiesThirdParty); - entity.setCourtName(courtName); - entity.setOccurrenceTime(occurrenceTime); - entity.setInvolvedAmount(involvedAmount); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java deleted file mode 100644 index 4f3efcc..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java +++ /dev/null @@ -1,567 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.ExcelImportUtil; -import cn.afterturn.easypoi.excel.entity.ExportParams; -import cn.afterturn.easypoi.excel.entity.ImportParams; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.param.CreditCompanyImportParam; -import com.gxwebsoft.credit.param.CreditCompanyParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 企业控制器 - * - * @author 科技小王子 - * @since 2025-12-17 08:28:03 - */ -@Tag(name = "企业管理") -@RestController -@RequestMapping("/api/credit/credit-company") -public class CreditCompanyController extends BaseController { - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询企业") - @GetMapping("/page") - public ApiResult> page(CreditCompanyParam param) { - // 使用关联查询 - return success(creditCompanyService.pageRel(param)); - } - - @Operation(summary = "查询全部企业") - @GetMapping() - public ApiResult> list(CreditCompanyParam param) { - // 使用关联查询 - return success(creditCompanyService.listRel(param)); - } - - @Operation(summary = "根据id查询企业") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditCompanyService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditCompany:save')") - @OperationLog - @Operation(summary = "添加企业") - @PostMapping() - public ApiResult save(@RequestBody CreditCompany creditCompany) { - if (creditCompanyService.save(creditCompany)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompany:update')") - @OperationLog - @Operation(summary = "修改企业") - @PutMapping() - public ApiResult update(@RequestBody CreditCompany creditCompany) { - if (creditCompanyService.updateById(creditCompany)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompany:remove')") - @OperationLog - @Operation(summary = "删除企业") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditCompany.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompany:save')") - @OperationLog - @Operation(summary = "批量添加企业") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditCompanyService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompany:update')") - @OperationLog - @Operation(summary = "批量修改企业") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditCompanyService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompany:remove')") - @OperationLog - @Operation(summary = "批量删除企业") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditCompany.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 批量导入企业 - */ - @PreAuthorize("hasAuthority('credit:creditJudiciary:save')") - @Operation(summary = "批量导入企业") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int insertedCount = 0; - Set touchedMatchNames = new HashSet<>(); - String refreshWarning = null; - - try { - List list = null; - int usedTitleRows = 0; - int usedHeadRows = 0; - int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {0, 2}, {0, 3}}; - - for (int[] config : tryConfigs) { - list = filterEmptyRows(tryImport(file, config[0], config[1])); - if (!CollectionUtils.isEmpty(list)) { - usedTitleRows = config[0]; - usedHeadRows = config[1]; - break; - } - } - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, 0, usedTitleRows, usedHeadRows, "原文件导入名称"); - Map urlByMatchName = ExcelImportSupport.readHyperlinksByHeaderKey(file, 0, usedTitleRows, usedHeadRows, "系统匹配企业名称"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditCompanyImportParam param = list.get(i); - try { - CreditCompany item = convertImportParamToEntity(param); - String link = null; - if (item.getName() != null) { - link = urlByName.get(item.getName().trim()); - } - if ((link == null || link.isEmpty()) && item.getMatchName() != null) { - link = urlByMatchName.get(item.getMatchName().trim()); - } - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - - // 设置默认值 - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - // 验证必填字段 - if (item.getMatchName() == null || item.getMatchName().trim().isEmpty()) { - errorMessages.add("第" + excelRowNumber + "行:项目名称不能为空"); - continue; - } -// if (item.getCode() == null || item.getCode().trim().isEmpty()) { -// errorMessages.add("第" + excelRowNumber + "行:唯一标识不能为空"); -// continue; -// } - - touchedMatchNames.add(item.getMatchName().trim()); - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - insertedCount += batchImportSupport.persistChunkWithFallbackCount( - chunkItems, - chunkRowNumbers, - () -> { - int delta = countInsertedByMatchName(chunkItems); - batchImportSupport.upsertBySingleKey( - creditCompanyService, - chunkItems, - CreditCompany::getId, - CreditCompany::setId, - CreditCompany::getMatchName, - CreditCompany::getMatchName, - null, - mpBatchSize - ); - return delta; - }, - (rowItem, rowNumber) -> { - boolean saved = creditCompanyService.save(rowItem); - if (saved) { - return 1; // insert 入库 - } - CreditCompany existing = creditCompanyService.getByMatchName(rowItem.getMatchName()); - if (existing != null) { - rowItem.setId(existing.getId()); - if (creditCompanyService.updateById(rowItem)) { - return 0; // update 不计入“入库”条数 - } - } - throw new RuntimeException("保存失败"); - }, - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - insertedCount += batchImportSupport.persistChunkWithFallbackCount( - chunkItems, - chunkRowNumbers, - () -> { - int delta = countInsertedByMatchName(chunkItems); - batchImportSupport.upsertBySingleKey( - creditCompanyService, - chunkItems, - CreditCompany::getId, - CreditCompany::setId, - CreditCompany::getMatchName, - CreditCompany::getMatchName, - null, - mpBatchSize - ); - return delta; - }, - (rowItem, rowNumber) -> { - boolean saved = creditCompanyService.save(rowItem); - if (saved) { - return 1; // insert 入库 - } - CreditCompany existing = creditCompanyService.getByMatchName(rowItem.getMatchName()); - if (existing != null) { - rowItem.setId(existing.getId()); - if (creditCompanyService.updateById(rowItem)) { - return 0; // update 不计入“入库”条数 - } - } - throw new RuntimeException("保存失败"); - }, - errorMessages - ); - } - - // 导入完成后,按 matchName 定位本次涉及的企业并回填“关联记录数”字段(避免 companyId/自增 id 在导入对象里拿不到)。 - if (!touchedMatchNames.isEmpty()) { - Set touchedCompanyIds = new HashSet<>(); - List allMatchNames = new ArrayList<>(touchedMatchNames); - final int inChunkSize = 800; - for (int i = 0; i < allMatchNames.size(); i += inChunkSize) { - List chunk = allMatchNames.subList(i, Math.min(allMatchNames.size(), i + inChunkSize)); - List dbRows = creditCompanyService.lambdaQuery() - .select(CreditCompany::getId) - .in(CreditCompany::getMatchName, chunk) - .list(); - if (!CollectionUtils.isEmpty(dbRows)) { - for (CreditCompany row : dbRows) { - if (row != null && row.getId() != null) { - touchedCompanyIds.add(row.getId()); - } - } - } - } - try { - creditCompanyRecordCountService.refreshAll(touchedCompanyIds); - } catch (Exception ex) { - // 导入本身已经成功写入,回填计数字段失败不应导致整个导入失败(可后续单独重试刷新)。 - String msg = ex.getMessage(); - if (msg != null && msg.length() > 300) { - msg = msg.substring(0, 300) + "..."; - } - refreshWarning = "关联记录数回填失败:" + (msg != null ? msg : ex.getClass().getSimpleName()); - ex.printStackTrace(); - } - } - - if (errorMessages.isEmpty()) { - String msg = "成功入库" + insertedCount + "条数据"; - if (refreshWarning != null) { - msg = msg + ";" + refreshWarning; - } - return success(msg, null); - } else { - String msg = "导入完成,入库" + insertedCount + "条,失败" + errorMessages.size() + "条"; - if (refreshWarning != null) { - msg = msg + ";" + refreshWarning; - } - return success(msg, errorMessages); - } - - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载企业导入模板 - */ - @Operation(summary = "下载企业导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditCompanyImportParam example = new CreditCompanyImportParam(); - example.setName("示例客户"); - example.setCode("C0001"); - example.setMatchName("匹配名称"); - example.setRegistrationStatus("登记状态"); - example.setLegalPerson("法定代表人"); - example.setRegisteredCapital("注册资本"); - example.setPaidinCapital("实缴资本"); - example.setEstablishDate("成立日期"); - example.setAddress("地址"); - example.setTel("电话"); - example.setMoreTel("更多电话"); - example.setEmail("邮箱"); - example.setMoreEmail("更多邮箱"); - example.setProvince("省"); - example.setCity("市"); - example.setRegion("区"); - example.setInstitutionType("机构类型"); - example.setTaxpayerCode("纳税人识别号"); - example.setRegistrationNumber("注册号"); - example.setOrganizationalCode("组织机构代码"); - example.setNumberOfInsuredPersons("参保人数"); - example.setAnnualReport("入库时间"); - example.setBusinessTerm("营业期限"); - example.setNationalStandardIndustryCategories("国标行业门类"); - example.setNationalStandardIndustryCategories2("国标行业大类"); - example.setNationalStandardIndustryCategories3("国标行业中类"); - example.setNationalStandardIndustryCategories4("国标行业小类"); - example.setNationalStandardIndustryCategories5("企查查行业门类"); - example.setNationalStandardIndustryCategories6("企查查行业大类"); - example.setNationalStandardIndustryCategories7("企查查行业中类"); - example.setNationalStandardIndustryCategories8("企查查行业小类"); - example.setCompanySize("企业规模"); - example.setFormerName("曾用名"); - example.setEnglishName("英文名"); - example.setDomain("官网"); - example.setMailingAddress("通信地址"); - example.setCompanyProfile("企业简介"); - example.setNatureOfBusiness("经营范围"); - example.setRegistrationAuthority("登记机关"); - example.setTaxpayerQualification("纳税人资质"); - example.setLatestAnnualReportYear("最新年报年份"); - example.setLatestAnnualReportOnOperatingRevenue("最新年报营业额"); - example.setEnterpriseScoreCheck("企查分"); - example.setCreditRating("信用等级"); - example.setCechnologyScore("科创分"); - example.setCechnologyLevel("科创等级"); - example.setSmallEnterprise("是否小微企业"); - templateList.add(example); - - ExportParams exportParams = new ExportParams("一级企业主表导入模板", "企业"); - - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, CreditCompanyImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_company_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private List tryImport(MultipartFile file, int titleRows, int headRows) throws Exception { - ImportParams importParams = new ImportParams(); - importParams.setTitleRows(titleRows); - importParams.setHeadRows(headRows); - importParams.setStartSheetIndex(0); - importParams.setSheetNum(1); - return ExcelImportUtil.importExcel(file.getInputStream(), CreditCompanyImportParam.class, importParams); - } - - /** - * 过滤掉完全空白的导入行,避免空行导致导入失败 - */ - private List filterEmptyRows(List rawList) { - if (CollectionUtils.isEmpty(rawList)) { - return rawList; - } - rawList.removeIf(this::isEmptyImportRow); - return rawList; - } - - private boolean isEmptyImportRow(CreditCompanyImportParam param) { - if (param == null) { - return true; - } - return isBlank(param.getName()) - && isBlank(param.getCode()); - } - - private boolean isBlank(String value) { - return value == null || value.trim().isEmpty(); - } - - /** - * 入库条数以 insert 为准:matchName 在数据库中不存在时计 1,否则计 0。 - * - *

统计口径需与批量 upsert 的匹配字段保持一致(matchName)。

- */ - private int countInsertedByMatchName(List items) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - List matchNames = new ArrayList<>(items.size()); - for (CreditCompany item : items) { - if (item == null) { - continue; - } - String key = item.getMatchName(); - if (!isBlank(key)) { - matchNames.add(key.trim()); - } - } - if (matchNames.isEmpty()) { - return 0; - } - - Set existing = new HashSet<>(); - List dbRows = creditCompanyService.lambdaQuery() - .select(CreditCompany::getMatchName) - .in(CreditCompany::getMatchName, matchNames) - .list(); - if (!CollectionUtils.isEmpty(dbRows)) { - for (CreditCompany row : dbRows) { - String v = row != null ? row.getMatchName() : null; - if (!isBlank(v)) { - existing.add(v.trim()); - } - } - } - - int count = 0; - for (CreditCompany item : items) { - String key = item != null ? item.getMatchName() : null; - if (!isBlank(key) && !existing.contains(key.trim())) { - count++; - } - } - return count; - } - - /** - * 将CreditCompanyImportParam转换为CreditCompany实体 - */ - private CreditCompany convertImportParamToEntity(CreditCompanyImportParam param) { - CreditCompany entity = new CreditCompany(); - - entity.setCode(param.getCode()); - entity.setName(param.getName()); - entity.setMatchName(param.getMatchName()); - entity.setRegistrationStatus(param.getRegistrationStatus()); - entity.setLegalPerson(param.getLegalPerson()); - entity.setRegisteredCapital(param.getRegisteredCapital()); - entity.setPaidinCapital(param.getPaidinCapital()); - entity.setEstablishDate(param.getEstablishDate()); - entity.setAddress(param.getAddress()); - entity.setTel(param.getTel()); - entity.setMoreTel(param.getMoreTel()); - entity.setEmail(param.getEmail()); - entity.setMoreEmail(param.getMoreEmail()); - entity.setProvince(param.getProvince()); - entity.setCity(param.getCity()); - entity.setRegion(param.getRegion()); - entity.setInstitutionType(param.getInstitutionType()); - entity.setTaxpayerCode(param.getTaxpayerCode()); - entity.setRegistrationNumber(param.getRegistrationNumber()); - entity.setOrganizationalCode(param.getOrganizationalCode()); - entity.setNumberOfInsuredPersons(param.getNumberOfInsuredPersons()); - entity.setAnnualReport(param.getAnnualReport()); - entity.setBusinessTerm(param.getBusinessTerm()); - entity.setNationalStandardIndustryCategories(param.getNationalStandardIndustryCategories()); - entity.setNationalStandardIndustryCategories2(param.getNationalStandardIndustryCategories2()); - entity.setNationalStandardIndustryCategories3(param.getNationalStandardIndustryCategories3()); - entity.setNationalStandardIndustryCategories4(param.getNationalStandardIndustryCategories4()); - entity.setNationalStandardIndustryCategories5(param.getNationalStandardIndustryCategories5()); - entity.setNationalStandardIndustryCategories6(param.getNationalStandardIndustryCategories6()); - entity.setNationalStandardIndustryCategories7(param.getNationalStandardIndustryCategories7()); - entity.setNationalStandardIndustryCategories8(param.getNationalStandardIndustryCategories8()); - entity.setCompanySize(param.getCompanySize()); - entity.setFormerName(param.getFormerName()); - entity.setEnglishName(param.getEnglishName()); - entity.setDomain(param.getDomain()); - entity.setMailingAddress(param.getMailingAddress()); - entity.setCompanyProfile(param.getCompanyProfile()); - entity.setNatureOfBusiness(param.getNatureOfBusiness()); - entity.setRegistrationAuthority(param.getRegistrationAuthority()); - entity.setTaxpayerQualification(param.getTaxpayerQualification()); - entity.setLatestAnnualReportYear(param.getLatestAnnualReportYear()); - entity.setLatestAnnualReportOnOperatingRevenue(param.getLatestAnnualReportOnOperatingRevenue()); - entity.setEnterpriseScoreCheck(param.getEnterpriseScoreCheck()); - entity.setCreditRating(param.getCreditRating()); - entity.setCechnologyScore(param.getCechnologyScore()); - entity.setCechnologyLevel(param.getCechnologyLevel()); - entity.setSmallEnterprise(param.getSmallEnterprise()); - - return entity; - } - - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java deleted file mode 100644 index 2a73a74..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java +++ /dev/null @@ -1,372 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditCompetitor; -import com.gxwebsoft.credit.param.CreditCompetitorImportParam; -import com.gxwebsoft.credit.param.CreditCompetitorParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditCompetitorService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 竞争对手控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:05 - */ -@Tag(name = "竞争对手管理") -@RestController -@RequestMapping("/api/credit/credit-competitor") -public class CreditCompetitorController extends BaseController { - @Resource - private CreditCompetitorService creditCompetitorService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询竞争对手") - @GetMapping("/page") - public ApiResult> page(CreditCompetitorParam param) { - // 使用关联查询 - return success(creditCompetitorService.pageRel(param)); - } - - @Operation(summary = "查询全部竞争对手") - @GetMapping() - public ApiResult> list(CreditCompetitorParam param) { - // 使用关联查询 - return success(creditCompetitorService.listRel(param)); - } - - @Operation(summary = "根据id查询竞争对手") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditCompetitorService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditCompetitor:save')") - @OperationLog - @Operation(summary = "添加竞争对手") - @PostMapping() - public ApiResult save(@RequestBody CreditCompetitor creditCompetitor) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditCompetitor.setUserId(loginUser.getUserId()); - // } - if (creditCompetitorService.save(creditCompetitor)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompetitor:update')") - @OperationLog - @Operation(summary = "修改竞争对手") - @PutMapping() - public ApiResult update(@RequestBody CreditCompetitor creditCompetitor) { - if (creditCompetitorService.updateById(creditCompetitor)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompetitor:remove')") - @OperationLog - @Operation(summary = "删除竞争对手") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditCompetitor.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompetitor:save')") - @OperationLog - @Operation(summary = "批量添加竞争对手") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditCompetitorService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompetitor:update')") - @OperationLog - @Operation(summary = "批量修改竞争对手") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditCompetitorService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCompetitor:remove')") - @OperationLog - @Operation(summary = "批量删除竞争对手") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditCompetitor.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditCompetitor:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditCompetitorService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditCompetitor::getId, - CreditCompetitor::setId, - CreditCompetitor::getName, - CreditCompetitor::getCompanyId, - CreditCompetitor::setCompanyId, - CreditCompetitor::setCompanyName, - CreditCompetitor::getHasData, - CreditCompetitor::setHasData, - CreditCompetitor::getTenantId, - CreditCompetitor::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入竞争对手 - */ - @PreAuthorize("hasAuthority('credit:creditCompetitor:save')") - @Operation(summary = "批量导入竞争对手") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "竞争对手", 2); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditCompetitorImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByName = ExcelImportSupport.readUrlByKey( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditCompetitorImportParam param = list.get(i); - try { - CreditCompetitor item = convertImportParamToEntity(param); - // name 为竞争对手企业名称;companyName 为主体企业名称。 - if (!ImportHelper.isBlank(item.getName())) { - String link = urlByName.get(item.getName().trim()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getName())) { - errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCompetitorService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCompetitor::getName, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCompetitorService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCompetitor::getName, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COMPETITOR, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载竞争对手导入模板 - */ - @Operation(summary = "下载竞争对手导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditCompetitorImportParam example = new CreditCompetitorImportParam(); - example.setName("示例科技有限公司"); - example.setLegalRepresentative("张三"); - example.setRegisteredCapital("5000"); - example.setEstablishmentDate("2015-01-01"); - example.setRegistrationStatus("存续"); - example.setIndustry("软件和信息服务业"); - example.setProvince("广东省"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("竞争对手导入模板", "竞争对手", CreditCompetitorImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_competitor_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditCompetitorImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getName()) - && ImportHelper.isBlank(param.getLegalRepresentative()) - && ImportHelper.isBlank(param.getRegisteredCapital()) - && ImportHelper.isBlank(param.getEstablishmentDate()); - } - - private CreditCompetitor convertImportParamToEntity(CreditCompetitorImportParam param) { - CreditCompetitor entity = new CreditCompetitor(); - - entity.setName(param.getName()); - entity.setLegalRepresentative(param.getLegalRepresentative()); - entity.setRegisteredCapital(param.getRegisteredCapital()); - entity.setEstablishmentDate(param.getEstablishmentDate()); - entity.setRegistrationStatus(param.getRegistrationStatus()); - entity.setIndustry(param.getIndustry()); - entity.setProvince(param.getProvince()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCourtAnnouncementController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCourtAnnouncementController.java deleted file mode 100644 index 840985d..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditCourtAnnouncementController.java +++ /dev/null @@ -1,517 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCourtAnnouncement; -import com.gxwebsoft.credit.param.CreditCourtAnnouncementImportParam; -import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditCourtAnnouncementService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 法院公告司法大数据控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:13 - */ -@Tag(name = "法院公告司法大数据管理") -@RestController -@RequestMapping("/api/credit/credit-court-announcement") -public class CreditCourtAnnouncementController extends BaseController { - @Resource - private CreditCourtAnnouncementService creditCourtAnnouncementService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询法院公告司法大数据") - @GetMapping("/page") - public ApiResult> page(CreditCourtAnnouncementParam param) { - // 使用关联查询 - return success(creditCourtAnnouncementService.pageRel(param)); - } - - @Operation(summary = "查询全部法院公告司法大数据") - @GetMapping() - public ApiResult> list(CreditCourtAnnouncementParam param) { - // 使用关联查询 - return success(creditCourtAnnouncementService.listRel(param)); - } - - @Operation(summary = "根据id查询法院公告司法大数据") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditCourtAnnouncementService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:save')") - @OperationLog - @Operation(summary = "添加法院公告司法大数据") - @PostMapping() - public ApiResult save(@RequestBody CreditCourtAnnouncement creditCourtAnnouncement) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditCourtAnnouncement.setUserId(loginUser.getUserId()); - // } - if (creditCourtAnnouncementService.save(creditCourtAnnouncement)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:update')") - @OperationLog - @Operation(summary = "修改法院公告司法大数据") - @PutMapping() - public ApiResult update(@RequestBody CreditCourtAnnouncement creditCourtAnnouncement) { - if (creditCourtAnnouncementService.updateById(creditCourtAnnouncement)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:remove')") - @OperationLog - @Operation(summary = "删除法院公告司法大数据") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditCourtAnnouncement.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:save')") - @OperationLog - @Operation(summary = "批量添加法院公告司法大数据") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditCourtAnnouncementService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:update')") - @OperationLog - @Operation(summary = "批量修改法院公告司法大数据") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditCourtAnnouncementService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:remove')") - @OperationLog - @Operation(summary = "批量删除法院公告司法大数据") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditCourtAnnouncement.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Party columns may contain multiple roles/names; match if any company name is contained in the text. - // Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人 - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditCourtAnnouncementService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditCourtAnnouncement::getId, - CreditCourtAnnouncement::setId, - CreditCourtAnnouncement::getCompanyId, - CreditCourtAnnouncement::setCompanyId, - CreditCourtAnnouncement::getHasData, - CreditCourtAnnouncement::setHasData, - CreditCourtAnnouncement::getTenantId, - CreditCourtAnnouncement::new, - CreditCourtAnnouncement::getPlaintiffAppellant, - CreditCourtAnnouncement::getAppellee, - CreditCourtAnnouncement::getOtherPartiesThirdParty - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入法院公告司法大数据 - */ - @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:save')") - @Operation(summary = "批量导入法院公告司法大数据") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - // 兼容多 sheet 文件:优先定位“法院公告”sheet,否则默认第 0 个。 - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "法院公告", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditCourtAnnouncementImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditCourtAnnouncementImportParam param = list.get(i); - try { - CreditCourtAnnouncement item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCaseNumber())) { - String link = urlByCaseNumber.get(item.getCaseNumber().trim()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCourtAnnouncementService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCourtAnnouncement::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCourtAnnouncementService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCourtAnnouncement::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_ANNOUNCEMENT, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史法院公告(仅解析“历史法院公告”选项卡;兼容“历史法庭公告”) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:save')") - @Operation(summary = "批量导入历史法院公告司法大数据") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史法院公告"); - if (sheetIndex < 0) { - // 兼容旧命名 - sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史法庭公告"); - } - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史法院公告”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditCourtAnnouncementImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditCourtAnnouncementImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditCourtAnnouncement item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCaseNumber.get(item.getCaseNumber()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCourtAnnouncementService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCourtAnnouncement::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCourtAnnouncementService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCourtAnnouncement::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_ANNOUNCEMENT, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载法院公告司法大数据导入模板 - */ - @Operation(summary = "下载法院公告司法大数据导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditCourtAnnouncementImportParam example = new CreditCourtAnnouncementImportParam(); - example.setDataType("法院公告"); - example.setPlaintiffAppellant("原告示例"); - example.setAppellee("被告示例"); - example.setOtherPartiesThirdParty("第三人示例"); - example.setOccurrenceTime("2024-01-01"); - example.setCaseNumber("(2024)示例案号"); - example.setCauseOfAction("案由示例"); - example.setCourtName("示例法院"); - example.setInvolvedAmount("100000"); - example.setDataStatus("正常"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("法院公告导入模板", "法院公告", CreditCourtAnnouncementImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_court_announcement_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditCourtAnnouncementImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()) - && ImportHelper.isBlank(param.getCauseOfAction()); - } - - private CreditCourtAnnouncement convertImportParamToEntity(CreditCourtAnnouncementImportParam param) { - CreditCourtAnnouncement entity = new CreditCourtAnnouncement(); - - String dataType = !ImportHelper.isBlank(param.getDataType2()) - ? param.getDataType2() - : param.getDataType(); - String plaintiffAppellant = !ImportHelper.isBlank(param.getPlaintiffAppellant2()) - ? param.getPlaintiffAppellant2() - : param.getPlaintiffAppellant(); - String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) - ? param.getOtherPartiesThirdParty2() - : param.getOtherPartiesThirdParty(); - String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) - ? param.getInvolvedAmount2() - : param.getInvolvedAmount(); - - String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) - ? param.getOccurrenceTime2() - : param.getOccurrenceTime(); - - entity.setDataType(dataType); - entity.setPlaintiffAppellant(plaintiffAppellant); - entity.setAppellee(param.getAppellee()); - entity.setOtherPartiesThirdParty(otherPartiesThirdParty); - entity.setOccurrenceTime(occurrenceTime); - entity.setCaseNumber(param.getCaseNumber()); - entity.setCauseOfAction(param.getCauseOfAction()); - entity.setCourtName(param.getCourtName()); - entity.setInvolvedAmount(involvedAmount); - entity.setDataStatus(param.getDataStatus()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCourtSessionController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCourtSessionController.java deleted file mode 100644 index 9810e8f..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditCourtSessionController.java +++ /dev/null @@ -1,512 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCourtSession; -import com.gxwebsoft.credit.param.CreditCourtSessionImportParam; -import com.gxwebsoft.credit.param.CreditCourtSessionParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditCourtSessionService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 开庭公告司法大数据控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:33 - */ -@Tag(name = "开庭公告司法大数据管理") -@RestController -@RequestMapping("/api/credit/credit-court-session") -public class CreditCourtSessionController extends BaseController { - @Resource - private CreditCourtSessionService creditCourtSessionService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询开庭公告司法大数据") - @GetMapping("/page") - public ApiResult> page(CreditCourtSessionParam param) { - // 使用关联查询 - return success(creditCourtSessionService.pageRel(param)); - } - - @Operation(summary = "查询全部开庭公告司法大数据") - @GetMapping() - public ApiResult> list(CreditCourtSessionParam param) { - // 使用关联查询 - return success(creditCourtSessionService.listRel(param)); - } - - @Operation(summary = "根据id查询开庭公告司法大数据") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditCourtSessionService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditCourtSession:save')") - @OperationLog - @Operation(summary = "添加开庭公告司法大数据") - @PostMapping() - public ApiResult save(@RequestBody CreditCourtSession creditCourtSession) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditCourtSession.setUserId(loginUser.getUserId()); - // } - if (creditCourtSessionService.save(creditCourtSession)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtSession:update')") - @OperationLog - @Operation(summary = "修改开庭公告司法大数据") - @PutMapping() - public ApiResult update(@RequestBody CreditCourtSession creditCourtSession) { - if (creditCourtSessionService.updateById(creditCourtSession)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtSession:remove')") - @OperationLog - @Operation(summary = "删除开庭公告司法大数据") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditCourtSession.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtSession:save')") - @OperationLog - @Operation(summary = "批量添加开庭公告司法大数据") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditCourtSessionService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtSession:update')") - @OperationLog - @Operation(summary = "批量修改开庭公告司法大数据") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditCourtSessionService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCourtSession:remove')") - @OperationLog - @Operation(summary = "批量删除开庭公告司法大数据") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditCourtSession.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditCourtSession:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Party columns may contain multiple roles/names; match if any company name is contained in the text. - // Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人 - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditCourtSessionService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditCourtSession::getId, - CreditCourtSession::setId, - CreditCourtSession::getCompanyId, - CreditCourtSession::setCompanyId, - CreditCourtSession::getHasData, - CreditCourtSession::setHasData, - CreditCourtSession::getTenantId, - CreditCourtSession::new, - CreditCourtSession::getPlaintiffAppellant, - CreditCourtSession::getAppellee, - CreditCourtSession::getOtherPartiesThirdParty - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入开庭公告司法大数据 - */ - @PreAuthorize("hasAuthority('credit:creditCourtSession:save')") - @Operation(summary = "批量导入开庭公告司法大数据") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - // 兼容多 sheet 文件:优先定位“开庭公告”sheet,否则默认第 0 个。 - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "开庭公告", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditCourtSessionImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditCourtSessionImportParam param = list.get(i); - try { - CreditCourtSession item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCaseNumber())) { - String link = urlByCaseNumber.get(item.getCaseNumber().trim()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCourtSessionService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCourtSession::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCourtSessionService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCourtSession::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_SESSION, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史开庭公告(仅解析“历史开庭公告”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditCourtSession:save')") - @Operation(summary = "批量导入历史开庭公告司法大数据") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史开庭公告"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史开庭公告”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditCourtSessionImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditCourtSessionImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditCourtSession item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCaseNumber.get(item.getCaseNumber()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCourtSessionService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCourtSession::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditCourtSessionService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditCourtSession::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_SESSION, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载开庭公告司法大数据导入模板 - */ - @Operation(summary = "下载开庭公告司法大数据导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditCourtSessionImportParam example = new CreditCourtSessionImportParam(); - example.setDataType("开庭公告"); - example.setPlaintiffAppellant("原告示例"); - example.setAppellee("被告示例"); - example.setOtherPartiesThirdParty2("第三人示例"); - example.setCaseNumber("(2024)示例案号"); - example.setCauseOfAction("案由示例"); - example.setCourtName("示例法院"); - example.setOccurrenceTime("2024-01-01"); - example.setInvolvedAmount("100000"); - example.setDataStatus("正常"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("开庭公告导入模板", "开庭公告", CreditCourtSessionImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_court_session_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditCourtSessionImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()) - && ImportHelper.isBlank(param.getCauseOfAction()); - } - - private CreditCourtSession convertImportParamToEntity(CreditCourtSessionImportParam param) { - CreditCourtSession entity = new CreditCourtSession(); - - // Template compatibility: prefer new columns ("发生时间"/"其他当事人/第三人") when present. - String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) - ? param.getOccurrenceTime2() - : param.getOccurrenceTime(); - String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) - ? param.getOtherPartiesThirdParty2() - : param.getOtherPartiesThirdParty(); - String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) - ? param.getInvolvedAmount2() - : param.getInvolvedAmount(); - - entity.setDataType(param.getDataType()); - entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); - entity.setAppellee(param.getAppellee()); - entity.setDataStatus(param.getDataStatus()); - entity.setInvolvedAmount(involvedAmount); - - entity.setOtherPartiesThirdParty(otherPartiesThirdParty); - entity.setOccurrenceTime(occurrenceTime); - entity.setCaseNumber(param.getCaseNumber()); - entity.setCauseOfAction(param.getCauseOfAction()); - entity.setCourtName(param.getCourtName()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java deleted file mode 100644 index e16c950..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java +++ /dev/null @@ -1,420 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditCustomer; -import com.gxwebsoft.credit.param.CreditCustomerImportParam; -import com.gxwebsoft.credit.param.CreditCustomerParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditCustomerService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 客户控制器 - * - * @author 科技小王子 - * @since 2025-12-21 21:20:58 - */ -@Tag(name = "客户管理") -@RestController -@RequestMapping("/api/credit/credit-customer") -public class CreditCustomerController extends BaseController { - @Resource - private CreditCustomerService creditCustomerService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询客户") - @GetMapping("/page") - public ApiResult> page(CreditCustomerParam param) { - // 使用关联查询 - return success(creditCustomerService.pageRel(param)); - } - - @Operation(summary = "查询全部客户") - @GetMapping() - public ApiResult> list(CreditCustomerParam param) { - // 使用关联查询 - return success(creditCustomerService.listRel(param)); - } - - @Operation(summary = "根据id查询客户") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditCustomerService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditCustomer:save')") - @OperationLog - @Operation(summary = "添加客户") - @PostMapping() - public ApiResult save(@RequestBody CreditCustomer creditCustomer) { - if (creditCustomerService.save(creditCustomer)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCustomer:update')") - @OperationLog - @Operation(summary = "修改客户") - @PutMapping() - public ApiResult update(@RequestBody CreditCustomer creditCustomer) { - if (creditCustomerService.updateById(creditCustomer)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCustomer:remove')") - @OperationLog - @Operation(summary = "删除客户") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditCustomer.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCustomer:save')") - @OperationLog - @Operation(summary = "批量添加客户") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditCustomerService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCustomer:update')") - @OperationLog - @Operation(summary = "批量修改客户") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditCustomerService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditCustomer:remove')") - @OperationLog - @Operation(summary = "批量删除客户") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditCustomer.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditCustomer:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditCustomerService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditCustomer::getId, - CreditCustomer::setId, - CreditCustomer::getName, - CreditCustomer::getCompanyId, - CreditCustomer::setCompanyId, - CreditCustomer::setCompanyName, - CreditCustomer::getHasData, - CreditCustomer::setHasData, - CreditCustomer::getTenantId, - CreditCustomer::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入客户 - */ - @PreAuthorize("hasAuthority('credit:creditCustomer:save')") - @Operation(summary = "批量导入客户") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "客户", 4); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditCustomerImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByName = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "客户"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditCustomerImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditCustomer item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getName())) { - item.setName(item.getName().trim()); - String link = urlByName.get(item.getName()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - if (ImportHelper.isBlank(item.getName())) { - errorMessages.add("第" + excelRowNumber + "行:客户不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += persistImportChunk(chunkItems, chunkRowNumbers, mpBatchSize, errorMessages); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += persistImportChunk(chunkItems, chunkRowNumbers, mpBatchSize, errorMessages); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.CUSTOMER, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载客户导入模板 - */ - @Operation(summary = "下载客户导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditCustomerImportParam example = new CreditCustomerImportParam(); - example.setName("示例客户"); - example.setStatusTxt("合作中"); - example.setPrice("88.8"); - example.setPublicDate("2024-01-01"); - example.setDataSource("公开渠道"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("客户导入模板", "客户", CreditCustomerImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_customer_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditCustomerImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getName()) - && ImportHelper.isBlank(param.getStatusTxt()) - && ImportHelper.isBlank(param.getPrice()); - } - - private CreditCustomer convertImportParamToEntity(CreditCustomerImportParam param) { - CreditCustomer entity = new CreditCustomer(); - - entity.setName(normalizeString(param.getName())); - entity.setStatusTxt(normalizeString(param.getStatusTxt())); - entity.setPrice(normalizeString(param.getPrice())); - entity.setPublicDate(normalizeString(param.getPublicDate())); - entity.setDataSource(normalizeString(param.getDataSource())); - entity.setComments(normalizeString(param.getComments())); - - return entity; - } - - private String normalizeString(String value) { - if (ImportHelper.isBlank(value)) { - return null; - } - return value.trim(); - } - - private int persistImportChunk(List items, - List excelRowNumbers, - int mpBatchSize, - List errorMessages) { - return batchImportSupport.persistChunkWithFallback( - items, - excelRowNumbers, - () -> { - boolean ok = creditCustomerService.saveBatch(items, mpBatchSize); - if (!ok) { - throw new RuntimeException("批量保存失败"); - } - return items.size(); - }, - (rowItem, rowNumber) -> { - try { - boolean saved = creditCustomerService.save(rowItem); - if (saved) { - return true; - } - if (rowNumber != null && rowNumber > 0) { - errorMessages.add("第" + rowNumber + "行:保存失败"); - } else { - errorMessages.add("保存失败"); - } - return false; - } catch (DataIntegrityViolationException e) { - if (isDuplicateKey(e)) { - String name = rowItem != null ? rowItem.getName() : null; - String label = ImportHelper.isBlank(name) ? "数据" : ("客户【" + name.trim() + "】"); - if (rowNumber != null && rowNumber > 0) { - errorMessages.add("第" + rowNumber + "行:" + label + "重复(唯一索引冲突)"); - } else { - errorMessages.add(label + "重复(唯一索引冲突)"); - } - return false; - } - throw e; - } - }, - errorMessages - ); - } - - private static boolean isDuplicateKey(DataIntegrityViolationException e) { - // Prefer structured detection (SQLState / vendor error code), fall back to message contains. - for (Throwable t = e; t != null; t = t.getCause()) { - if (t instanceof SQLException) { - SQLException se = (SQLException) t; - // MySQL: 1062 Duplicate entry; PostgreSQL/H2: SQLState 23505 unique_violation - if (se.getErrorCode() == 1062) { - return true; - } - if ("23505".equals(se.getSQLState())) { - return true; - } - } - } - Throwable mostSpecificCause = e.getMostSpecificCause(); - String message = mostSpecificCause != null ? mostSpecificCause.getMessage() : e.getMessage(); - if (message == null) { - return false; - } - String lower = message.toLowerCase(); - return lower.contains("duplicate") && lower.contains("key"); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditDeliveryNoticeController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditDeliveryNoticeController.java deleted file mode 100644 index 304133a..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditDeliveryNoticeController.java +++ /dev/null @@ -1,516 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditDeliveryNotice; -import com.gxwebsoft.credit.param.CreditDeliveryNoticeImportParam; -import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditDeliveryNoticeService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 送达公告司法大数据控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:52 - */ -@Tag(name = "送达公告司法大数据管理") -@RestController -@RequestMapping("/api/credit/credit-delivery-notice") -public class CreditDeliveryNoticeController extends BaseController { - @Resource - private CreditDeliveryNoticeService creditDeliveryNoticeService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询送达公告司法大数据") - @GetMapping("/page") - public ApiResult> page(CreditDeliveryNoticeParam param) { - // 使用关联查询 - return success(creditDeliveryNoticeService.pageRel(param)); - } - - @Operation(summary = "查询全部送达公告司法大数据") - @GetMapping() - public ApiResult> list(CreditDeliveryNoticeParam param) { - // 使用关联查询 - return success(creditDeliveryNoticeService.listRel(param)); - } - - @Operation(summary = "根据id查询送达公告司法大数据") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditDeliveryNoticeService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:save')") - @OperationLog - @Operation(summary = "添加送达公告司法大数据") - @PostMapping() - public ApiResult save(@RequestBody CreditDeliveryNotice creditDeliveryNotice) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditDeliveryNotice.setUserId(loginUser.getUserId()); - // } - if (creditDeliveryNoticeService.save(creditDeliveryNotice)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:update')") - @OperationLog - @Operation(summary = "修改送达公告司法大数据") - @PutMapping() - public ApiResult update(@RequestBody CreditDeliveryNotice creditDeliveryNotice) { - if (creditDeliveryNoticeService.updateById(creditDeliveryNotice)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:remove')") - @OperationLog - @Operation(summary = "删除送达公告司法大数据") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditDeliveryNotice.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:save')") - @OperationLog - @Operation(summary = "批量添加送达公告司法大数据") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditDeliveryNoticeService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:update')") - @OperationLog - @Operation(summary = "批量修改送达公告司法大数据") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditDeliveryNoticeService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:remove')") - @OperationLog - @Operation(summary = "批量删除送达公告司法大数据") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditDeliveryNotice.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Party columns may contain multiple roles/names; match if any company name is contained in the text. - // Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人 - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditDeliveryNoticeService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditDeliveryNotice::getId, - CreditDeliveryNotice::setId, - CreditDeliveryNotice::getCompanyId, - CreditDeliveryNotice::setCompanyId, - CreditDeliveryNotice::getHasData, - CreditDeliveryNotice::setHasData, - CreditDeliveryNotice::getTenantId, - CreditDeliveryNotice::new, - CreditDeliveryNotice::getPlaintiffAppellant, - CreditDeliveryNotice::getAppellee, - CreditDeliveryNotice::getOtherPartiesThirdParty - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入送达公告司法大数据 - */ - @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:save')") - @Operation(summary = "批量导入送达公告司法大数据") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "送达公告", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditDeliveryNoticeImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - // URL 通常以超链接形式存在于“案号”列里 - Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditDeliveryNoticeImportParam param = list.get(i); - try { - CreditDeliveryNotice item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCaseNumber())) { - String link = urlByCaseNumber.get(item.getCaseNumber().trim()); - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditDeliveryNoticeService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditDeliveryNotice::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditDeliveryNoticeService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditDeliveryNotice::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.DELIVERY_NOTICE, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史送达公告(仅解析“历史送达公告”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:save')") - @Operation(summary = "批量导入历史送达公告司法大数据") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史送达公告"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史送达公告”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditDeliveryNoticeImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditDeliveryNoticeImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditDeliveryNotice item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCaseNumber.get(item.getCaseNumber()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditDeliveryNoticeService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditDeliveryNotice::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditDeliveryNoticeService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditDeliveryNotice::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.DELIVERY_NOTICE, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载送达公告导入模板 - */ - @Operation(summary = "下载送达公告导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditDeliveryNoticeImportParam example = new CreditDeliveryNoticeImportParam(); - example.setDataType("送达公告"); - example.setPlaintiffAppellant("原告示例"); - example.setAppellee("被告示例"); - example.setOtherPartiesThirdParty2("第三人示例"); - example.setInvolvedAmount("100000"); - example.setDataStatus("正常"); - example.setOccurrenceTime("2024-01-01"); - example.setCaseNumber("(2024)示例案号"); - example.setCauseOfAction("案由示例"); - example.setCourtName("示例法院"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("送达公告导入模板", "送达公告", CreditDeliveryNoticeImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_delivery_notice_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditDeliveryNoticeImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()) - && ImportHelper.isBlank(param.getCauseOfAction()) - && ImportHelper.isBlank(param.getOtherPartiesThirdParty()) - && ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) - && ImportHelper.isBlank(param.getPlaintiffAppellant()) - && ImportHelper.isBlank(param.getAppellee()); - } - - private CreditDeliveryNotice convertImportParamToEntity(CreditDeliveryNoticeImportParam param) { - CreditDeliveryNotice entity = new CreditDeliveryNotice(); - - String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) - ? param.getOccurrenceTime2() - : param.getOccurrenceTime(); - String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) - ? param.getOtherPartiesThirdParty2() - : param.getOtherPartiesThirdParty(); - String courtName = !ImportHelper.isBlank(param.getCourtName2()) - ? param.getCourtName2() - : param.getCourtName(); - String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) - ? param.getInvolvedAmount2() - : param.getInvolvedAmount(); - - entity.setDataType(param.getDataType()); - entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); - entity.setAppellee(param.getAppellee()); - entity.setInvolvedAmount(involvedAmount); - entity.setDataStatus(param.getDataStatus()); - - entity.setOtherPartiesThirdParty(otherPartiesThirdParty); - entity.setOccurrenceTime(occurrenceTime); - entity.setCaseNumber(param.getCaseNumber()); - entity.setCauseOfAction(param.getCauseOfAction()); - entity.setCourtName(courtName); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java deleted file mode 100644 index 85e1bd6..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java +++ /dev/null @@ -1,384 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditExternal; -import com.gxwebsoft.credit.param.CreditExternalImportParam; -import com.gxwebsoft.credit.param.CreditExternalParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditExternalService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 对外投资控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:12 - */ -@Tag(name = "对外投资管理") -@RestController -@RequestMapping("/api/credit/credit-external") -public class CreditExternalController extends BaseController { - @Resource - private CreditExternalService creditExternalService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询对外投资") - @GetMapping("/page") - public ApiResult> page(CreditExternalParam param) { - // 使用关联查询 - return success(creditExternalService.pageRel(param)); - } - - @Operation(summary = "查询全部对外投资") - @GetMapping() - public ApiResult> list(CreditExternalParam param) { - // 使用关联查询 - return success(creditExternalService.listRel(param)); - } - - @Operation(summary = "根据id查询对外投资") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditExternalService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditExternal:save')") - @OperationLog - @Operation(summary = "添加对外投资") - @PostMapping() - public ApiResult save(@RequestBody CreditExternal creditExternal) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditExternal.setUserId(loginUser.getUserId()); - // } - if (creditExternalService.save(creditExternal)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditExternal:update')") - @OperationLog - @Operation(summary = "修改对外投资") - @PutMapping() - public ApiResult update(@RequestBody CreditExternal creditExternal) { - if (creditExternalService.updateById(creditExternal)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditExternal:remove')") - @OperationLog - @Operation(summary = "删除对外投资") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditExternal.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditExternal:save')") - @OperationLog - @Operation(summary = "批量添加对外投资") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditExternalService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditExternal:update')") - @OperationLog - @Operation(summary = "批量修改对外投资") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditExternalService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditExternal:remove')") - @OperationLog - @Operation(summary = "批量删除对外投资") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditExternal.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditExternal:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditExternalService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditExternal::getId, - CreditExternal::setId, - CreditExternal::getName, - CreditExternal::getCompanyId, - CreditExternal::setCompanyId, - CreditExternal::setCompanyName, - CreditExternal::getHasData, - CreditExternal::setHasData, - CreditExternal::getTenantId, - CreditExternal::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入对外投资 - */ - @PreAuthorize("hasAuthority('credit:creditExternal:save')") - @Operation(summary = "批量导入对外投资") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "对外投资", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditExternalImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByName = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "被投资企业名称"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditExternalImportParam param = list.get(i); - try { - CreditExternal item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getName())) { - String link = urlByName.get(item.getName().trim()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getName())) { - errorMessages.add("第" + excelRowNumber + "行:被投资企业名称不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditExternalService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditExternal::getName, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditExternalService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditExternal::getName, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.EXTERNAL, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载对外投资导入模板 - */ - @Operation(summary = "下载对外投资导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditExternalImportParam example = new CreditExternalImportParam(); - example.setName("示例科技有限公司"); - example.setStatusTxt("存续"); - example.setLegalRepresentative("李四"); - example.setRegisteredCapital("10000"); - example.setEstablishmentDate("2018-06-01"); - example.setShareholdingRatio("20"); - example.setSubscribedInvestmentAmount("2000"); - example.setSubscribedInvestmentDate("2019-01-01"); - example.setIndirectShareholdingRatio("5"); - example.setInvestmentDate("2019-06-01"); - example.setRegion("上海"); - example.setIndustry("信息技术"); - example.setInvestmentCount(1); - example.setRelatedProductsInstitutions("关联产品示例"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("对外投资导入模板", "对外投资", CreditExternalImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_external_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditExternalImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getName()) - && ImportHelper.isBlank(param.getLegalRepresentative()) - && ImportHelper.isBlank(param.getRegisteredCapital()) - && ImportHelper.isBlank(param.getEstablishmentDate()); - } - - private CreditExternal convertImportParamToEntity(CreditExternalImportParam param) { - CreditExternal entity = new CreditExternal(); - - entity.setName(param.getName()); - entity.setStatusTxt(param.getStatusTxt()); - entity.setLegalRepresentative(param.getLegalRepresentative()); - entity.setRegisteredCapital(param.getRegisteredCapital()); - entity.setEstablishmentDate(param.getEstablishmentDate()); - entity.setShareholdingRatio(param.getShareholdingRatio()); - entity.setSubscribedInvestmentAmount(param.getSubscribedInvestmentAmount()); - entity.setSubscribedInvestmentDate(param.getSubscribedInvestmentDate()); - entity.setIndirectShareholdingRatio(param.getIndirectShareholdingRatio()); - entity.setInvestmentDate(param.getInvestmentDate()); - entity.setRegion(param.getRegion()); - entity.setIndustry(param.getIndustry()); - entity.setInvestmentCount(param.getInvestmentCount()); - entity.setRelatedProductsInstitutions(param.getRelatedProductsInstitutions()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditFinalVersionController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditFinalVersionController.java deleted file mode 100644 index 426bdc1..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditFinalVersionController.java +++ /dev/null @@ -1,517 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditFinalVersion; -import com.gxwebsoft.credit.param.CreditFinalVersionImportParam; -import com.gxwebsoft.credit.param.CreditFinalVersionParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditFinalVersionService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 终本案件控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:19 - */ -@Tag(name = "终本案件管理") -@RestController -@RequestMapping("/api/credit/credit-final-version") -public class CreditFinalVersionController extends BaseController { - @Resource - private CreditFinalVersionService creditFinalVersionService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询终本案件") - @GetMapping("/page") - public ApiResult> page(CreditFinalVersionParam param) { - // 使用关联查询 - return success(creditFinalVersionService.pageRel(param)); - } - - @Operation(summary = "查询全部终本案件") - @GetMapping() - public ApiResult> list(CreditFinalVersionParam param) { - // 使用关联查询 - return success(creditFinalVersionService.listRel(param)); - } - - @Operation(summary = "根据id查询终本案件") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditFinalVersionService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditFinalVersion:save')") - @OperationLog - @Operation(summary = "添加终本案件") - @PostMapping() - public ApiResult save(@RequestBody CreditFinalVersion creditFinalVersion) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditFinalVersion.setUserId(loginUser.getUserId()); - // } - if (creditFinalVersionService.save(creditFinalVersion)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditFinalVersion:update')") - @OperationLog - @Operation(summary = "修改终本案件") - @PutMapping() - public ApiResult update(@RequestBody CreditFinalVersion creditFinalVersion) { - if (creditFinalVersionService.updateById(creditFinalVersion)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditFinalVersion:remove')") - @OperationLog - @Operation(summary = "删除终本案件") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditFinalVersion.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditFinalVersion:save')") - @OperationLog - @Operation(summary = "批量添加终本案件") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditFinalVersionService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditFinalVersion:update')") - @OperationLog - @Operation(summary = "批量修改终本案件") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditFinalVersionService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditFinalVersion:remove')") - @OperationLog - @Operation(summary = "批量删除终本案件") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditFinalVersion.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditFinalVersion:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Party columns may contain multiple roles/names; match if any company name is contained in the text. - // Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人 - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditFinalVersionService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditFinalVersion::getId, - CreditFinalVersion::setId, - CreditFinalVersion::getCompanyId, - CreditFinalVersion::setCompanyId, - CreditFinalVersion::getHasData, - CreditFinalVersion::setHasData, - CreditFinalVersion::getTenantId, - CreditFinalVersion::new, - CreditFinalVersion::getPlaintiffAppellant, - CreditFinalVersion::getAppellee, - CreditFinalVersion::getOtherPartiesThirdParty - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入终本案件 - */ - @PreAuthorize("hasAuthority('credit:creditFinalVersion:save')") - @Operation(summary = "批量导入终本案件") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - // 按选项卡名称读取(客户提供的文件可能不是把目标 sheet 放在第一个) - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "终本案件", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditFinalVersionImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditFinalVersionImportParam param = list.get(i); - try { - CreditFinalVersion item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCaseNumber())) { - String link = urlByCaseNumber.get(item.getCaseNumber().trim()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditFinalVersionService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditFinalVersion::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditFinalVersionService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditFinalVersion::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.FINAL_VERSION, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史终本案件(仅解析“历史终本案件”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditFinalVersion:save')") - @Operation(summary = "批量导入历史终本案件") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史终本案件"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史终本案件”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditFinalVersionImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditFinalVersionImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditFinalVersion item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCaseNumber.get(item.getCaseNumber()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditFinalVersionService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditFinalVersion::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditFinalVersionService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditFinalVersion::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.FINAL_VERSION, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载终本案件导入模板 - */ - @Operation(summary = "下载终本案件导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditFinalVersionImportParam example = new CreditFinalVersionImportParam(); - example.setCaseNumber("(2024)示例案号"); - example.setPlaintiffAppellant("原告示例"); - example.setAppellee("被告示例"); - example.setOtherPartiesThirdParty("第三人示例"); - example.setInvolvedAmount("20,293.91"); - example.setDataStatus("正常"); - example.setCourtName("示例法院"); - example.setOccurrenceTime("2024-01-01"); - example.setFinalDate("2024-01-01"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("终本案件导入模板", "终本案件", CreditFinalVersionImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_final_version_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditFinalVersionImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()); - } - - private CreditFinalVersion convertImportParamToEntity(CreditFinalVersionImportParam param) { - CreditFinalVersion entity = new CreditFinalVersion(); - - String plaintiffAppellant = !ImportHelper.isBlank(param.getPlaintiffAppellant2()) - ? param.getPlaintiffAppellant2() - : param.getPlaintiffAppellant(); - String appellee = !ImportHelper.isBlank(param.getAppellee2()) - ? param.getAppellee2() - : param.getAppellee(); - String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty()) - ? param.getOtherPartiesThirdParty() - : param.getOtherPartiesThirdParty2(); - String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) - ? param.getInvolvedAmount2() - : param.getInvolvedAmount(); - String courtName = !ImportHelper.isBlank(param.getCourtName2()) - ? param.getCourtName2() - : param.getCourtName(); - String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) - ? param.getOccurrenceTime2() - : param.getOccurrenceTime(); - - entity.setCaseNumber(param.getCaseNumber()); - entity.setPlaintiffAppellant(plaintiffAppellant); - entity.setAppellee(appellee); - entity.setUnfulfilledAmount(param.getUnfulfilledAmount()); - entity.setInvolvedAmount(involvedAmount); - entity.setOtherPartiesThirdParty(otherPartiesThirdParty); - entity.setDataStatus(param.getDataStatus()); - entity.setCourtName(courtName); - entity.setOccurrenceTime(occurrenceTime); - entity.setFinalDate(param.getFinalDate()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditGqdjController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditGqdjController.java deleted file mode 100644 index ef168aa..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditGqdjController.java +++ /dev/null @@ -1,686 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditGqdj; -import com.gxwebsoft.credit.param.CreditGqdjImportParam; -import com.gxwebsoft.credit.param.CreditGqdjParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditGqdjService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 股权冻结控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:37 - */ -@Tag(name = "股权冻结管理") -@RestController -@RequestMapping("/api/credit/credit-gqdj") -public class CreditGqdjController extends BaseController { - @Resource - private CreditGqdjService creditGqdjService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询股权冻结") - @GetMapping("/page") - public ApiResult> page(CreditGqdjParam param) { - // 使用关联查询 - return success(creditGqdjService.pageRel(param)); - } - - @Operation(summary = "查询全部股权冻结") - @GetMapping() - public ApiResult> list(CreditGqdjParam param) { - // 使用关联查询 - return success(creditGqdjService.listRel(param)); - } - - @Operation(summary = "根据id查询股权冻结") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditGqdjService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditGqdj:save')") - @OperationLog - @Operation(summary = "添加股权冻结") - @PostMapping() - public ApiResult save(@RequestBody CreditGqdj creditGqdj) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditGqdj.setUserId(loginUser.getUserId()); - // } - if (creditGqdjService.save(creditGqdj)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditGqdj:update')") - @OperationLog - @Operation(summary = "修改股权冻结") - @PutMapping() - public ApiResult update(@RequestBody CreditGqdj creditGqdj) { - if (creditGqdjService.updateById(creditGqdj)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditGqdj:remove')") - @OperationLog - @Operation(summary = "删除股权冻结") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditGqdj.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditGqdj:save')") - @OperationLog - @Operation(summary = "批量添加股权冻结") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditGqdjService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditGqdj:update')") - @OperationLog - @Operation(summary = "批量修改股权冻结") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditGqdjService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditGqdj:remove')") - @OperationLog - @Operation(summary = "批量删除股权冻结") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditGqdj.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据当事人/企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId 为空/0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditGqdj:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Match companyId by any party/company-name column (e.g. plaintiff/appellant, defendant/appellee). - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNames( - creditGqdjService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditGqdj::getId, - CreditGqdj::setId, - CreditGqdj::getCompanyId, - CreditGqdj::setCompanyId, - CreditGqdj::getHasData, - CreditGqdj::setHasData, - CreditGqdj::getTenantId, - CreditGqdj::new, - CreditGqdj::getPlaintiffAppellant, - CreditGqdj::getAppellee - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入股权冻结司法大数据 - */ - @PreAuthorize("hasAuthority('credit:creditGqdj:save')") - @Operation(summary = "批量导入股权冻结司法大数据") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "股权冻结", 0); - // Prefer the "best" header configuration; many upstream files have extra title rows or multi-row headers. - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readBest( - file, - CreditGqdjImportParam.class, - this::isEmptyImportRow, - // Score rows that look like real data (at least has a case number in either column). - p -> p != null - && (!ImportHelper.isBlank(p.getCaseNumber()) - || !ImportHelper.isBlank(p.getCaseNumber2()) - ), - sheetIndex - ); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - // Fallback: try other sheets if the named/default sheet doesn't match. - importResult = ExcelImportSupport.readAnySheetBest( - file, - CreditGqdjImportParam.class, - this::isEmptyImportRow, - p -> p != null - && (!ImportHelper.isBlank(p.getCaseNumber()) - || !ImportHelper.isBlank(p.getCaseNumber2())) - ); - list = importResult.getData(); - usedTitleRows = importResult.getTitleRows(); - usedHeadRows = importResult.getHeadRows(); - usedSheetIndex = importResult.getSheetIndex(); - } - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - // easypoi 默认不会读取单元格超链接地址;url 通常挂在“案号/执行通知文书号”列的超链接中,需要额外读取回填。 - String caseNumberHeader = "执行通知文书号"; - Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader); - // Some upstream sources use "案号" as the case number header. - Map urlByCaseNumberFromAh = ExcelImportSupport.readHyperlinksByHeaderKey( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - urlByCaseNumberFromAh.forEach(urlByCaseNumber::putIfAbsent); - // Some upstream sources use "暗号" as the case number header. - Map urlByCaseNumberFromAh2 = ExcelImportSupport.readHyperlinksByHeaderKey( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号"); - urlByCaseNumberFromAh2.forEach(urlByCaseNumber::putIfAbsent); - // 有些源文件会单独提供“url/网址/链接”等列(可能是纯文本也可能是超链接) - Map urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "url"); - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "URL"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "网址"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "链接"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - // Try again with "案号" as the key column name. - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "url"); - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "URL"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "网址"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "链接"); - } - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - // Try again with "暗号" as the key column name. - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "url"); - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "URL"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "网址"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "链接"); - } - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditGqdjImportParam param = list.get(i); - try { - CreditGqdj item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCaseNumber())) { - String key = item.getCaseNumber().trim(); - String link = urlByCaseNumber.get(key); - if (ImportHelper.isBlank(link)) { - link = urlByCaseNumberFromUrlCol.get(key); - } - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditGqdjService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditGqdj::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditGqdjService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditGqdj::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.GQDJ, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史股权冻结(仅解析“历史股权冻结”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditGqdj:save')") - @Operation(summary = "批量导入历史股权冻结司法大数据") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史股权冻结"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史股权冻结”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readBest( - file, - CreditGqdjImportParam.class, - this::isEmptyImportRow, - p -> p != null - && (!ImportHelper.isBlank(p.getCaseNumber()) - || !ImportHelper.isBlank(p.getCaseNumber2())), - sheetIndex - ); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - String caseNumberHeader = "执行通知文书号"; - Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader); - Map urlByCaseNumberFromAh = ExcelImportSupport.readHyperlinksByHeaderKey( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - urlByCaseNumberFromAh.forEach(urlByCaseNumber::putIfAbsent); - Map urlByCaseNumberFromAh2 = ExcelImportSupport.readHyperlinksByHeaderKey( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号"); - urlByCaseNumberFromAh2.forEach(urlByCaseNumber::putIfAbsent); - Map urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "url"); - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "URL"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "网址"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "链接"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "url"); - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "URL"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "网址"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "链接"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "url"); - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "URL"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "网址"); - } - if (urlByCaseNumberFromUrlCol.isEmpty()) { - urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( - file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "链接"); - } - } - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditGqdjImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditGqdj item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String key = item.getCaseNumber(); - String link = urlByCaseNumber.get(key); - if (ImportHelper.isBlank(link)) { - link = urlByCaseNumberFromUrlCol.get(key); - } - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataType("失效"); - - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditGqdjService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditGqdj::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditGqdjService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditGqdj::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.GQDJ, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载股权冻结导入模板 - */ - @Operation(summary = "下载股权冻结导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditGqdjImportParam example = new CreditGqdjImportParam(); - example.setDataType("股权冻结"); - example.setPlaintiffAppellant("原告示例"); - example.setAppellee("被告示例"); - example.setCaseNumber("(2024)示例案号"); - example.setInvolvedAmount("100000"); - example.setCourtName("示例法院"); - example.setDataStatus("已公开"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("股权冻结导入模板", "股权冻结", CreditGqdjImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_gqdj_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditGqdjImportParam param) { - if (param == null) { - return true; - } - // Don't over-filter here: if some columns are mapped but case number header differs, - // we still want to read the row and report "案号不能为空" instead of "未读取到数据". - return ImportHelper.isBlank(param.getCaseNumber()) - && ImportHelper.isBlank(param.getCaseNumber2()) - && ImportHelper.isBlank(param.getAppellee()) - && ImportHelper.isBlank(param.getAppellee2()) - && ImportHelper.isBlank(param.getPlaintiffAppellant()) - && ImportHelper.isBlank(param.getPlaintiffAppellant2()) - && ImportHelper.isBlank(param.getInvolvedAmount()) - && ImportHelper.isBlank(param.getCourtName()) - && ImportHelper.isBlank(param.getDataType()) - && ImportHelper.isBlank(param.getDataStatus()) - && ImportHelper.isBlank(param.getDataStatus2()) - && ImportHelper.isBlank(param.getFreezeDateStart()) - && ImportHelper.isBlank(param.getFreezeDateEnd()) - && ImportHelper.isBlank(param.getFreezeDateStart2()) - && ImportHelper.isBlank(param.getFreezeDateEnd2()) - && ImportHelper.isBlank(param.getPublicDate()); - } - - private CreditGqdj convertImportParamToEntity(CreditGqdjImportParam param) { - CreditGqdj entity = new CreditGqdj(); - - // Template compatibility: some sources use alternate headers for the same columns. - String appellee = !ImportHelper.isBlank(param.getAppellee()) ? param.getAppellee() : param.getAppellee2(); - String plaintiffAppellant = !ImportHelper.isBlank(param.getPlaintiffAppellant()) - ? param.getPlaintiffAppellant() - : param.getPlaintiffAppellant2(); - - if (!ImportHelper.isBlank(param.getCaseNumber2())) { - entity.setCaseNumber(param.getCaseNumber2()); - } else { - entity.setCaseNumber(param.getCaseNumber()); - } - entity.setAppellee(appellee); - entity.setPlaintiffAppellant(plaintiffAppellant); - entity.setInvolvedAmount(param.getInvolvedAmount()); - entity.setCourtName(param.getCourtName()); - if (!ImportHelper.isBlank(param.getDataStatus2())) { - entity.setDataStatus(param.getDataStatus2()); - } else { - entity.setDataStatus(param.getDataStatus()); - } - entity.setDataType(param.getDataType()); - entity.setPublicDate(param.getPublicDate()); - if (!ImportHelper.isBlank(param.getFreezeDateStart2())) { - entity.setFreezeDateStart(param.getFreezeDateStart2()); - } else { - entity.setFreezeDateStart(param.getFreezeDateStart()); - } - if (!ImportHelper.isBlank(param.getFreezeDateEnd2())) { - entity.setFreezeDateEnd(param.getFreezeDateEnd2()); - } else { - entity.setFreezeDateEnd(param.getFreezeDateEnd()); - } - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java deleted file mode 100644 index 775dee9..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java +++ /dev/null @@ -1,376 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson; -import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonImportParam; -import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditHistoricalLegalPersonService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 历史法定代表人控制器 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Tag(name = "历史法定代表人管理") -@RestController -@RequestMapping("/api/credit/credit-historical-legal-person") -public class CreditHistoricalLegalPersonController extends BaseController { - @Resource - private CreditHistoricalLegalPersonService creditHistoricalLegalPersonService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询历史法定代表人") - @GetMapping("/page") - public ApiResult> page(CreditHistoricalLegalPersonParam param) { - // 使用关联查询 - return success(creditHistoricalLegalPersonService.pageRel(param)); - } - - @Operation(summary = "查询全部历史法定代表人") - @GetMapping() - public ApiResult> list(CreditHistoricalLegalPersonParam param) { - // 使用关联查询 - return success(creditHistoricalLegalPersonService.listRel(param)); - } - - @Operation(summary = "根据id查询历史法定代表人") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditHistoricalLegalPersonService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:save')") - @OperationLog - @Operation(summary = "添加历史法定代表人") - @PostMapping() - public ApiResult save(@RequestBody CreditHistoricalLegalPerson creditHistoricalLegalPerson) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditHistoricalLegalPerson.setUserId(loginUser.getUserId()); - // } - if (creditHistoricalLegalPersonService.save(creditHistoricalLegalPerson)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:update')") - @OperationLog - @Operation(summary = "修改历史法定代表人") - @PutMapping() - public ApiResult update(@RequestBody CreditHistoricalLegalPerson creditHistoricalLegalPerson) { - if (creditHistoricalLegalPersonService.updateById(creditHistoricalLegalPerson)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:remove')") - @OperationLog - @Operation(summary = "删除历史法定代表人") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditHistoricalLegalPerson.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:save')") - @OperationLog - @Operation(summary = "批量添加历史法定代表人") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditHistoricalLegalPersonService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:update')") - @OperationLog - @Operation(summary = "批量修改历史法定代表人") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditHistoricalLegalPersonService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:remove')") - @OperationLog - @Operation(summary = "批量删除历史法定代表人") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditHistoricalLegalPerson.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditHistoricalLegalPersonService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditHistoricalLegalPerson::getId, - CreditHistoricalLegalPerson::setId, - CreditHistoricalLegalPerson::getName, - CreditHistoricalLegalPerson::getCompanyId, - CreditHistoricalLegalPerson::setCompanyId, - CreditHistoricalLegalPerson::setCompanyName, - CreditHistoricalLegalPerson::getHasData, - CreditHistoricalLegalPerson::setHasData, - CreditHistoricalLegalPerson::getTenantId, - CreditHistoricalLegalPerson::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入历史法定代表人 - */ - @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:save')") - @Operation(summary = "批量导入历史法定代表人") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( - file, CreditHistoricalLegalPersonImportParam.class, this::isEmptyImportRow); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "名称"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditHistoricalLegalPersonImportParam param = list.get(i); - try { - CreditHistoricalLegalPerson item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getName())) { - String link = urlByName.get(item.getName().trim()); - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getName())) { - errorMessages.add("第" + excelRowNumber + "行:名称不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditHistoricalLegalPersonService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditHistoricalLegalPerson::getName, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditHistoricalLegalPersonService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditHistoricalLegalPerson::getName, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.HISTORICAL_LEGAL_PERSON, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载历史法定代表人导入模板 - */ - @Operation(summary = "下载历史法定代表人导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditHistoricalLegalPersonImportParam example = new CreditHistoricalLegalPersonImportParam(); - example.setName("张三"); - example.setRegisterDate("2020-01-01"); - example.setPublicDate("2023-06-01"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("历史法定代表人导入模板", "历史法定代表人", CreditHistoricalLegalPersonImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_historical_legal_person_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditHistoricalLegalPersonImportParam param) { - if (param == null) { - return true; - } - if (isImportHeaderRow(param)) { - return true; - } - return ImportHelper.isBlank(param.getName()) - && ImportHelper.isBlank(param.getRegisterDate()) - && ImportHelper.isBlank(param.getPublicDate()); - } - - private boolean isImportHeaderRow(CreditHistoricalLegalPersonImportParam param) { - return isHeaderValue(param.getName(), "名称") - || isHeaderValue(param.getRegisterDate(), "任职日期") - || isHeaderValue(param.getPublicDate(), "卸任日期"); - } - - private static boolean isHeaderValue(String value, String headerText) { - if (value == null) { - return false; - } - return headerText.equals(value.trim()); - } - - private CreditHistoricalLegalPerson convertImportParamToEntity(CreditHistoricalLegalPersonImportParam param) { - CreditHistoricalLegalPerson entity = new CreditHistoricalLegalPerson(); - - entity.setName(param.getName()); - entity.setRegisterDate(param.getRegisterDate()); - entity.setPublicDate(param.getPublicDate()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditJudgmentDebtorController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditJudgmentDebtorController.java deleted file mode 100644 index 00a6f16..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditJudgmentDebtorController.java +++ /dev/null @@ -1,881 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditJudgmentDebtor; -import com.gxwebsoft.credit.param.CreditJudgmentDebtorImportParam; -import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditJudgmentDebtorService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.Locale; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -/** - * 被执行人控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:55 - */ -@Tag(name = "被执行人管理") -@RestController -@RequestMapping("/api/credit/credit-judgment-debtor") -public class CreditJudgmentDebtorController extends BaseController { - @Resource - private CreditJudgmentDebtorService creditJudgmentDebtorService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询被执行人") - @GetMapping("/page") - public ApiResult> page(CreditJudgmentDebtorParam param) { - // 使用关联查询 - return success(creditJudgmentDebtorService.pageRel(param)); - } - - @Operation(summary = "查询全部被执行人") - @GetMapping() - public ApiResult> list(CreditJudgmentDebtorParam param) { - // 使用关联查询 - return success(creditJudgmentDebtorService.listRel(param)); - } - - @Operation(summary = "根据id查询被执行人") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditJudgmentDebtorService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:save')") - @OperationLog - @Operation(summary = "添加被执行人") - @PostMapping() - public ApiResult save(@RequestBody CreditJudgmentDebtor creditJudgmentDebtor) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditJudgmentDebtor.setUserId(loginUser.getUserId()); - // } - if (creditJudgmentDebtorService.save(creditJudgmentDebtor)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:update')") - @OperationLog - @Operation(summary = "修改被执行人") - @PutMapping() - public ApiResult update(@RequestBody CreditJudgmentDebtor creditJudgmentDebtor) { - if (creditJudgmentDebtorService.updateById(creditJudgmentDebtor)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:remove')") - @OperationLog - @Operation(summary = "删除被执行人") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditJudgmentDebtor.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:save')") - @OperationLog - @Operation(summary = "批量添加被执行人") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditJudgmentDebtorService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:update')") - @OperationLog - @Operation(summary = "批量修改被执行人") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditJudgmentDebtorService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:remove')") - @OperationLog - @Operation(summary = "批量删除被执行人") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditJudgmentDebtor.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit, - @RequestParam(value = "topLevelOnly", required = false, defaultValue = "true") Boolean topLevelOnly - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Match only on "name" column: debtor.name contains a (top-level) CreditCompany name/matchName. - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditJudgmentDebtorService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditJudgmentDebtor::getId, - CreditJudgmentDebtor::setId, - CreditJudgmentDebtor::getCompanyId, - CreditJudgmentDebtor::setCompanyId, - CreditJudgmentDebtor::getHasData, - CreditJudgmentDebtor::setHasData, - CreditJudgmentDebtor::getTenantId, - CreditJudgmentDebtor::new, - q -> { - if (!Boolean.TRUE.equals(topLevelOnly)) { - return; - } - // "一级企业":parentId=0(部分历史数据可能为 NULL,兼容处理) - q.and(w -> w.eq(com.gxwebsoft.credit.entity.CreditCompany::getParentId, 0) - .or() - .isNull(com.gxwebsoft.credit.entity.CreditCompany::getParentId)); - }, - CreditJudgmentDebtor::getName - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入被执行人 - */ - @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:save')") - @Operation(summary = "批量导入被执行人") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - try { - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - ImportOutcome outcome; - if (isZip(file)) { - outcome = importFromZip(file, currentUserId, currentTenantId, companyId); - } else { - outcome = importFromExcel(file, safeFileLabel(file.getOriginalFilename()), currentUserId, currentTenantId, companyId, false); - } - - if (!outcome.anyDataRead) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDGMENT_DEBTOR, outcome.touchedCompanyIds); - - if (outcome.errorMessages.isEmpty()) { - return success("成功导入" + outcome.successCount + "条数据", null); - } - return success("导入完成,成功" + outcome.successCount + "条,失败" + outcome.errorMessages.size() + "条", outcome.errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史被执行人(写入被执行人表 credit_judgment_debtor,仅解析“历史被执行人”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:save')") - @Operation(summary = "批量导入历史被执行人") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - try { - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - ImportOutcome outcome; - if (isZip(file)) { - outcome = importHistoryFromZip(file, currentUserId, currentTenantId, companyId); - } else { - outcome = importHistoryFromExcel(file, safeFileLabel(file.getOriginalFilename()), currentUserId, currentTenantId, companyId); - } - - if (!outcome.anyDataRead) { - return fail("未读取到数据,请确认文件中存在“历史被执行人”选项卡且表头与示例格式一致", null); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDGMENT_DEBTOR, outcome.touchedCompanyIds); - - if (outcome.errorMessages.isEmpty()) { - return success("成功导入" + outcome.successCount + "条数据", null); - } - return success("导入完成,成功" + outcome.successCount + "条,失败" + outcome.errorMessages.size() + "条", outcome.errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载被执行人导入模板 - */ - @Operation(summary = "下载被执行人导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditJudgmentDebtorImportParam example = new CreditJudgmentDebtorImportParam(); - example.setCaseNumber("(2024)示例案号"); - example.setName("某某公司"); - example.setCode("1234567890"); - example.setOccurrenceTime("2024-01-10"); - example.setDataStatus("已公开"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("被执行人导入模板", "被执行人", CreditJudgmentDebtorImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_judgment_debtor_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditJudgmentDebtorImportParam param) { - if (param == null) { - return true; - } - if (isImportHeaderRow(param)) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()); - } - - private boolean isImportHeaderRow(CreditJudgmentDebtorImportParam param) { - return isHeaderValue(param.getName(), "序号") - || isHeaderValue(param.getName1(), "序号") - || isHeaderValue(param.getCaseNumber(), "案号") - || isHeaderValue(param.getName(), "被执行人名称") - || isHeaderValue(param.getName1(), "被执行人") - || isHeaderValue(param.getCode(), "证件号/组织机构代码") - || isHeaderValue(param.getOccurrenceTime(), "立案日期") - || isHeaderValue(param.getCourtName(), "法院") - || isHeaderValue(param.getCourtNameQcc(), "执行法院") - || isHeaderValue(param.getInvolvedAmount(), "涉案金额") - || isHeaderValue(param.getInvolvedAmountQcc(), "执行标的(元)") - || isHeaderValue(param.getDataStatus(), "数据状态"); - } - - private static boolean isHeaderValue(String value, String headerText) { - if (value == null) { - return false; - } - return headerText.equals(value.trim()); - } - - private static boolean hasMeaningfulPartyValue(String value) { - if (ImportHelper.isBlank(value)) { - return false; - } - return !"-".equals(value.trim()); - } - - private CreditJudgmentDebtor convertImportParamToEntity(CreditJudgmentDebtorImportParam param) { - CreditJudgmentDebtor entity = new CreditJudgmentDebtor(); - - entity.setCaseNumber(param.getCaseNumber()); - entity.setName1(param.getName1()); - String debtorName = ImportHelper.isBlank(param.getName()) ? param.getName1() : param.getName(); - if (debtorName != null) { - debtorName = debtorName.trim(); - } - entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); - entity.setAppellee(param.getAppellee()); - entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty()); - // Some upstream XLS templates store party/company name in "原告/上诉人/被告/第三人" columns. - // When present, use them to populate the debtor "name" for compatibility. - if (hasMeaningfulPartyValue(param.getPlaintiffAppellant())) { - debtorName = param.getPlaintiffAppellant().trim(); - } else if (hasMeaningfulPartyValue(param.getAppellee())) { - debtorName = param.getAppellee().trim(); - } else if (hasMeaningfulPartyValue(param.getOtherPartiesThirdParty())) { - debtorName = param.getOtherPartiesThirdParty().trim(); - } - entity.setName(debtorName); - entity.setCode(param.getCode()); - String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) - ? param.getOccurrenceTime2().trim() - : (param.getOccurrenceTime() != null ? param.getOccurrenceTime().trim() : null); - entity.setOccurrenceTime(occurrenceTime); - // 兼容企查查历史被执行人:执行标的(元) / 执行法院 - String amount = !ImportHelper.isBlank(param.getInvolvedAmountQcc()) - ? param.getInvolvedAmountQcc() - : param.getInvolvedAmount(); - if (amount != null) { - amount = amount.trim(); - } - entity.setAmount(amount); - - String courtName = !ImportHelper.isBlank(param.getCourtName()) - ? param.getCourtName() - : param.getCourtNameQcc(); - if (courtName != null) { - courtName = courtName.trim(); - } - entity.setCourtName(courtName); - entity.setDataStatus(param.getDataStatus()); - entity.setComments(param.getComments()); - - return entity; - } - - private static class ImportOutcome { - private final boolean anyDataRead; - private final int successCount; - private final List errorMessages; - private final Set touchedCompanyIds; - - private ImportOutcome(boolean anyDataRead, int successCount, List errorMessages, Set touchedCompanyIds) { - this.anyDataRead = anyDataRead; - this.successCount = successCount; - 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 { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - ExcelImportSupport.ImportResult importResult = readDebtorImport(excelFile, strictDebtorSheet); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return new ImportOutcome(false, 0, errorMessages, touchedCompanyIds); - } - - Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "被执行人名称"); - Map urlByName1 = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "被执行人"); - - String prefix = ImportHelper.isBlank(fileLabel) ? "" : "【" + fileLabel + "】"; - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - for (int i = 0; i < list.size(); i++) { - CreditJudgmentDebtorImportParam param = list.get(i); - try { - CreditJudgmentDebtor item = convertImportParamToEntity(param); - String link = null; - if (!ImportHelper.isBlank(item.getCaseNumber())) { - link = urlByCaseNumber.get(item.getCaseNumber().trim()); - } - if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { - link = urlByName.get(item.getName().trim()); - } - if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName1())) { - link = urlByName1.get(item.getName1().trim()); - } - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add(prefix + "第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += persistImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add(prefix + "第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - if (!chunkItems.isEmpty()) { - successCount += persistImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages); - } - return new ImportOutcome(true, successCount, errorMessages, touchedCompanyIds); - } - - private ImportOutcome importHistoryFromExcel(MultipartFile excelFile, String fileLabel, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - int historySheetIndex = ExcelImportSupport.findSheetIndex(excelFile, "历史被执行人"); - if (historySheetIndex < 0) { - return new ImportOutcome(false, 0, errorMessages, touchedCompanyIds); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readBest( - excelFile, - CreditJudgmentDebtorImportParam.class, - this::isEmptyImportRow, - this::isScoreImportRow, - historySheetIndex - ); - - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return new ImportOutcome(false, 0, errorMessages, touchedCompanyIds); - } - - Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "被执行人名称"); - Map urlByName1 = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "被执行人"); - - String prefix = ImportHelper.isBlank(fileLabel) ? "" : "【" + fileLabel + "】"; - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditJudgmentDebtorImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditJudgmentDebtor item = convertImportParamToEntity(param); - - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add(prefix + "第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCaseNumber.get(item.getCaseNumber()); - if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { - link = urlByName.get(item.getName().trim()); - } - if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName1())) { - link = urlByName1.get(item.getName1().trim()); - } - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += persistHistoryImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add(prefix + "第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += persistHistoryImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages); - } - - return new ImportOutcome(true, successCount, errorMessages, touchedCompanyIds); - } - - private int persistHistoryImportChunk(List items, - List excelRowNumbers, - String prefix, - int mpBatchSize, - List errorMessages) { - return batchImportSupport.persistInsertOnlyChunk( - creditJudgmentDebtorService, - items, - excelRowNumbers, - mpBatchSize, - CreditJudgmentDebtor::getCaseNumber, - prefix, - errorMessages - ); - } - - private int persistImportChunk(List items, - List excelRowNumbers, - String prefix, - int mpBatchSize, - List errorMessages) { - return batchImportSupport.persistInsertOnlyChunk( - creditJudgmentDebtorService, - items, - excelRowNumbers, - mpBatchSize, - CreditJudgmentDebtor::getCaseNumber, - prefix, - errorMessages - ); - } - - private ImportOutcome importFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception { - try { - return importFromZip(zipFile, currentUserId, currentTenantId, companyId, StandardCharsets.UTF_8); - } catch (IllegalArgumentException e) { - return importFromZip(zipFile, currentUserId, currentTenantId, companyId, Charset.forName("GBK")); - } - } - - private ImportOutcome importFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId, Charset charset) throws Exception { - List errorMessages = new ArrayList<>(); - int successCount = 0; - boolean anyDataRead = false; - Set touchedCompanyIds = new HashSet<>(); - - try (InputStream is = zipFile.getInputStream(); ZipInputStream zis = new ZipInputStream(is, charset)) { - ZipEntry entry; - while ((entry = zis.getNextEntry()) != null) { - if (entry.isDirectory()) { - continue; - } - String entryName = entry.getName(); - if (!isExcelFileName(entryName)) { - continue; - } - - byte[] bytes = readAllBytes(zis); - String entryFileName = safeFileLabel(entryName); - MultipartFile excelFile = new InMemoryMultipartFile(entryFileName, bytes); - - try { - ImportOutcome outcome = importFromExcel(excelFile, entryFileName, currentUserId, currentTenantId, companyId, true); - if (outcome.anyDataRead) { - anyDataRead = true; - successCount += outcome.successCount; - errorMessages.addAll(outcome.errorMessages); - touchedCompanyIds.addAll(outcome.touchedCompanyIds); - } - } catch (Exception e) { - errorMessages.add("【" + entryFileName + "】解析失败:" + e.getMessage()); - } - } - } - return new ImportOutcome(anyDataRead, successCount, errorMessages, touchedCompanyIds); - } - - private ImportOutcome importHistoryFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception { - try { - return importHistoryFromZip(zipFile, currentUserId, currentTenantId, companyId, StandardCharsets.UTF_8); - } catch (IllegalArgumentException e) { - return importHistoryFromZip(zipFile, currentUserId, currentTenantId, companyId, Charset.forName("GBK")); - } - } - - private ImportOutcome importHistoryFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId, Charset charset) throws Exception { - List errorMessages = new ArrayList<>(); - int successCount = 0; - boolean anyDataRead = false; - Set touchedCompanyIds = new HashSet<>(); - - try (InputStream is = zipFile.getInputStream(); ZipInputStream zis = new ZipInputStream(is, charset)) { - ZipEntry entry; - while ((entry = zis.getNextEntry()) != null) { - if (entry.isDirectory()) { - continue; - } - String entryName = entry.getName(); - if (!isExcelFileName(entryName)) { - continue; - } - - byte[] bytes = readAllBytes(zis); - String entryFileName = safeFileLabel(entryName); - MultipartFile excelFile = new InMemoryMultipartFile(entryFileName, bytes); - - try { - ImportOutcome outcome = importHistoryFromExcel(excelFile, entryFileName, currentUserId, currentTenantId, companyId); - if (outcome.anyDataRead) { - anyDataRead = true; - successCount += outcome.successCount; - errorMessages.addAll(outcome.errorMessages); - touchedCompanyIds.addAll(outcome.touchedCompanyIds); - } - } catch (Exception e) { - errorMessages.add("【" + entryFileName + "】解析失败:" + e.getMessage()); - } - } - } - return new ImportOutcome(anyDataRead, successCount, errorMessages, touchedCompanyIds); - } - - private static boolean isZip(MultipartFile file) { - String filename = file != null ? file.getOriginalFilename() : null; - if (filename == null) { - return false; - } - return filename.toLowerCase(Locale.ROOT).endsWith(".zip"); - } - - private ExcelImportSupport.ImportResult readDebtorImport(MultipartFile excelFile, boolean strictDebtorSheet) throws Exception { - List debtorSheetIndices = findDebtorSheetIndices(excelFile); - for (Integer sheetIndex : debtorSheetIndices) { - ExcelImportSupport.ImportResult sheetResult = ExcelImportSupport.readBest( - excelFile, - CreditJudgmentDebtorImportParam.class, - this::isEmptyImportRow, - this::isScoreImportRow, - sheetIndex - ); - if (!CollectionUtils.isEmpty(sheetResult.getData())) { - return sheetResult; - } - } - if (strictDebtorSheet) { - return new ExcelImportSupport.ImportResult<>(new ArrayList<>(), 0, 0); - } - return ExcelImportSupport.readAnySheetBest(excelFile, CreditJudgmentDebtorImportParam.class, this::isEmptyImportRow, this::isScoreImportRow); - } - - private boolean isScoreImportRow(CreditJudgmentDebtorImportParam param) { - if (param == null) { - return false; - } - if (isImportHeaderRow(param)) { - return false; - } - return !ImportHelper.isBlank(param.getCaseNumber()); - } - - private List findDebtorSheetIndices(MultipartFile excelFile) throws Exception { - // Prefer an explicitly-named "被执行人" sheet when present. - List preferred = new ArrayList<>(); - List indices = new ArrayList<>(); - try (InputStream is = excelFile.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { - int sheetCount = workbook.getNumberOfSheets(); - for (int i = 0; i < sheetCount; i++) { - String sheetName = workbook.getSheetName(i); - if (!isDebtorSheetName(sheetName)) { - continue; - } - String normalized = normalizeSheetName(sheetName); - if ("被执行人".equals(normalized)) { - preferred.add(i); - } else { - indices.add(i); - } - } - } - preferred.addAll(indices); - return preferred; - } - - private static boolean isDebtorSheetName(String sheetName) { - if (sheetName == null) { - return false; - } - String normalized = normalizeSheetName(sheetName); - return normalized.contains("被执行人") && !normalized.contains("失信") && !normalized.contains("历史"); - } - - private static String normalizeSheetName(String sheetName) { - if (sheetName == null) { - return ""; - } - return sheetName.replace(" ", "").replace(" ", "").trim(); - } - - private static boolean isExcelFileName(String name) { - if (name == null) { - return false; - } - String lower = name.toLowerCase(Locale.ROOT); - return lower.endsWith(".xlsx") || lower.endsWith(".xls") || lower.endsWith(".xlsm"); - } - - private static String safeFileLabel(String name) { - if (ImportHelper.isBlank(name)) { - return ""; - } - int lastSlash = name.lastIndexOf('/'); - if (lastSlash >= 0 && lastSlash + 1 < name.length()) { - return name.substring(lastSlash + 1); - } - return name; - } - - private static byte[] readAllBytes(InputStream inputStream) throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - byte[] buffer = new byte[8192]; - int read; - while ((read = inputStream.read(buffer)) != -1) { - out.write(buffer, 0, read); - } - return out.toByteArray(); - } - - private static class InMemoryMultipartFile implements MultipartFile { - private final String originalFilename; - private final byte[] bytes; - - private InMemoryMultipartFile(String originalFilename, byte[] bytes) { - this.originalFilename = originalFilename; - this.bytes = bytes != null ? bytes : new byte[0]; - } - - @Override - public String getName() { - return originalFilename; - } - - @Override - public String getOriginalFilename() { - return originalFilename; - } - - @Override - public String getContentType() { - return null; - } - - @Override - public boolean isEmpty() { - return bytes.length == 0; - } - - @Override - public long getSize() { - return bytes.length; - } - - @Override - public byte[] getBytes() { - return bytes; - } - - @Override - public InputStream getInputStream() { - return new java.io.ByteArrayInputStream(bytes); - } - - @Override - public void transferTo(java.io.File dest) throws IOException { - Files.write(dest.toPath(), bytes); - } - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditJudicialDocumentController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditJudicialDocumentController.java deleted file mode 100644 index 947cee9..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditJudicialDocumentController.java +++ /dev/null @@ -1,513 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditJudicialDocument; -import com.gxwebsoft.credit.param.CreditJudicialDocumentImportParam; -import com.gxwebsoft.credit.param.CreditJudicialDocumentParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditJudicialDocumentService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 裁判文书司法大数据控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:03 - */ -@Tag(name = "裁判文书司法大数据管理") -@RestController -@RequestMapping("/api/credit/credit-judicial-document") -public class CreditJudicialDocumentController extends BaseController { - @Resource - private CreditJudicialDocumentService creditJudicialDocumentService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询裁判文书司法大数据") - @GetMapping("/page") - public ApiResult> page(CreditJudicialDocumentParam param) { - // 使用关联查询 - return success(creditJudicialDocumentService.pageRel(param)); - } - - @Operation(summary = "查询全部裁判文书司法大数据") - @GetMapping() - public ApiResult> list(CreditJudicialDocumentParam param) { - // 使用关联查询 - return success(creditJudicialDocumentService.listRel(param)); - } - - @Operation(summary = "根据id查询裁判文书司法大数据") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditJudicialDocumentService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditJudicialDocument:save')") - @OperationLog - @Operation(summary = "添加裁判文书司法大数据") - @PostMapping() - public ApiResult save(@RequestBody CreditJudicialDocument creditJudicialDocument) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditJudicialDocument.setUserId(loginUser.getUserId()); - // } - if (creditJudicialDocumentService.save(creditJudicialDocument)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudicialDocument:update')") - @OperationLog - @Operation(summary = "修改裁判文书司法大数据") - @PutMapping() - public ApiResult update(@RequestBody CreditJudicialDocument creditJudicialDocument) { - if (creditJudicialDocumentService.updateById(creditJudicialDocument)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudicialDocument:remove')") - @OperationLog - @Operation(summary = "删除裁判文书司法大数据") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditJudicialDocument.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudicialDocument:save')") - @OperationLog - @Operation(summary = "批量添加裁判文书司法大数据") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditJudicialDocumentService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudicialDocument:update')") - @OperationLog - @Operation(summary = "批量修改裁判文书司法大数据") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditJudicialDocumentService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudicialDocument:remove')") - @OperationLog - @Operation(summary = "批量删除裁判文书司法大数据") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditJudicialDocument.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据“当事人/第三人”文本中包含的企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditJudicialDocument:update')") - @OperationLog - @Operation(summary = "根据当事人字段包含企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditJudicialDocumentService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditJudicialDocument::getId, - CreditJudicialDocument::setId, - CreditJudicialDocument::getCompanyId, - CreditJudicialDocument::setCompanyId, - CreditJudicialDocument::getHasData, - CreditJudicialDocument::setHasData, - CreditJudicialDocument::getTenantId, - CreditJudicialDocument::new, - // 需求:otherPartiesThirdParty 字段包含企业名称时,回填 companyId - CreditJudicialDocument::getOtherPartiesThirdParty - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入裁判文书司法大数据 - */ - @PreAuthorize("hasAuthority('credit:creditJudicialDocument:save')") - @Operation(summary = "批量导入裁判文书司法大数据") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - // 支持按选项卡名称导入:默认读取“裁判文书”sheet(不存在则回退到第 0 个sheet) - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "裁判文书", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditJudicialDocumentImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - Map urlByTitle = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "文书标题"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditJudicialDocumentImportParam param = list.get(i); - try { - CreditJudicialDocument item = convertImportParamToEntity(param); - String link = null; - if (!ImportHelper.isBlank(item.getCaseNumber())) { - link = urlByCaseNumber.get(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(link) && !ImportHelper.isBlank(item.getTitle())) { - link = urlByTitle.get(item.getTitle().trim()); - } - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditJudicialDocumentService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditJudicialDocument::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditJudicialDocumentService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditJudicialDocument::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDICIAL_DOCUMENT, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史裁判文书(仅解析“历史裁判文书”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditJudicialDocument:save')") - @Operation(summary = "批量导入历史裁判文书司法大数据") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史裁判文书"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史裁判文书”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditJudicialDocumentImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - Map urlByTitle = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "文书标题"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditJudicialDocumentImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditJudicialDocument item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = null; - if (!ImportHelper.isBlank(item.getCaseNumber())) { - link = urlByCaseNumber.get(item.getCaseNumber()); - } - if (ImportHelper.isBlank(link) && !ImportHelper.isBlank(item.getTitle())) { - link = urlByTitle.get(item.getTitle().trim()); - } - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditJudicialDocumentService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditJudicialDocument::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditJudicialDocumentService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditJudicialDocument::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDICIAL_DOCUMENT, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载裁判文书导入模板 - */ - @Operation(summary = "下载裁判文书导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditJudicialDocumentImportParam example = new CreditJudicialDocumentImportParam(); - example.setTitle("裁判文书"); - example.setOtherPartiesThirdParty("第三人示例"); - example.setOccurrenceTime("2024-01-01"); - example.setCaseNumber("(2024)示例案号"); - example.setCauseOfAction("案由示例"); - example.setInvolvedAmount("100000"); - example.setDefendantAppellee("裁判结果示例"); - example.setCourtName("示例法院"); - example.setReleaseDate("2024-01-02"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("裁判文书导入模板", "裁判文书", CreditJudicialDocumentImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_judicial_document_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditJudicialDocumentImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()); - } - - private CreditJudicialDocument convertImportParamToEntity(CreditJudicialDocumentImportParam param) { - CreditJudicialDocument entity = new CreditJudicialDocument(); - - String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) - ? param.getInvolvedAmount2() - : param.getInvolvedAmount(); - - entity.setTitle(param.getTitle()); - entity.setDocumentType(param.getDocumentType()); - entity.setDataStatus(param.getDataStatus()); - entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty()); - entity.setOccurrenceTime(param.getOccurrenceTime()); - entity.setCaseNumber(param.getCaseNumber()); - entity.setCauseOfAction(param.getCauseOfAction()); - entity.setInvolvedAmount(involvedAmount); - // Excel导入字段映射补全:否则对应数据库字段(defendant_appellee/release_date)会一直为空 - entity.setDefendantAppellee(param.getDefendantAppellee()); - entity.setReleaseDate(param.getReleaseDate()); - entity.setCourtName(param.getCourtName()); - entity.setComments(param.getComments()); - System.out.println("entity = " + entity); - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditJudiciaryController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditJudiciaryController.java deleted file mode 100644 index a87d594..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditJudiciaryController.java +++ /dev/null @@ -1,430 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.ExcelImportUtil; -import cn.afterturn.easypoi.excel.entity.ExportParams; -import cn.afterturn.easypoi.excel.entity.ImportParams; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditJudiciary; -import com.gxwebsoft.credit.param.CreditJudiciaryImportParam; -import com.gxwebsoft.credit.param.CreditJudiciaryParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditJudiciaryService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 司法案件控制器 - * - * @author 科技小王子 - * @since 2025-12-16 15:23:58 - */ -@Tag(name = "司法案件管理") -@RestController -@RequestMapping("/api/credit/credit-judiciary") -public class CreditJudiciaryController extends BaseController { - @Resource - private CreditJudiciaryService creditJudiciaryService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询司法案件") - @GetMapping("/page") - public ApiResult> page(CreditJudiciaryParam param) { - // 使用关联查询 - return success(creditJudiciaryService.pageRel(param)); - } - - @Operation(summary = "查询全部司法案件") - @GetMapping() - public ApiResult> list(CreditJudiciaryParam param) { - // 使用关联查询 - return success(creditJudiciaryService.listRel(param)); - } - - @Operation(summary = "根据id查询司法案件") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditJudiciaryService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditJudiciary:save')") - @OperationLog - @Operation(summary = "添加司法案件") - @PostMapping() - public ApiResult save(@RequestBody CreditJudiciary creditJudiciary) { - if (creditJudiciaryService.save(creditJudiciary)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudiciary:update')") - @OperationLog - @Operation(summary = "修改司法案件") - @PutMapping() - public ApiResult update(@RequestBody CreditJudiciary creditJudiciary) { - if (creditJudiciaryService.updateById(creditJudiciary)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudiciary:remove')") - @OperationLog - @Operation(summary = "删除司法案件") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditJudiciary.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudiciary:save')") - @OperationLog - @Operation(summary = "批量添加司法案件") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditJudiciaryService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudiciary:update')") - @OperationLog - @Operation(summary = "批量修改司法案件") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditJudiciaryService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditJudiciary:remove')") - @OperationLog - @Operation(summary = "批量删除司法案件") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditJudiciary.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditJudiciary:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditJudiciaryService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditJudiciary::getId, - CreditJudiciary::setId, - CreditJudiciary::getName, - CreditJudiciary::getCompanyId, - CreditJudiciary::setCompanyId, - CreditJudiciary::getHasData, - CreditJudiciary::setHasData, - CreditJudiciary::getTenantId, - CreditJudiciary::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入司法案件 - */ - @PreAuthorize("hasAuthority('credit:creditJudiciary:save')") - @Operation(summary = "批量导入司法案件") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - // 支持按选项卡名称导入:默认读取“司法案件”sheet(不存在则回退到第 0 个sheet) - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "司法案件", 0); - - List list = null; - int usedTitleRows = 0; - int usedHeadRows = 0; - int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {0, 2}, {0, 3}}; - - for (int[] config : tryConfigs) { - list = filterEmptyRows(tryImport(file, config[0], config[1], sheetIndex)); - if (!CollectionUtils.isEmpty(list)) { - usedTitleRows = config[0]; - usedHeadRows = config[1]; - break; - } - } - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - // easypoi 默认不会读取单元格超链接地址;url 可能挂在“案号/案件名称”等列的超链接中,需要额外读取回填。 - Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, sheetIndex, usedTitleRows, usedHeadRows, "案号"); - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, sheetIndex, usedTitleRows, usedHeadRows, "案件名称"); - // 有些源文件会单独提供“url/网址/链接”等列(可能是纯文本也可能是超链接) - Map urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "url"); - if (urlByCodeFromUrlCol.isEmpty()) { - urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "URL"); - } - if (urlByCodeFromUrlCol.isEmpty()) { - urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "网址"); - } - if (urlByCodeFromUrlCol.isEmpty()) { - urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "链接"); - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditJudiciaryImportParam param = list.get(i); - try { - CreditJudiciary item = convertImportParamToEntity(param); - if (!isBlank(item.getCode())) { - String key = item.getCode().trim(); - String link = urlByCode.get(key); - if (isBlank(link)) { - link = urlByCodeFromUrlCol.get(key); - } - if (!isBlank(link)) { - item.setUrl(link.trim()); - } - } else if (!isBlank(item.getName())) { - String link = urlByName.get(item.getName().trim()); - if (!isBlank(link)) { - item.setUrl(link.trim()); - } - } - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - - // 设置默认值 - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getType() == null) { - item.setType(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - // 验证必填字段 -// if (item.getName() == null || item.getName().trim().isEmpty()) { -// errorMessages.add("第" + excelRowNumber + "行:项目名称不能为空"); -// continue; -// } - if (item.getCode() == null || item.getCode().trim().isEmpty()) { - errorMessages.add("第" + excelRowNumber + "行:唯一标识不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditJudiciaryService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditJudiciary::getCode, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditJudiciaryService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditJudiciary::getCode, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDICIARY, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载司法案件导入模板 - */ - @Operation(summary = "下载司法案件导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditJudiciaryImportParam example = new CreditJudiciaryImportParam(); - example.setName("示例客户"); - example.setCode("C0001"); - example.setInfoType("执行案件"); - example.setReason("买卖合同纠纷"); - example.setProcessDate("2025-08-27"); - example.setCaseProgress("首次执行"); - example.setCaseIdentity("被执行人"); - example.setCode("(2025)闽0103执5480号"); - example.setCourt("福建省福州市台江区人民法院"); - example.setCaseAmount("5134060.00"); - templateList.add(example); - - ExportParams exportParams = new ExportParams("司法案件导入模板", "司法案件"); - - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, CreditJudiciaryImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_judiciary_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private List tryImport(MultipartFile file, int titleRows, int headRows, int sheetIndex) throws Exception { - ImportParams importParams = new ImportParams(); - importParams.setTitleRows(titleRows); - importParams.setHeadRows(headRows); - importParams.setStartSheetIndex(sheetIndex); - importParams.setSheetNum(1); - return ExcelImportUtil.importExcel(file.getInputStream(), CreditJudiciaryImportParam.class, importParams); - } - - /** - * 过滤掉完全空白的导入行,避免空行导致导入失败 - */ - private List filterEmptyRows(List rawList) { - if (CollectionUtils.isEmpty(rawList)) { - return rawList; - } - rawList.removeIf(this::isEmptyImportRow); - return rawList; - } - - private boolean isEmptyImportRow(CreditJudiciaryImportParam param) { - if (param == null) { - return true; - } - return isBlank(param.getName()) - && isBlank(param.getCode()) - && isBlank(param.getName()) - && isBlank(param.getInfoType()); - } - - private boolean isBlank(String value) { - return value == null || value.trim().isEmpty(); - } - - /** - * 将CreditJudiciaryImportParam转换为CreditJudiciary实体 - */ - private CreditJudiciary convertImportParamToEntity(CreditJudiciaryImportParam param) { - CreditJudiciary entity = new CreditJudiciary(); - - entity.setCode(param.getCode()); - entity.setName(param.getName()); - entity.setInfoType(param.getInfoType()); - entity.setReason(param.getReason()); - entity.setProcessDate(param.getProcessDate()); - entity.setCaseProgress(param.getCaseProgress()); - entity.setCaseIdentity(param.getCaseIdentity()); - entity.setCourt(param.getCourt()); - entity.setCaseAmount(param.getCaseAmount()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditMediationController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditMediationController.java deleted file mode 100644 index 553c560..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditMediationController.java +++ /dev/null @@ -1,498 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditMediation; -import com.gxwebsoft.credit.param.CreditMediationImportParam; -import com.gxwebsoft.credit.param.CreditMediationParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditMediationService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 诉前调解司法大数据控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:25 - */ -@Tag(name = "诉前调解司法大数据管理") -@RestController -@RequestMapping("/api/credit/credit-mediation") -public class CreditMediationController extends BaseController { - @Resource - private CreditMediationService creditMediationService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询诉前调解司法大数据") - @GetMapping("/page") - public ApiResult> page(CreditMediationParam param) { - // 使用关联查询 - return success(creditMediationService.pageRel(param)); - } - - @Operation(summary = "查询全部诉前调解司法大数据") - @GetMapping() - public ApiResult> list(CreditMediationParam param) { - // 使用关联查询 - return success(creditMediationService.listRel(param)); - } - - @Operation(summary = "根据id查询诉前调解司法大数据") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditMediationService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditMediation:save')") - @OperationLog - @Operation(summary = "添加诉前调解司法大数据") - @PostMapping() - public ApiResult save(@RequestBody CreditMediation creditMediation) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditMediation.setUserId(loginUser.getUserId()); - // } - if (creditMediationService.save(creditMediation)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMediation:update')") - @OperationLog - @Operation(summary = "修改诉前调解司法大数据") - @PutMapping() - public ApiResult update(@RequestBody CreditMediation creditMediation) { - if (creditMediationService.updateById(creditMediation)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMediation:remove')") - @OperationLog - @Operation(summary = "删除诉前调解司法大数据") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditMediation.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMediation:save')") - @OperationLog - @Operation(summary = "批量添加诉前调解司法大数据") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditMediationService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMediation:update')") - @OperationLog - @Operation(summary = "批量修改诉前调解司法大数据") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditMediationService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMediation:remove')") - @OperationLog - @Operation(summary = "批量删除诉前调解司法大数据") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditMediation.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditMediation:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Party columns may contain multiple roles/names; match if any company name is contained in the text. - // Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人 - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditMediationService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditMediation::getId, - CreditMediation::setId, - CreditMediation::getCompanyId, - CreditMediation::setCompanyId, - CreditMediation::getHasData, - CreditMediation::setHasData, - CreditMediation::getTenantId, - CreditMediation::new, - CreditMediation::getPlaintiffAppellant, - CreditMediation::getAppellee, - CreditMediation::getOtherPartiesThirdParty - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入诉前调解司法大数据 - */ - @PreAuthorize("hasAuthority('credit:creditMediation:save')") - @Operation(summary = "批量导入诉前调解司法大数据") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "诉前调解", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditMediationImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditMediationImportParam param = list.get(i); - try { - CreditMediation item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCaseNumber())) { - String link = urlByCaseNumber.get(item.getCaseNumber().trim()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditMediationService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditMediation::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditMediationService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditMediation::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.MEDIATION, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史诉前调解(仅解析“历史诉前调解”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditMediation:save')") - @Operation(summary = "批量导入历史诉前调解") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史诉前调解"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史诉前调解”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditMediationImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditMediationImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditMediation item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCaseNumber.get(item.getCaseNumber()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditMediationService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditMediation::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditMediationService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditMediation::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.MEDIATION, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载诉前调解导入模板 - */ - @Operation(summary = "下载诉前调解导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditMediationImportParam example = new CreditMediationImportParam(); - example.setOtherPartiesThirdParty("当事人"); - example.setCaseNumber("(2024)示例案号"); - example.setCauseOfAction("案由示例"); - example.setCourtName("示例法院"); - example.setOccurrenceTime("2024-01-01"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("诉前调解导入模板", "诉前调解", CreditMediationImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_mediation_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditMediationImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()) - && ImportHelper.isBlank(param.getCauseOfAction()); - } - - private CreditMediation convertImportParamToEntity(CreditMediationImportParam param) { - CreditMediation entity = new CreditMediation(); - - // Template compatibility: prefer new columns ("发生时间"/"其他当事人/第三人"), fallback to legacy ones ("立案日期"/"当事人"). - String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) - ? param.getOccurrenceTime2() - : param.getOccurrenceTime(); - String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) - ? param.getOtherPartiesThirdParty2() - : param.getOtherPartiesThirdParty(); - - entity.setOccurrenceTime(occurrenceTime); - entity.setOtherPartiesThirdParty(otherPartiesThirdParty); - entity.setCaseNumber(param.getCaseNumber()); - entity.setCauseOfAction(param.getCauseOfAction()); - entity.setCourtName(param.getCourtName()); - entity.setComments(param.getComments()); - entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); - entity.setAppellee(param.getAppellee()); - entity.setInvolvedAmount(param.getInvolvedAmount()); - entity.setDataStatus(param.getDataStatus()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditMpCustomerController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditMpCustomerController.java deleted file mode 100644 index f300ce9..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditMpCustomerController.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.credit.service.CreditMpCustomerService; -import com.gxwebsoft.credit.entity.CreditMpCustomer; -import com.gxwebsoft.credit.param.CreditMpCustomerParam; -import com.gxwebsoft.credit.param.BatchFollowStepApprovalDTO; -import com.gxwebsoft.credit.param.EndFollowProcessDTO; -import com.gxwebsoft.credit.param.FollowStepApprovalDTO; -import com.gxwebsoft.credit.param.FollowStepQueryDTO; -import com.gxwebsoft.credit.vo.FollowStatisticsDTO; -import com.gxwebsoft.credit.vo.PendingApprovalStepVO; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 小程序端客户控制器 - * - * @author 科技小王子 - * @since 2026-03-16 20:59:17 - */ -@Tag(name = "小程序端客户管理") -@RestController -@RequestMapping("/api/credit/credit-mp-customer") -public class CreditMpCustomerController extends BaseController { - @Resource - private CreditMpCustomerService creditMpCustomerService; - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:list')") - @Operation(summary = "分页查询小程序端客户") - @GetMapping("/page") - public ApiResult> page(CreditMpCustomerParam param) { - // 使用关联查询 - return success(creditMpCustomerService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:list')") - @Operation(summary = "查询全部小程序端客户") - @GetMapping() - public ApiResult> list(CreditMpCustomerParam param) { - // 使用关联查询 - return success(creditMpCustomerService.listRel(param)); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:list')") - @Operation(summary = "根据id查询小程序端客户") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditMpCustomerService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:save')") - @OperationLog - @Operation(summary = "添加小程序端客户") - @PostMapping() - public ApiResult save(@RequestBody CreditMpCustomer creditMpCustomer) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - creditMpCustomer.setUserId(loginUser.getUserId()); - } - if (creditMpCustomerService.save(creditMpCustomer)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:update')") - @OperationLog - @Operation(summary = "修改小程序端客户") - @PutMapping() - public ApiResult update(@RequestBody CreditMpCustomer creditMpCustomer) { - if (creditMpCustomerService.updateById(creditMpCustomer)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:remove')") - @OperationLog - @Operation(summary = "删除小程序端客户") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (creditMpCustomerService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:save')") - @OperationLog - @Operation(summary = "批量添加小程序端客户") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditMpCustomerService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:update')") - @OperationLog - @Operation(summary = "批量修改小程序端客户") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditMpCustomerService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:remove')") - @OperationLog - @Operation(summary = "批量删除小程序端客户") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (creditMpCustomerService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:update')") - @OperationLog - @Operation(summary = "审核跟进步骤") - @PostMapping("/approve-follow-step") - public ApiResult approveFollowStep(@RequestBody FollowStepApprovalDTO dto) { - creditMpCustomerService.approveFollowStep(dto); - return success("审核成功"); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:update')") - @OperationLog - @Operation(summary = "批量审核跟进步骤") - @PostMapping("/batch-approve-follow-steps") - public ApiResult batchApproveFollowSteps(@RequestBody BatchFollowStepApprovalDTO dto) { - creditMpCustomerService.batchApproveFollowSteps(dto); - return success("批量审核成功"); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:list')") - @Operation(summary = "获取待审核的跟进步骤") - @GetMapping("/pending-approval-steps") - public ApiResult> getPendingApprovalSteps(FollowStepQueryDTO query) { - List list = creditMpCustomerService.getPendingApprovalSteps(query); - return success(list); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:list')") - @Operation(summary = "获取客户跟进统计") - @GetMapping("/follow-statistics/{customerId}") - public ApiResult getFollowStatistics(@PathVariable Long customerId) { - FollowStatisticsDTO statistics = creditMpCustomerService.getFollowStatistics(customerId); - return success(statistics); - } - - @PreAuthorize("hasAuthority('credit:creditMpCustomer:update')") - @OperationLog - @Operation(summary = "结束客户跟进流程") - @PostMapping("/end-follow-process") - public ApiResult endFollowProcess(@RequestBody EndFollowProcessDTO dto) { - creditMpCustomerService.endFollowProcess(dto); - return success("流程结束成功"); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java deleted file mode 100644 index b77f908..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java +++ /dev/null @@ -1,462 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditNearbyCompany; -import com.gxwebsoft.credit.param.CreditNearbyCompanyImportParam; -import com.gxwebsoft.credit.param.CreditNearbyCompanyParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditNearbyCompanyService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 附近企业控制器 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Tag(name = "附近企业管理") -@RestController -@RequestMapping("/api/credit/credit-nearby-company") -public class CreditNearbyCompanyController extends BaseController { - @Resource - private CreditNearbyCompanyService creditNearbyCompanyService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询附近企业") - @GetMapping("/page") - public ApiResult> page(CreditNearbyCompanyParam param) { - // 使用关联查询 - return success(creditNearbyCompanyService.pageRel(param)); - } - - @Operation(summary = "查询全部附近企业") - @GetMapping() - public ApiResult> list(CreditNearbyCompanyParam param) { - // 使用关联查询 - return success(creditNearbyCompanyService.listRel(param)); - } - - @Operation(summary = "根据id查询附近企业") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditNearbyCompanyService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditNearbyCompany:save')") - @OperationLog - @Operation(summary = "添加附近企业") - @PostMapping() - public ApiResult save(@RequestBody CreditNearbyCompany creditNearbyCompany) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditNearbyCompany.setUserId(loginUser.getUserId()); - // } - if (creditNearbyCompanyService.save(creditNearbyCompany)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditNearbyCompany:update')") - @OperationLog - @Operation(summary = "修改附近企业") - @PutMapping() - public ApiResult update(@RequestBody CreditNearbyCompany creditNearbyCompany) { - if (creditNearbyCompanyService.updateById(creditNearbyCompany)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditNearbyCompany:remove')") - @OperationLog - @Operation(summary = "删除附近企业") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditNearbyCompany.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditNearbyCompany:save')") - @OperationLog - @Operation(summary = "批量添加附近企业") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditNearbyCompanyService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditNearbyCompany:update')") - @OperationLog - @Operation(summary = "批量修改附近企业") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditNearbyCompanyService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditNearbyCompany:remove')") - @OperationLog - @Operation(summary = "批量删除附近企业") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditNearbyCompany.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditNearbyCompany:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditNearbyCompanyService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditNearbyCompany::getId, - CreditNearbyCompany::setId, - CreditNearbyCompany::getName, - CreditNearbyCompany::getCompanyId, - CreditNearbyCompany::setCompanyId, - CreditNearbyCompany::setCompanyName, - CreditNearbyCompany::getHasData, - CreditNearbyCompany::setHasData, - CreditNearbyCompany::getTenantId, - CreditNearbyCompany::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入附近企业 - */ - @PreAuthorize("hasAuthority('credit:creditNearbyCompany:save')") - @Operation(summary = "批量导入附近企业") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId, - @RequestParam(value = "parentId", required = false) Integer parentId, - @RequestParam(value = "type", required = false) Integer type) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( - file, CreditNearbyCompanyImportParam.class, this::isEmptyImportRow); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "统一社会信用代码"); - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - // 避免逐行写库:按批处理,显著降低 SQL 次数与事务开销 - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditNearbyCompanyImportParam param = list.get(i); - try { - CreditNearbyCompany item = convertImportParamToEntity(param); - String link = null; - if (!ImportHelper.isBlank(item.getCode())) { - link = urlByCode.get(item.getCode().trim()); - } - if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { - link = urlByName.get(item.getName().trim()); - } - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - - if (item.getParentId() == null && parentId != null) { - item.setParentId(parentId); - } - if (item.getType() == null && type != null) { - item.setType(type); - } - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getName())) { - errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空"); - continue; - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += persistImportChunk(chunkItems, chunkRowNumbers, companyId, parentId, type, currentTenantId, mpBatchSize, errorMessages); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += persistImportChunk(chunkItems, chunkRowNumbers, companyId, parentId, type, currentTenantId, mpBatchSize, errorMessages); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.NEARBY_COMPANY, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - private int persistImportChunk(List items, - List excelRowNumbers, - Integer companyId, - Integer parentId, - Integer type, - Integer tenantId, - int mpBatchSize, - List errorMessages) { - return batchImportSupport.persistInsertOnlyChunk( - creditNearbyCompanyService, - items, - excelRowNumbers, - mpBatchSize, - it -> { - if (it == null) { - return null; - } - String code = it.getCode(); - if (code != null && !code.trim().isEmpty()) { - return code; - } - return it.getName(); - }, - "", - errorMessages - ); - } - - /** - * 下载附近企业导入模板 - */ - @Operation(summary = "下载附近企业导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditNearbyCompanyImportParam example = new CreditNearbyCompanyImportParam(); - example.setName("示例科技有限公司"); - example.setRegistrationStatus("存续"); - example.setLegalPerson("李四"); - example.setRegisteredCapital("1000万人民币"); - example.setPaidinCapital("200万人民币"); - example.setEstablishDate("2018-06-01"); - example.setCode("91440101MA5XXXXXXX"); - example.setAddress("广西南宁市某某路1号"); - example.setPhone("13800000000"); - example.setEmail("demo@example.com"); - example.setProvince("广西"); - example.setCity("南宁"); - example.setRegion("青秀区"); - example.setDomain("https://example.com"); - example.setInstitutionType("有限责任公司"); - example.setCompanySize("小微企业"); - example.setRegistrationAuthority("南宁市市场监督管理局"); - example.setTaxpayerQualification("一般纳税人"); - example.setLatestAnnualReportYear("2023"); - example.setLatestAnnualReportOnOperatingRevenue("1000万"); - example.setEnterpriseScoreCheck("85"); - example.setCreditRating("A级"); - example.setCechnologyScore("70"); - example.setCechnologyLevel("良好"); - example.setSmallEnterprise("是"); - example.setCompanyProfile("企业简介示例"); - example.setNatureOfBusiness("经营范围示例"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("附近企业导入模板", "附近企业", CreditNearbyCompanyImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_nearby_company_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditNearbyCompanyImportParam param) { - if (param == null) { - return true; - } - if (isImportHeaderRow(param)) { - return true; - } - return ImportHelper.isBlank(param.getName()) - && ImportHelper.isBlank(param.getCode()) - && ImportHelper.isBlank(param.getLegalPerson()); - } - - private boolean isImportHeaderRow(CreditNearbyCompanyImportParam param) { - return isHeaderValue(param.getName(), "企业名称") - || isHeaderValue(param.getCode(), "统一社会信用代码") - || isHeaderValue(param.getLegalPerson(), "法定代表人"); - } - - private static boolean isHeaderValue(String value, String headerText) { - if (value == null) { - return false; - } - return headerText.equals(value.trim()); - } - - private CreditNearbyCompany convertImportParamToEntity(CreditNearbyCompanyImportParam param) { - CreditNearbyCompany entity = new CreditNearbyCompany(); - - entity.setName(param.getName()); - entity.setRegistrationStatus(param.getRegistrationStatus()); - entity.setLegalPerson(param.getLegalPerson()); - entity.setRegisteredCapital(param.getRegisteredCapital()); - entity.setEstablishDate(param.getEstablishDate()); - entity.setCode(param.getCode()); - entity.setAddress(param.getAddress()); - entity.setPhone(param.getPhone()); - entity.setEmail(param.getEmail()); - entity.setProvince(param.getProvince()); - entity.setCity(param.getCity()); - entity.setRegion(param.getRegion()); - entity.setTaxpayerCode(param.getTaxpayerCode()); - entity.setRegistrationNumber(param.getRegistrationNumber()); - entity.setOrganizationalCode(param.getOrganizationalCode()); - entity.setNumberOfInsuredPersons(param.getNumberOfInsuredPersons()); - entity.setAnnualReport(param.getAnnualReport()); - entity.setDomain(param.getDomain()); - entity.setBusinessTerm(param.getBusinessTerm()); - entity.setNationalStandardIndustryCategories(param.getNationalStandardIndustryCategories()); - entity.setNationalStandardIndustryCategories2(param.getNationalStandardIndustryCategories2()); - entity.setNationalStandardIndustryCategories3(param.getNationalStandardIndustryCategories3()); - entity.setNationalStandardIndustryCategories4(param.getNationalStandardIndustryCategories4()); - entity.setFormerName(param.getFormerName()); - entity.setEnglishName(param.getEnglishName()); - entity.setMailingAddress(param.getMailingAddress()); - entity.setMailingEmail(param.getMailingEmail()); - entity.setTel(param.getTel()); - entity.setPostalCode(param.getPostalCode()); - entity.setNationalStandardIndustryCategories5(param.getNationalStandardIndustryCategories5()); - entity.setNationalStandardIndustryCategories6(param.getNationalStandardIndustryCategories6()); - entity.setNationalStandardIndustryCategories7(param.getNationalStandardIndustryCategories7()); - entity.setNationalStandardIndustryCategories8(param.getNationalStandardIndustryCategories8()); - entity.setType(param.getType()); - entity.setInstitutionType(param.getInstitutionType()); - entity.setCompanySize(param.getCompanySize()); - entity.setCompanyProfile(param.getCompanyProfile()); - entity.setNatureOfBusiness(param.getNatureOfBusiness()); - entity.setComments(param.getComments()); - entity.setMoreEmail(param.getMoreEmail()); - entity.setMoreTel(param.getMoreTel()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditPatentController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditPatentController.java deleted file mode 100644 index 5581e54..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditPatentController.java +++ /dev/null @@ -1,395 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditPatent; -import com.gxwebsoft.credit.param.CreditPatentImportParam; -import com.gxwebsoft.credit.param.CreditPatentParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditPatentService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 专利控制器 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Tag(name = "专利管理") -@RestController -@RequestMapping("/api/credit/credit-patent") -public class CreditPatentController extends BaseController { - @Resource - private CreditPatentService creditPatentService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询专利") - @GetMapping("/page") - public ApiResult> page(CreditPatentParam param) { - // 使用关联查询 - return success(creditPatentService.pageRel(param)); - } - - @Operation(summary = "查询全部专利") - @GetMapping() - public ApiResult> list(CreditPatentParam param) { - // 使用关联查询 - return success(creditPatentService.listRel(param)); - } - - @Operation(summary = "根据id查询专利") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditPatentService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditPatent:save')") - @OperationLog - @Operation(summary = "添加专利") - @PostMapping() - public ApiResult save(@RequestBody CreditPatent creditPatent) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditPatent.setUserId(loginUser.getUserId()); - // } - if (creditPatentService.save(creditPatent)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditPatent:update')") - @OperationLog - @Operation(summary = "修改专利") - @PutMapping() - public ApiResult update(@RequestBody CreditPatent creditPatent) { - if (creditPatentService.updateById(creditPatent)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditPatent:remove')") - @OperationLog - @Operation(summary = "删除专利") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditPatent.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditPatent:save')") - @OperationLog - @Operation(summary = "批量添加专利") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditPatentService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditPatent:update')") - @OperationLog - @Operation(summary = "批量修改专利") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditPatentService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditPatent:remove')") - @OperationLog - @Operation(summary = "批量删除专利") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditPatent.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditPatent:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditPatentService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditPatent::getId, - CreditPatent::setId, - CreditPatent::getPatentApplicant, - CreditPatent::getCompanyId, - CreditPatent::setCompanyId, - CreditPatent::getHasData, - CreditPatent::setHasData, - CreditPatent::getTenantId, - CreditPatent::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入专利 - */ - @PreAuthorize("hasAuthority('credit:creditPatent:save')") - @Operation(summary = "批量导入专利") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - // 单企业表通常是多 sheet,专利页签名一般为“专利” - int preferredSheetIndex = ExcelImportSupport.findSheetIndex(file, "专利", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditPatentImportParam.class, this::isEmptyImportRow, preferredSheetIndex); - if (CollectionUtils.isEmpty(importResult.getData())) { - importResult = ExcelImportSupport.readAnySheet(file, CreditPatentImportParam.class, this::isEmptyImportRow); - } - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByRegisterNo = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "申请号"); - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "发明名称"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditPatentImportParam param = list.get(i); - try { - CreditPatent item = convertImportParamToEntity(param); - String link = null; - if (!ImportHelper.isBlank(item.getRegisterNo())) { - link = urlByRegisterNo.get(item.getRegisterNo().trim()); - } - if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { - link = urlByName.get(item.getName().trim()); - } - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getRegisterNo())) { - errorMessages.add("第" + excelRowNumber + "行:申请号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditPatentService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditPatent::getRegisterNo, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditPatentService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditPatent::getRegisterNo, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.PATENT, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载专利导入模板 - */ - @Operation(summary = "下载专利导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditPatentImportParam example = new CreditPatentImportParam(); - example.setName("一种示例装置及方法"); - example.setType("发明专利"); - example.setStatusText("有效"); - example.setRegisterNo("CN2024XXXXXXXX.X"); - example.setRegisterDate("2024-01-01"); - example.setPublicNo("CN1XXXXXXXXX"); - example.setPublicDate("2024-06-01"); - example.setInventor("张三;李四"); - example.setPatentApplicant("示例科技有限公司"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("专利导入模板", "专利", CreditPatentImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_patent_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditPatentImportParam param) { - if (param == null) { - return true; - } - if (isImportHeaderRow(param)) { - return true; - } - return ImportHelper.isBlank(param.getName()) - && ImportHelper.isBlank(param.getType()) - && ImportHelper.isBlank(param.getStatusText()) - && ImportHelper.isBlank(param.getRegisterNo()) - && ImportHelper.isBlank(param.getRegisterDate()) - && ImportHelper.isBlank(param.getPublicNo()) - && ImportHelper.isBlank(param.getPublicDate()) - && ImportHelper.isBlank(param.getInventor()) - && ImportHelper.isBlank(param.getPatentApplicant()) - && ImportHelper.isBlank(param.getComments()); - } - - private boolean isImportHeaderRow(CreditPatentImportParam param) { - return isHeaderValue(param.getRegisterNo(), "申请号") - || isHeaderValue(param.getName(), "发明名称") - || isHeaderValue(param.getPatentApplicant(), "申请(专利权)人"); - } - - private static boolean isHeaderValue(String value, String headerText) { - if (value == null) { - return false; - } - return headerText.equals(value.trim()); - } - - private CreditPatent convertImportParamToEntity(CreditPatentImportParam param) { - CreditPatent entity = new CreditPatent(); - - entity.setName(param.getName()); - entity.setType(param.getType()); - entity.setStatusText(param.getStatusText()); - entity.setRegisterNo(param.getRegisterNo()); - entity.setRegisterDate(param.getRegisterDate()); - entity.setPublicNo(param.getPublicNo()); - entity.setPublicDate(param.getPublicDate()); - entity.setInventor(param.getInventor()); - entity.setPatentApplicant(param.getPatentApplicant()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java deleted file mode 100644 index ae6cfcf..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java +++ /dev/null @@ -1,359 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditRiskRelation; -import com.gxwebsoft.credit.param.CreditRiskRelationImportParam; -import com.gxwebsoft.credit.param.CreditRiskRelationParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditRiskRelationService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 风险关系表控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:41 - */ -@Tag(name = "风险关系表管理") -@RestController -@RequestMapping("/api/credit/credit-risk-relation") -public class CreditRiskRelationController extends BaseController { - @Resource - private CreditRiskRelationService creditRiskRelationService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询风险关系表") - @GetMapping("/page") - public ApiResult> page(CreditRiskRelationParam param) { - // 使用关联查询 - return success(creditRiskRelationService.pageRel(param)); - } - - @Operation(summary = "查询全部风险关系表") - @GetMapping() - public ApiResult> list(CreditRiskRelationParam param) { - // 使用关联查询 - return success(creditRiskRelationService.listRel(param)); - } - - @Operation(summary = "根据id查询风险关系表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditRiskRelationService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditRiskRelation:save')") - @OperationLog - @Operation(summary = "添加风险关系表") - @PostMapping() - public ApiResult save(@RequestBody CreditRiskRelation creditRiskRelation) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditRiskRelation.setUserId(loginUser.getUserId()); - // } - if (creditRiskRelationService.save(creditRiskRelation)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditRiskRelation:update')") - @OperationLog - @Operation(summary = "修改风险关系表") - @PutMapping() - public ApiResult update(@RequestBody CreditRiskRelation creditRiskRelation) { - if (creditRiskRelationService.updateById(creditRiskRelation)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditRiskRelation:remove')") - @OperationLog - @Operation(summary = "删除风险关系表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditRiskRelation.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditRiskRelation:save')") - @OperationLog - @Operation(summary = "批量添加风险关系表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditRiskRelationService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditRiskRelation:update')") - @OperationLog - @Operation(summary = "批量修改风险关系表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditRiskRelationService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditRiskRelation:remove')") - @OperationLog - @Operation(summary = "批量删除风险关系表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditRiskRelation.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditRiskRelation:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditRiskRelationService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditRiskRelation::getId, - CreditRiskRelation::setId, - CreditRiskRelation::getMainBodyName, - CreditRiskRelation::getCompanyId, - CreditRiskRelation::setCompanyId, - CreditRiskRelation::setCompanyName, - CreditRiskRelation::getHasData, - CreditRiskRelation::setHasData, - CreditRiskRelation::getTenantId, - CreditRiskRelation::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入风险关系表 - */ - @PreAuthorize("hasAuthority('credit:creditRiskRelation:save')") - @Operation(summary = "批量导入风险关系表") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "风险关系", 1); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditRiskRelationImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditRiskRelationImportParam param = list.get(i); - try { - CreditRiskRelation item = convertImportParamToEntity(param); - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getMainBodyName())) { - errorMessages.add("第" + excelRowNumber + "行:主体名称不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditRiskRelationService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditRiskRelation::getMainBodyName, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditRiskRelationService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditRiskRelation::getMainBodyName, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.RISK_RELATION, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载风险关系导入模板 - */ - @Operation(summary = "下载风险关系导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditRiskRelationImportParam example = new CreditRiskRelationImportParam(); - example.setMainBodyName("示例企业"); - example.setRegistrationStatus("存续"); - example.setRegisteredCapital("8000"); - example.setProvinceRegion("浙江"); - example.setAssociatedRelation("关联企业"); - example.setRiskRelation("存在风险关联"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("风险关系导入模板", "风险关系", CreditRiskRelationImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_risk_relation_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditRiskRelationImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getMainBodyName()) - && ImportHelper.isBlank(param.getRegistrationStatus()) - && ImportHelper.isBlank(param.getRegisteredCapital()); - } - - private CreditRiskRelation convertImportParamToEntity(CreditRiskRelationImportParam param) { - CreditRiskRelation entity = new CreditRiskRelation(); - - entity.setMainBodyName(param.getMainBodyName()); - entity.setRegistrationStatus(param.getRegistrationStatus()); - entity.setRegisteredCapital(param.getRegisteredCapital()); - entity.setProvinceRegion(param.getProvinceRegion()); - entity.setAssociatedRelation(param.getAssociatedRelation()); - entity.setRiskRelation(param.getRiskRelation()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java deleted file mode 100644 index 30073af..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java +++ /dev/null @@ -1,365 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditSupplier; -import com.gxwebsoft.credit.param.CreditSupplierImportParam; -import com.gxwebsoft.credit.param.CreditSupplierParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditSupplierService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 供应商控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:47 - */ -@Tag(name = "供应商管理") -@RestController -@RequestMapping("/api/credit/credit-supplier") -public class CreditSupplierController extends BaseController { - @Resource - private CreditSupplierService creditSupplierService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询供应商") - @GetMapping("/page") - public ApiResult> page(CreditSupplierParam param) { - // 使用关联查询 - return success(creditSupplierService.pageRel(param)); - } - - @Operation(summary = "查询全部供应商") - @GetMapping() - public ApiResult> list(CreditSupplierParam param) { - // 使用关联查询 - return success(creditSupplierService.listRel(param)); - } - - @Operation(summary = "根据id查询供应商") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditSupplierService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditSupplier:save')") - @OperationLog - @Operation(summary = "添加供应商") - @PostMapping() - public ApiResult save(@RequestBody CreditSupplier creditSupplier) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditSupplier.setUserId(loginUser.getUserId()); - // } - if (creditSupplierService.save(creditSupplier)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSupplier:update')") - @OperationLog - @Operation(summary = "修改供应商") - @PutMapping() - public ApiResult update(@RequestBody CreditSupplier creditSupplier) { - if (creditSupplierService.updateById(creditSupplier)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSupplier:remove')") - @OperationLog - @Operation(summary = "删除供应商") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditSupplier.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSupplier:save')") - @OperationLog - @Operation(summary = "批量添加供应商") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditSupplierService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSupplier:update')") - @OperationLog - @Operation(summary = "批量修改供应商") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditSupplierService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSupplier:remove')") - @OperationLog - @Operation(summary = "批量删除供应商") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditSupplier.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditSupplier:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditSupplierService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditSupplier::getId, - CreditSupplier::setId, - CreditSupplier::getSupplier, - CreditSupplier::getCompanyId, - CreditSupplier::setCompanyId, - CreditSupplier::setCompanyName, - CreditSupplier::getHasData, - CreditSupplier::setHasData, - CreditSupplier::getTenantId, - CreditSupplier::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入供应商 - */ - @PreAuthorize("hasAuthority('credit:creditSupplier:save')") - @Operation(summary = "批量导入供应商") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "供应商", 3); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditSupplierImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlBySupplier = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "供应商"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditSupplierImportParam param = list.get(i); - try { - CreditSupplier item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getSupplier())) { - String link = urlBySupplier.get(item.getSupplier().trim()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getSupplier())) { - errorMessages.add("第" + excelRowNumber + "行:供应商不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditSupplierService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditSupplier::getSupplier, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditSupplierService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditSupplier::getSupplier, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.SUPPLIER, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载供应商导入模板 - */ - @Operation(summary = "下载供应商导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditSupplierImportParam example = new CreditSupplierImportParam(); - example.setSupplier("示例供应商"); - example.setStatusTxt("合作中"); - example.setPurchaseAmount("120"); - example.setPublicDate("2024-02-01"); - example.setDataSource("公开渠道"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("供应商导入模板", "供应商", CreditSupplierImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_supplier_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditSupplierImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getSupplier()) - && ImportHelper.isBlank(param.getStatusTxt()) - && ImportHelper.isBlank(param.getPurchaseAmount()); - } - - private CreditSupplier convertImportParamToEntity(CreditSupplierImportParam param) { - CreditSupplier entity = new CreditSupplier(); - - entity.setSupplier(param.getSupplier()); - entity.setStatusTxt(param.getStatusTxt()); - entity.setPurchaseAmount(param.getPurchaseAmount()); - entity.setPublicDate(param.getPublicDate()); - entity.setDataSource(param.getDataSource()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java deleted file mode 100644 index 10d94ee..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java +++ /dev/null @@ -1,422 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditSuspectedRelationship; -import com.gxwebsoft.credit.param.CreditSuspectedRelationshipImportParam; -import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditSuspectedRelationshipService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 疑似关系控制器 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Tag(name = "疑似关系管理") -@RestController -@RequestMapping("/api/credit/credit-suspected-relationship") -public class CreditSuspectedRelationshipController extends BaseController { - @Resource - private CreditSuspectedRelationshipService creditSuspectedRelationshipService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询疑似关系") - @GetMapping("/page") - public ApiResult> page(CreditSuspectedRelationshipParam param) { - // 使用关联查询 - return success(creditSuspectedRelationshipService.pageRel(param)); - } - - @Operation(summary = "查询全部疑似关系") - @GetMapping() - public ApiResult> list(CreditSuspectedRelationshipParam param) { - // 使用关联查询 - return success(creditSuspectedRelationshipService.listRel(param)); - } - - @Operation(summary = "根据id查询疑似关系") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditSuspectedRelationshipService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:save')") - @OperationLog - @Operation(summary = "添加疑似关系") - @PostMapping() - public ApiResult save(@RequestBody CreditSuspectedRelationship creditSuspectedRelationship) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditSuspectedRelationship.setUserId(loginUser.getUserId()); - // } - if (creditSuspectedRelationshipService.save(creditSuspectedRelationship)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:update')") - @OperationLog - @Operation(summary = "修改疑似关系") - @PutMapping() - public ApiResult update(@RequestBody CreditSuspectedRelationship creditSuspectedRelationship) { - if (creditSuspectedRelationshipService.updateById(creditSuspectedRelationship)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:remove')") - @OperationLog - @Operation(summary = "删除疑似关系") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditSuspectedRelationship.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:save')") - @OperationLog - @Operation(summary = "批量添加疑似关系") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditSuspectedRelationshipService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:update')") - @OperationLog - @Operation(summary = "批量修改疑似关系") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditSuspectedRelationshipService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:remove')") - @OperationLog - @Operation(summary = "批量删除疑似关系") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditSuspectedRelationship.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditSuspectedRelationshipService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditSuspectedRelationship::getId, - CreditSuspectedRelationship::setId, - CreditSuspectedRelationship::getName, - CreditSuspectedRelationship::getCompanyId, - CreditSuspectedRelationship::setCompanyId, - CreditSuspectedRelationship::setCompanyName, - CreditSuspectedRelationship::getHasData, - CreditSuspectedRelationship::setHasData, - CreditSuspectedRelationship::getTenantId, - CreditSuspectedRelationship::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入疑似关系 - */ - @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:save')") - @Operation(summary = "批量导入疑似关系") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( - file, CreditSuspectedRelationshipImportParam.class, this::isEmptyImportRow); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称"); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditSuspectedRelationshipImportParam param = list.get(i); - try { - CreditSuspectedRelationship item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getName())) { - String link = urlByName.get(item.getName().trim()); - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getName())) { - errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空"); - continue; - } - if (ImportHelper.isBlank(item.getRelatedParty())) { - errorMessages.add("第" + excelRowNumber + "行:关联方不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditSuspectedRelationshipService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - it -> { - if (it == null) { - return null; - } - String n = it.getName(); - String r = it.getRelatedParty(); - if (n != null) { - n = n.trim(); - } - if (r != null) { - r = r.trim(); - } - if (n != null && !n.isEmpty() && r != null && !r.isEmpty()) { - return n + "->" + r; - } - return n; - }, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditSuspectedRelationshipService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - it -> { - if (it == null) { - return null; - } - String n = it.getName(); - String r = it.getRelatedParty(); - if (n != null) { - n = n.trim(); - } - if (r != null) { - r = r.trim(); - } - if (n != null && !n.isEmpty() && r != null && !r.isEmpty()) { - return n + "->" + r; - } - return n; - }, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.SUSPECTED_RELATIONSHIP, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载疑似关系导入模板 - */ - @Operation(summary = "下载疑似关系导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditSuspectedRelationshipImportParam example = new CreditSuspectedRelationshipImportParam(); - example.setName("示例科技有限公司"); - example.setStatusText("存续"); - example.setLegalPerson("李四"); - example.setRegisteredCapital("1000万人民币"); - example.setCreateDate("2018-06-01"); - example.setRelatedParty("关联方示例"); - example.setType("股权关联"); - example.setDetail("疑似关系详情示例"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("疑似关系导入模板", "疑似关系", CreditSuspectedRelationshipImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_suspected_relationship_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditSuspectedRelationshipImportParam param) { - if (param == null) { - return true; - } - if (isImportHeaderRow(param)) { - return true; - } - return ImportHelper.isBlank(param.getName()) - && ImportHelper.isBlank(param.getRelatedParty()) - && ImportHelper.isBlank(param.getType()); - } - - private boolean isImportHeaderRow(CreditSuspectedRelationshipImportParam param) { - return isHeaderValue(param.getName(), "企业名称") - || isHeaderValue(param.getRelatedParty(), "关联方") - || isHeaderValue(param.getType(), "疑似关系类型"); - } - - private static boolean isHeaderValue(String value, String headerText) { - if (value == null) { - return false; - } - return headerText.equals(value.trim()); - } - - private CreditSuspectedRelationship convertImportParamToEntity(CreditSuspectedRelationshipImportParam param) { - CreditSuspectedRelationship entity = new CreditSuspectedRelationship(); - - entity.setName(param.getName()); - entity.setStatusText(param.getStatusText()); - entity.setLegalPerson(param.getLegalPerson()); - entity.setRegisteredCapital(param.getRegisteredCapital()); - entity.setCreateDate(param.getCreateDate()); - entity.setRelatedParty(param.getRelatedParty()); - entity.setType(param.getType()); - entity.setDetail(param.getDetail()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java deleted file mode 100644 index cef616e..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java +++ /dev/null @@ -1,453 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.entity.ExportParams; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.entity.CreditUser; -import com.gxwebsoft.credit.param.CreditUserImportParam; -import com.gxwebsoft.credit.param.CreditUserParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditUserService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.InputStream; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 招投标信息表控制器 - * - * @author 科技小王子 - * @since 2025-12-15 13:16:04 - */ -@Tag(name = "招投标信息表管理") -@RestController -@RequestMapping("/api/credit/credit-user") -public class CreditUserController extends BaseController { - private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - - @Resource - private CreditUserService creditUserService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询招投标信息表") - @GetMapping("/page") - public ApiResult> page(CreditUserParam param) { - // 使用关联查询 - return success(creditUserService.pageRel(param)); - } - - @Operation(summary = "查询全部招投标信息表") - @GetMapping() - public ApiResult> list(CreditUserParam param) { - // 使用关联查询 - return success(creditUserService.listRel(param)); - } - - @Operation(summary = "根据id查询招投标信息表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditUserService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditUser:save')") - @OperationLog - @Operation(summary = "添加招投标信息表") - @PostMapping() - public ApiResult save(@RequestBody CreditUser creditUser) { - if (creditUserService.save(creditUser)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditUser:update')") - @OperationLog - @Operation(summary = "修改招投标信息表") - @PutMapping() - public ApiResult update(@RequestBody CreditUser creditUser) { - if (creditUserService.updateById(creditUser)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditUser:remove')") - @OperationLog - @Operation(summary = "删除招投标信息表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditUser.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditUser:save')") - @OperationLog - @Operation(summary = "批量添加招投标信息表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditUserService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditUser:update')") - @OperationLog - @Operation(summary = "批量修改招投标信息表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditUserService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditUser:remove')") - @OperationLog - @Operation(summary = "批量删除招投标信息表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditUser.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditUser:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( - creditUserService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditUser::getId, - CreditUser::setId, - CreditUser::getWinningName, - CreditUser::getCompanyId, - CreditUser::setCompanyId, - CreditUser::setCompanyName, - CreditUser::getHasData, - CreditUser::setHasData, - CreditUser::getTenantId, - CreditUser::new - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入招投标信息 - * Excel表头格式:客户名称、唯一标识、类型、企业角色、上级ID、信息类型、所在国家、所在省份、所在城市、所在辖区、街道地址、招采单位名称、中标单位名称、中标金额、备注、是否推荐、到期时间、排序、状态、用户ID、租户ID - */ - @PreAuthorize("hasAuthority('credit:creditUser:save')") - @Operation(summary = "批量导入招投标信息") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "招投标", 0); - ExcelImportSupport.ImportResult importResult = - ExcelImportSupport.read(file, CreditUserImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlMap = readNameHyperlinks(file, sheetIndex, usedTitleRows, usedHeadRows); - String fixedCompanyName = null; - if (companyId != null && companyId > 0) { - CreditCompany fixedCompany = creditCompanyService.getById(companyId); - fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; - } - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditUserImportParam param = list.get(i); - try { - CreditUser item = convertImportParamToEntity(param); - - String link = urlMap.get(i); - if (link != null && !link.isEmpty()) { - item.setUrl(link); - } - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { - item.setCompanyName(fixedCompanyName); - } - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - // 设置默认值 - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getType() == null) { - item.setType(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - // 验证必填字段 - if (item.getName() == null || item.getName().trim().isEmpty()) { - errorMessages.add("第" + excelRowNumber + "行:项目名称不能为空"); - continue; - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditUserService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditUser::getName, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditUserService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditUser::getName, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.USER, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载招投标信息导入模板 - */ - @Operation(summary = "下载招投标信息导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditUserImportParam example = new CreditUserImportParam(); - example.setCode("CUS001"); - example.setName("示例客户"); - example.setReleaseDate("2023-01-01"); - example.setType(0); - example.setRole("采购方"); - example.setInfoType("企业"); - example.setAddress("广东省-广州市-南沙区"); - example.setProcurementName("示例招采单位"); - example.setWinningName("示例中标单位"); - example.setWinningPrice("100000"); - templateList.add(example); - - ExportParams exportParams = new ExportParams("招投标信息导入模板", "招投标信息"); - - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, CreditUserImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_user_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - /** - * 读取“项目名称”列的超链接,按数据行顺序返回。 - */ - private Map readNameHyperlinks(MultipartFile file, int sheetIndex, int titleRows, int headRows) throws Exception { - Map result = new HashMap<>(); - try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { - Sheet sheet = workbook.getSheetAt(sheetIndex); - if (sheet == null) { - return result; - } - int headerRowNum = titleRows + headRows - 1; - Row headerRow = sheet.getRow(headerRowNum); - int nameColIndex = 0; - if (headerRow != null) { - for (int c = headerRow.getFirstCellNum(); c < headerRow.getLastCellNum(); c++) { - Cell cell = headerRow.getCell(c); - if (cell != null && "项目名称".equals(normalizeHeaderText(cell.getStringCellValue()))) { - nameColIndex = c; - break; - } - } - } - int dataStartRow = titleRows + headRows; - for (int r = dataStartRow; r <= sheet.getLastRowNum(); r++) { - Row row = sheet.getRow(r); - if (row == null) { - continue; - } - Cell cell = row.getCell(nameColIndex); - if (cell != null && cell.getHyperlink() != null) { - String address = cell.getHyperlink().getAddress(); - if (address != null && !address.isEmpty()) { - result.put(r - dataStartRow, address); - } - } - } - } - return result; - } - - /** - * 用于表头匹配:仅做最常见的空白字符规整(避免表头中存在换行/空格导致无法定位列)。 - */ - private static String normalizeHeaderText(String text) { - if (text == null) { - return ""; - } - return text - .replace(" ", "") - .replace("\t", "") - .replace("\r", "") - .replace("\n", "") - .replace("\u00A0", "") - .replace(" ", "") - .trim(); - } - - private boolean isEmptyImportRow(CreditUserImportParam param) { - if (param == null) { - return true; - } - return isBlank(param.getName()) - && isBlank(param.getCode()) - && isBlank(param.getRole()) - && isBlank(param.getInfoType()) - && isBlank(param.getAddress()) - && isBlank(param.getProcurementName()) - && isBlank(param.getWinningName()) - && isBlank(param.getWinningPrice()); - } - - private boolean isBlank(String value) { - return value == null || value.trim().isEmpty(); - } - - /** - * 将CreditUserImportParam转换为CreditUser实体 - */ - private CreditUser convertImportParamToEntity(CreditUserImportParam param) { - CreditUser entity = new CreditUser(); - - entity.setCode(param.getCode()); - entity.setName(param.getName()); - entity.setReleaseDate(param.getReleaseDate()); - entity.setType(param.getType()); - entity.setRole(param.getRole()); - entity.setInfoType(param.getInfoType()); - entity.setAddress(param.getAddress()); - entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); - entity.setProcurementName(param.getProcurementName()); - entity.setWinningName(param.getWinningName()); - entity.setWinningPrice(param.getWinningPrice()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java deleted file mode 100644 index c988d55..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java +++ /dev/null @@ -1,510 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.credit.entity.CreditXgxf; -import com.gxwebsoft.credit.param.CreditXgxfImportParam; -import com.gxwebsoft.credit.param.CreditXgxfParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; -import com.gxwebsoft.credit.service.CreditXgxfService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 限制高消费控制器 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:55 - */ -@Tag(name = "限制高消费管理") -@RestController -@RequestMapping("/api/credit/credit-xgxf") -public class CreditXgxfController extends BaseController { - @Resource - private CreditXgxfService creditXgxfService; - - @Resource - private BatchImportSupport batchImportSupport; - - @Resource - private CreditCompanyService creditCompanyService; - - @Resource - private CreditCompanyRecordCountService creditCompanyRecordCountService; - - @Operation(summary = "分页查询限制高消费") - @GetMapping("/page") - public ApiResult> page(CreditXgxfParam param) { - // 使用关联查询 - return success(creditXgxfService.pageRel(param)); - } - - @Operation(summary = "查询全部限制高消费") - @GetMapping() - public ApiResult> list(CreditXgxfParam param) { - // 使用关联查询 - return success(creditXgxfService.listRel(param)); - } - - @Operation(summary = "根据id查询限制高消费") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(creditXgxfService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('credit:creditXgxf:save')") - @OperationLog - @Operation(summary = "添加限制高消费") - @PostMapping() - public ApiResult save(@RequestBody CreditXgxf creditXgxf) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // creditXgxf.setUserId(loginUser.getUserId()); - // } - if (creditXgxfService.save(creditXgxf)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditXgxf:update')") - @OperationLog - @Operation(summary = "修改限制高消费") - @PutMapping() - public ApiResult update(@RequestBody CreditXgxf creditXgxf) { - if (creditXgxfService.updateById(creditXgxf)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditXgxf:remove')") - @OperationLog - @Operation(summary = "删除限制高消费") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (batchImportSupport.hardRemoveById(CreditXgxf.class, id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('credit:creditXgxf:save')") - @OperationLog - @Operation(summary = "批量添加限制高消费") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (creditXgxfService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('credit:creditXgxf:update')") - @OperationLog - @Operation(summary = "批量修改限制高消费") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(creditXgxfService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('credit:creditXgxf:remove')") - @OperationLog - @Operation(summary = "批量删除限制高消费") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (batchImportSupport.hardRemoveByIds(CreditXgxf.class, ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) - * - *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

- */ - @PreAuthorize("hasAuthority('credit:creditXgxf:update')") - @OperationLog - @Operation(summary = "根据企业名称匹配并更新companyId") - @PostMapping("/company-id/refresh") - public ApiResult> refreshCompanyIdByCompanyName( - @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, - @RequestParam(value = "limit", required = false) Integer limit - ) { - User loginUser = getLoginUser(); - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - - // Party columns may contain multiple roles/names; match if any company name is contained in the text. - // Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人 - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText( - creditXgxfService, - creditCompanyService, - currentTenantId, - onlyNull, - limit, - CreditXgxf::getId, - CreditXgxf::setId, - CreditXgxf::getCompanyId, - CreditXgxf::setCompanyId, - CreditXgxf::getHasData, - CreditXgxf::setHasData, - CreditXgxf::getTenantId, - CreditXgxf::new, - CreditXgxf::getPlaintiffAppellant, - CreditXgxf::getAppellee, - CreditXgxf::getOtherPartiesThirdParty - ); - - if (!stats.anyDataRead) { - return success("无可更新数据", stats.toMap()); - } - return success("更新完成,更新" + stats.updated + "条", stats.toMap()); - } - - /** - * 批量导入限制高消费司法大数据 - */ - @PreAuthorize("hasAuthority('credit:creditXgxf:save')") - @Operation(summary = "批量导入限制高消费司法大数据") - @PostMapping("/import") - public ApiResult> importBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "限制高消费", 0); - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditXgxfImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - // easypoi 默认不会读取单元格超链接地址;url 可能挂在“案号”等列的超链接中,或单独提供 url/网址/链接 列。 - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditXgxfImportParam param = list.get(i); - try { - CreditXgxf item = convertImportParamToEntity(param); - if (!ImportHelper.isBlank(item.getCaseNumber())) { - String link = urlByCaseNumber.get(item.getCaseNumber().trim()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditXgxfService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditXgxf::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditXgxfService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditXgxf::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.XGXF, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 批量导入历史限制高消费(仅解析“历史限制高消费”选项卡) - * 规则:使用数据库唯一索引约束,重复数据不导入。 - */ - @PreAuthorize("hasAuthority('credit:creditXgxf:save')") - @Operation(summary = "批量导入历史限制高消费司法大数据") - @PostMapping("/import/history") - public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, - @RequestParam(value = "companyId", required = false) Integer companyId) { - List errorMessages = new ArrayList<>(); - int successCount = 0; - Set touchedCompanyIds = new HashSet<>(); - - try { - int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史限制高消费"); - if (sheetIndex < 0) { - return fail("未读取到数据,请确认文件中存在“历史限制高消费”选项卡且表头与示例格式一致", null); - } - - ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( - file, CreditXgxfImportParam.class, this::isEmptyImportRow, sheetIndex); - List list = importResult.getData(); - int usedTitleRows = importResult.getTitleRows(); - int usedHeadRows = importResult.getHeadRows(); - int usedSheetIndex = importResult.getSheetIndex(); - - if (CollectionUtils.isEmpty(list)) { - return fail("未读取到数据,请确认模板表头与示例格式一致", null); - } - - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); - - final int chunkSize = 500; - final int mpBatchSize = 500; - List chunkItems = new ArrayList<>(chunkSize); - List chunkRowNumbers = new ArrayList<>(chunkSize); - - for (int i = 0; i < list.size(); i++) { - CreditXgxfImportParam param = list.get(i); - int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; - try { - CreditXgxf item = convertImportParamToEntity(param); - if (item.getCaseNumber() != null) { - item.setCaseNumber(item.getCaseNumber().trim()); - } - if (ImportHelper.isBlank(item.getCaseNumber())) { - errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); - continue; - } - - String link = urlByCaseNumber.get(item.getCaseNumber()); - if (!ImportHelper.isBlank(link)) { - item.setUrl(link.trim()); - } - - if (item.getCompanyId() == null && companyId != null) { - item.setCompanyId(companyId); - } - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getTenantId() == null && currentTenantId != null) { - item.setTenantId(currentTenantId); - } - if (item.getStatus() == null) { - item.setStatus(0); - } - if (item.getDeleted() == null) { - item.setDeleted(0); - } - // 历史导入的数据统一标记为“失效” - item.setDataStatus("失效"); - - if (item.getRecommend() == null) { - item.setRecommend(0); - } - if (item.getCompanyId() != null && item.getCompanyId() > 0) { - touchedCompanyIds.add(item.getCompanyId()); - } - - chunkItems.add(item); - chunkRowNumbers.add(excelRowNumber); - if (chunkItems.size() >= chunkSize) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditXgxfService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditXgxf::getCaseNumber, - "", - errorMessages - ); - chunkItems.clear(); - chunkRowNumbers.clear(); - } - } catch (Exception e) { - errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); - e.printStackTrace(); - } - } - - if (!chunkItems.isEmpty()) { - successCount += batchImportSupport.persistInsertOnlyChunk( - creditXgxfService, - chunkItems, - chunkRowNumbers, - mpBatchSize, - CreditXgxf::getCaseNumber, - "", - errorMessages - ); - } - - creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.XGXF, touchedCompanyIds); - - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } catch (Exception e) { - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载限制高消费导入模板 - */ - @Operation(summary = "下载限制高消费导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - List templateList = new ArrayList<>(); - - CreditXgxfImportParam example = new CreditXgxfImportParam(); - example.setDataType("限制高消费"); - example.setPlaintiffAppellant("原告示例"); - example.setAppellee("被告示例"); - example.setOccurrenceTime("2024-01-01"); - example.setCaseNumber("(2024)示例案号"); - example.setInvolvedAmount("100000"); - example.setCourtName("示例法院"); - example.setComments("备注信息"); - templateList.add(example); - - Workbook workbook = ExcelImportSupport.buildTemplate("限制高消费导入模板", "限制高消费", CreditXgxfImportParam.class, templateList); - - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=credit_xgxf_import_template.xlsx"); - - workbook.write(response.getOutputStream()); - workbook.close(); - } - - private boolean isEmptyImportRow(CreditXgxfImportParam param) { - if (param == null) { - return true; - } - return ImportHelper.isBlank(param.getCaseNumber()); - } - - private CreditXgxf convertImportParamToEntity(CreditXgxfImportParam param) { - CreditXgxf entity = new CreditXgxf(); - - // Template compatibility: some upstream multi-company exports use alternate headers for the same columns. - String plaintiffAppellant = !ImportHelper.isBlank(param.getPlaintiffAppellant()) - ? param.getPlaintiffAppellant() - : param.getPlaintiffAppellant2(); - String appellee = !ImportHelper.isBlank(param.getAppellee()) - ? param.getAppellee() - : param.getDataType(); - String courtName = !ImportHelper.isBlank(param.getCourtName()) - ? param.getCourtName() - : param.getCourtName2(); - - - entity.setCaseNumber(param.getCaseNumber()); - entity.setType(param.getType()); - entity.setDataType(param.getDataType()); - entity.setPlaintiffAppellant(plaintiffAppellant); - entity.setAppellee(appellee); - entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty()); - entity.setDataStatus(param.getDataStatus()); - - entity.setInvolvedAmount(param.getInvolvedAmount()); - entity.setOccurrenceTime(param.getOccurrenceTime()); - entity.setCourtName(courtName); - entity.setReleaseDate(param.getReleaseDate()); - entity.setComments(param.getComments()); - - return entity; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/ExcelImportSupport.java b/src/main/java/com/gxwebsoft/credit/controller/ExcelImportSupport.java deleted file mode 100644 index 9e5711e..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/ExcelImportSupport.java +++ /dev/null @@ -1,719 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.ExcelImportUtil; -import cn.afterturn.easypoi.excel.annotation.Excel; -import cn.afterturn.easypoi.excel.entity.ExportParams; -import cn.afterturn.easypoi.excel.entity.ImportParams; -import com.gxwebsoft.credit.excel.ExcelHeaderAlias; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellType; -import org.apache.poi.ss.usermodel.DataFormatter; -import org.apache.poi.ss.usermodel.Hyperlink; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; -import org.springframework.util.CollectionUtils; -import org.springframework.web.multipart.MultipartFile; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.lang.reflect.Field; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Predicate; - -/** - * Excel 导入导出通用支持 - */ -public class ExcelImportSupport { - - public static class ImportResult { - private final List data; - private final int titleRows; - private final int headRows; - private final int sheetIndex; - - public ImportResult(List data, int titleRows, int headRows) { - this(data, titleRows, headRows, 0); - } - - public ImportResult(List data, int titleRows, int headRows, int sheetIndex) { - this.data = data; - this.titleRows = titleRows; - this.headRows = headRows; - this.sheetIndex = sheetIndex; - } - - public List getData() { - return data; - } - - public int getTitleRows() { - return titleRows; - } - - public int getHeadRows() { - return headRows; - } - - public int getSheetIndex() { - return sheetIndex; - } - } - - public static ImportResult read(MultipartFile file, Class clazz, Predicate emptyRowPredicate) throws Exception { - return read(file, clazz, emptyRowPredicate, 0); - } - - /** - * 自动尝试所有 sheet(从第 0 个开始),直到读取到非空数据。 - */ - public static ImportResult readAnySheet(MultipartFile file, Class clazz, Predicate emptyRowPredicate) throws Exception { - ImportResult result = read(file, clazz, emptyRowPredicate, 0); - if (!CollectionUtils.isEmpty(result.getData())) { - return result; - } - - int sheetCount = getSheetCount(file); - for (int i = 1; i < sheetCount; i++) { - ImportResult sheetResult = read(file, clazz, emptyRowPredicate, i); - if (!CollectionUtils.isEmpty(sheetResult.getData())) { - return sheetResult; - } - } - return result; - } - - /** - * 自动尝试所有 sheet(从第 0 个开始),并在每个 sheet 内选择“得分”最高的表头配置。 - */ - public static ImportResult readAnySheetBest(MultipartFile file, Class clazz, Predicate emptyRowPredicate, Predicate scoreRowPredicate) throws Exception { - ImportResult result = readBest(file, clazz, emptyRowPredicate, scoreRowPredicate, 0); - if (!CollectionUtils.isEmpty(result.getData())) { - return result; - } - - int sheetCount = getSheetCount(file); - for (int i = 1; i < sheetCount; i++) { - ImportResult sheetResult = readBest(file, clazz, emptyRowPredicate, scoreRowPredicate, i); - if (!CollectionUtils.isEmpty(sheetResult.getData())) { - return sheetResult; - } - } - return result; - } - - /** - * 读取指定 sheet 的 Excel。 - * - * @param sheetIndex 目标 sheet 下标,从 0 开始。第二个选项卡传 1。 - */ - public static ImportResult read(MultipartFile file, Class clazz, Predicate emptyRowPredicate, int sheetIndex) throws Exception { - List list = null; - int usedTitleRows = 0; - int usedHeadRows = 0; - int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {2, 1}, {3, 1}, {0, 2}, {0, 3}, {0, 4}}; - Exception lastFailure = null; - boolean anyImported = false; - - for (int[] config : tryConfigs) { - try { - list = filterEmptyRows(importSheet(file, clazz, config[0], config[1], sheetIndex), emptyRowPredicate); - anyImported = true; - } catch (Exception e) { - // Some source files can trigger easypoi/POI runtime exceptions for certain title/head row combinations. - // Keep trying other configurations instead of failing the whole import. - lastFailure = e; - continue; - } - if (!CollectionUtils.isEmpty(list)) { - usedTitleRows = config[0]; - usedHeadRows = config[1]; - break; - } - } - - // Fallback for upstream files with extra banner/title rows or wider multi-row headers. - // Keep the default fast path above for common templates. - if (CollectionUtils.isEmpty(list)) { - final int maxTitleRows = 10; - final int maxHeadRows = 6; - outer: - for (int titleRows = 0; titleRows <= maxTitleRows; titleRows++) { - for (int headRows = 1; headRows <= maxHeadRows; headRows++) { - try { - list = filterEmptyRows(importSheet(file, clazz, titleRows, headRows, sheetIndex), emptyRowPredicate); - anyImported = true; - } catch (Exception e) { - lastFailure = e; - continue; - } - if (!CollectionUtils.isEmpty(list)) { - usedTitleRows = titleRows; - usedHeadRows = headRows; - break outer; - } - } - } - } - if (list == null) { - if (!anyImported && lastFailure != null) { - throw lastFailure; - } - list = Collections.emptyList(); - } - return new ImportResult<>(list, usedTitleRows, usedHeadRows, sheetIndex); - } - - /** - * 读取指定 sheet 的 Excel,并从多组表头配置中挑选“得分”最高的结果。 - */ - public static ImportResult readBest(MultipartFile file, Class clazz, Predicate emptyRowPredicate, Predicate scoreRowPredicate, int sheetIndex) throws Exception { - List bestList = null; - int bestTitleRows = 0; - int bestHeadRows = 0; - int bestScore = -1; - int bestSize = -1; - Exception lastFailure = null; - boolean anyImported = false; - - int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {2, 1}, {3, 1}, {0, 2}, {0, 3}, {0, 4}, {1, 2}, {1, 3}, {1, 4}, {2, 2}, {2, 3}, {2, 4}, {3, 2}, {3, 3}, {3, 4}}; - - for (int[] config : tryConfigs) { - List list; - try { - list = filterEmptyRows(importSheet(file, clazz, config[0], config[1], sheetIndex), emptyRowPredicate); - anyImported = true; - } catch (Exception e) { - lastFailure = e; - continue; - } - if (CollectionUtils.isEmpty(list)) { - continue; - } - - int score = 0; - if (scoreRowPredicate != null) { - for (T row : list) { - if (scoreRowPredicate.test(row)) { - score++; - } - } - } - - int size = list.size(); - if (score > bestScore || (score == bestScore && size > bestSize)) { - bestList = list; - bestTitleRows = config[0]; - bestHeadRows = config[1]; - bestScore = score; - bestSize = size; - } - } - - // Fallback scan: broaden the search space for messy source files (extra title rows, multi-row headers). - if (bestList == null) { - final int maxTitleRows = 10; - final int maxHeadRows = 6; - for (int titleRows = 0; titleRows <= maxTitleRows; titleRows++) { - for (int headRows = 1; headRows <= maxHeadRows; headRows++) { - List list; - try { - list = filterEmptyRows(importSheet(file, clazz, titleRows, headRows, sheetIndex), emptyRowPredicate); - anyImported = true; - } catch (Exception e) { - lastFailure = e; - continue; - } - if (CollectionUtils.isEmpty(list)) { - continue; - } - - int score = 0; - if (scoreRowPredicate != null) { - for (T row : list) { - if (scoreRowPredicate.test(row)) { - score++; - } - } - } - - int size = list.size(); - if (score > bestScore || (score == bestScore && size > bestSize)) { - bestList = list; - bestTitleRows = titleRows; - bestHeadRows = headRows; - bestScore = score; - bestSize = size; - } - } - } - } - - if (bestList != null) { - return new ImportResult<>(bestList, bestTitleRows, bestHeadRows, sheetIndex); - } - - if (!anyImported && lastFailure != null) { - throw lastFailure; - } - return read(file, clazz, emptyRowPredicate, sheetIndex); - } - - private static List importSheet(MultipartFile file, Class clazz, int titleRows, int headRows, int sheetIndex) throws Exception { - ImportParams importParams = new ImportParams(); - importParams.setTitleRows(titleRows); - importParams.setHeadRows(headRows); - importParams.setStartSheetIndex(sheetIndex); - importParams.setSheetNum(1); - - // Easypoi matches headers by exact string. Some upstream files contain extra spaces/tabs/newlines in header cells - // (e.g. "原告 / 上诉人" or "原告/上诉人\t"), which makes specific columns silently not mapped. - // Normalize header cells first to make imports robust. - try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { - if (workbook.getNumberOfSheets() > sheetIndex) { - Sheet sheet = workbook.getSheetAt(sheetIndex); - if (sheet != null) { - normalizeHeaderCells(sheet, titleRows, headRows, clazz); - } - } - try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { - workbook.write(bos); - try (ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray())) { - return ExcelImportUtil.importExcel(bis, clazz, importParams); - } - } - } - } - - private static void normalizeHeaderCells(Sheet sheet, int titleRows, int headRows, Class clazz) { - if (sheet == null || headRows <= 0) { - return; - } - Map expectedHeadersByKey = buildExpectedHeaderKeyMap(clazz); - if (expectedHeadersByKey.isEmpty()) { - return; - } - int headerStart = Math.max(titleRows, 0); - int headerEnd = headerStart + headRows - 1; - for (int r = headerStart; r <= headerEnd; r++) { - Row row = sheet.getRow(r); - if (row == null) { - continue; - } - short last = row.getLastCellNum(); - for (int c = 0; c < last; c++) { - Cell cell = row.getCell(c); - if (cell == null) { - continue; - } - - String text = null; - CellType type = cell.getCellType(); - if (type == CellType.STRING) { - text = cell.getStringCellValue(); - } else if (type == CellType.FORMULA && cell.getCachedFormulaResultType() == CellType.STRING) { - text = cell.getStringCellValue(); - } else { - continue; - } - - String canonical = findCanonicalHeader(text, expectedHeadersByKey); - if (canonical != null && !canonical.equals(text)) { - cell.setCellValue(canonical); - } - } - } - } - - private static Map buildExpectedHeaderKeyMap(Class clazz) { - if (clazz == null) { - return Collections.emptyMap(); - } - Map map = new HashMap<>(); - Class current = clazz; - while (current != null && current != Object.class) { - Field[] fields = current.getDeclaredFields(); - for (Field field : fields) { - Excel excel = field.getAnnotation(Excel.class); - if (excel == null) { - continue; - } - String name = excel.name(); - if (name == null || name.trim().isEmpty()) { - continue; - } - String key = normalizeHeaderKey(name); - if (!key.isEmpty()) { - // key -> canonical annotation name - map.putIfAbsent(key, name); - } - - // Allow import-time header aliases without changing the exported template header. - ExcelHeaderAlias alias = field.getAnnotation(ExcelHeaderAlias.class); - if (alias != null && alias.value() != null) { - for (String aliasName : alias.value()) { - if (aliasName == null || aliasName.trim().isEmpty()) { - continue; - } - String aliasKey = normalizeHeaderKey(aliasName); - if (!aliasKey.isEmpty()) { - map.putIfAbsent(aliasKey, name); - } - } - } - } - current = current.getSuperclass(); - } - return map; - } - - private static String findCanonicalHeader(String rawHeaderText, Map expectedHeadersByKey) { - if (rawHeaderText == null) { - return null; - } - String key = normalizeHeaderKey(rawHeaderText); - if (key.isEmpty()) { - return null; - } - - String canonical = expectedHeadersByKey.get(key); - if (canonical != null) { - return canonical; - } - - // Some upstream templates append explanations in brackets, e.g. "原告/上诉人(申请执行人)". - // Only strip trailing bracket groups when the full header doesn't match any known expected header. - String strippedKey = stripTrailingBracketSuffix(key); - if (!strippedKey.equals(key)) { - canonical = expectedHeadersByKey.get(strippedKey); - if (canonical != null) { - return canonical; - } - } - - return null; - } - - /** - * Normalize header text for matching purposes only. - * - *

Do NOT drop bracket content (e.g. keep "(元)" or "(公告)" in the middle), because many templates use them as - * part of the canonical header name. We only remove whitespace and unify common full-width punctuation.

- */ - private static String normalizeHeaderKey(String text) { - if (text == null) { - return ""; - } - String normalized = text - // unify common full-width punctuation - .replace("/", "/") - .replace("【", "[") - .replace("】", "]") - // remove common invisible whitespace characters, including full-width space. - .replace(" ", "") - .replace("\t", "") - .replace("\r", "") - .replace("\n", "") - .replace("\u00A0", "") - .replace(" ", "") - .trim(); - - // Make ( ) and ( ) comparable by normalizing both to ASCII. - normalized = normalized.replace('(', '(').replace(')', ')'); - return normalized; - } - - private static String stripTrailingBracketSuffix(String text) { - if (text == null) { - return ""; - } - String s = text.trim(); - while (true) { - if (s.endsWith(")")) { - int idx = s.lastIndexOf('('); - if (idx >= 0) { - s = s.substring(0, idx).trim(); - continue; - } - } - if (s.endsWith("]")) { - int idx = s.lastIndexOf('['); - if (idx >= 0) { - s = s.substring(0, idx).trim(); - continue; - } - } - return s; - } - } - - private static List filterEmptyRows(List rawList, Predicate emptyRowPredicate) { - if (CollectionUtils.isEmpty(rawList)) { - return rawList; - } - rawList.removeIf(emptyRowPredicate); - return rawList; - } - - private static int getSheetCount(MultipartFile file) throws Exception { - try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { - return workbook.getNumberOfSheets(); - } - } - - /** - * 根据 sheet 名称查找下标(优先精确匹配,其次前缀匹配/包含匹配)。 - * - * @return 找不到返回 -1 - */ - public static int findSheetIndex(MultipartFile file, String sheetName) throws Exception { - if (file == null || sheetName == null || sheetName.trim().isEmpty()) { - return -1; - } - String target = normalizeSheetName(sheetName); - if (target.isEmpty()) { - return -1; - } - - try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { - int sheetCount = workbook.getNumberOfSheets(); - for (int i = 0; i < sheetCount; i++) { - String candidate = normalizeSheetName(workbook.getSheetName(i)); - if (Objects.equals(candidate, target)) { - return i; - } - } - for (int i = 0; i < sheetCount; i++) { - String candidate = normalizeSheetName(workbook.getSheetName(i)); - if (candidate.startsWith(target) || candidate.contains(target) || target.startsWith(candidate)) { - return i; - } - } - return -1; - } - } - - public static int findSheetIndex(MultipartFile file, String sheetName, int defaultIndex) throws Exception { - int idx = findSheetIndex(file, sheetName); - return idx >= 0 ? idx : defaultIndex; - } - - private static String normalizeSheetName(String sheetName) { - if (sheetName == null) { - return ""; - } - return sheetName.replace(" ", "").replace(" ", "").trim(); - } - - /** - * 读取指定列(由表头名定位)的超链接,返回:单元格显示值 -> 超链接地址。 - * - *

适用于:导入对象没有 url 字段,但 Excel 把链接放在某个“名称/案号”等列的超链接里。

- */ - public static Map readHyperlinksByHeaderKey(MultipartFile file, int sheetIndex, int titleRows, int headRows, String headerName) throws Exception { - if (file == null || headerName == null || headerName.trim().isEmpty()) { - return Collections.emptyMap(); - } - - try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { - if (workbook.getNumberOfSheets() <= sheetIndex) { - return Collections.emptyMap(); - } - Sheet sheet = workbook.getSheetAt(sheetIndex); - if (sheet == null) { - return Collections.emptyMap(); - } - - int colIndex = findColumnIndexByHeader(sheet, titleRows, headRows, headerName); - if (colIndex < 0) { - return Collections.emptyMap(); - } - - Map result = new HashMap<>(); - DataFormatter formatter = new DataFormatter(); - int dataStartRow = titleRows + headRows; - for (int r = dataStartRow; r <= sheet.getLastRowNum(); r++) { - Row row = sheet.getRow(r); - if (row == null) { - continue; - } - Cell cell = row.getCell(colIndex); - if (cell == null) { - continue; - } - String address = extractHyperlinkAddress(cell); - if (address == null || address.isEmpty()) { - continue; - } - String key = formatter.formatCellValue(cell); - if (key == null || key.trim().isEmpty()) { - continue; - } - result.put(key.trim(), address); - } - return result; - } - } - - /** - * 读取两列(由表头名定位)的文本/超链接,返回:key列显示值 -> value列(优先超链接地址,其次单元格文本)。 - * - *

适用于:Excel 把 url 放在单独一列(可能是纯文本,也可能是超链接)。

- */ - public static Map readKeyValueByHeaders(MultipartFile file, - int sheetIndex, - int titleRows, - int headRows, - String keyHeaderName, - String valueHeaderName) throws Exception { - if (file == null - || keyHeaderName == null || keyHeaderName.trim().isEmpty() - || valueHeaderName == null || valueHeaderName.trim().isEmpty()) { - return Collections.emptyMap(); - } - - try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { - if (workbook.getNumberOfSheets() <= sheetIndex) { - return Collections.emptyMap(); - } - Sheet sheet = workbook.getSheetAt(sheetIndex); - if (sheet == null) { - return Collections.emptyMap(); - } - - int keyCol = findColumnIndexByHeader(sheet, titleRows, headRows, keyHeaderName); - int valCol = findColumnIndexByHeader(sheet, titleRows, headRows, valueHeaderName); - if (keyCol < 0 || valCol < 0) { - return Collections.emptyMap(); - } - - Map result = new HashMap<>(); - DataFormatter formatter = new DataFormatter(); - int dataStartRow = titleRows + headRows; - for (int r = dataStartRow; r <= sheet.getLastRowNum(); r++) { - Row row = sheet.getRow(r); - if (row == null) { - continue; - } - Cell keyCell = row.getCell(keyCol); - if (keyCell == null) { - continue; - } - String key = formatter.formatCellValue(keyCell); - if (key == null || key.trim().isEmpty()) { - continue; - } - - Cell valCell = row.getCell(valCol); - if (valCell == null) { - continue; - } - String value = extractHyperlinkAddress(valCell); - if (value == null || value.trim().isEmpty()) { - value = formatter.formatCellValue(valCell); - } - if (value == null || value.trim().isEmpty()) { - continue; - } - result.put(key.trim(), value.trim()); - } - return result; - } - } - - /** - * 读取“key列 -> url”的映射: - * - 优先读取 key 列自身的超链接(url 常挂在名称/案号等列的超链接里) - * - 如果源文件提供独立的 url/URL/网址/链接/链接地址 等列,则读取该列(支持文本或超链接) - */ - public static Map readUrlByKey(MultipartFile file, - int sheetIndex, - int titleRows, - int headRows, - String keyHeaderName) throws Exception { - if (file == null || keyHeaderName == null || keyHeaderName.trim().isEmpty()) { - return Collections.emptyMap(); - } - - Map result = new HashMap<>(); - - // 1) url 挂在 key 列超链接里(最常见) - Map fromKeyHyperlinks = readHyperlinksByHeaderKey(file, sheetIndex, titleRows, headRows, keyHeaderName); - if (!fromKeyHyperlinks.isEmpty()) { - result.putAll(fromKeyHyperlinks); - } - - // 2) url 作为单独一列(多种表头命名) - String[] urlHeaders = new String[]{"url", "URL", "网址", "链接", "链接地址"}; - for (String urlHeader : urlHeaders) { - Map fromUrlCol = readKeyValueByHeaders(file, sheetIndex, titleRows, headRows, keyHeaderName, urlHeader); - if (fromUrlCol.isEmpty()) { - continue; - } - for (Map.Entry entry : fromUrlCol.entrySet()) { - // 不覆盖已从 key 超链接读取到的地址 - result.putIfAbsent(entry.getKey(), entry.getValue()); - } - } - return result; - } - - private static int findColumnIndexByHeader(Sheet sheet, int titleRows, int headRows, String headerName) { - String targetKey = normalizeHeaderKey(headerName); - if (targetKey.isEmpty()) { - return -1; - } - int firstHeaderRow = Math.max(0, titleRows); - int lastHeaderRow = Math.max(0, titleRows + headRows - 1); - for (int r = firstHeaderRow; r <= lastHeaderRow; r++) { - Row row = sheet.getRow(r); - if (row == null) { - continue; - } - for (int c = row.getFirstCellNum(); c < row.getLastCellNum(); c++) { - Cell cell = row.getCell(c); - if (cell == null) { - continue; - } - DataFormatter formatter = new DataFormatter(); - String value = formatter.formatCellValue(cell); - if (targetKey.equals(normalizeHeaderKey(value))) { - return c; - } - } - } - return -1; - } - - private static String extractHyperlinkAddress(Cell cell) { - Hyperlink hyperlink = cell.getHyperlink(); - if (hyperlink != null && hyperlink.getAddress() != null && !hyperlink.getAddress().isEmpty()) { - return hyperlink.getAddress(); - } - if (cell.getCellType() == CellType.FORMULA) { - String formula = cell.getCellFormula(); - if (formula != null && formula.toUpperCase().startsWith("HYPERLINK(")) { - int firstQuote = formula.indexOf('\"'); - if (firstQuote >= 0) { - int secondQuote = formula.indexOf('\"', firstQuote + 1); - if (secondQuote > firstQuote) { - return formula.substring(firstQuote + 1, secondQuote); - } - } - } - } - return null; - } - - public static Workbook buildTemplate(String title, String sheetName, Class clazz, List examples) { - ExportParams exportParams = new ExportParams(title, sheetName); - return ExcelExportUtil.exportExcel(exportParams, clazz, examples); - } -} diff --git a/src/main/java/com/gxwebsoft/credit/controller/ImportHelper.java b/src/main/java/com/gxwebsoft/credit/controller/ImportHelper.java deleted file mode 100644 index c3590be..0000000 --- a/src/main/java/com/gxwebsoft/credit/controller/ImportHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.gxwebsoft.credit.controller; - -import java.math.BigDecimal; -import java.time.LocalDate; - -/** - * 导入解析辅助工具 - */ -public final class ImportHelper { - - private ImportHelper() { - } - - public static boolean isBlank(String value) { - return value == null || value.trim().isEmpty(); - } - - public static BigDecimal parseBigDecimal(String value, String fieldLabel) { - if (isBlank(value)) { - return null; - } - try { - return new BigDecimal(value.trim()); - } catch (Exception e) { - throw new IllegalArgumentException(fieldLabel + "格式不正确"); - } - } - - public static LocalDate parseLocalDate(String value, String fieldLabel) { - if (isBlank(value)) { - return null; - } - try { - return LocalDate.parse(value.trim()); - } catch (Exception e) { - throw new IllegalArgumentException(fieldLabel + "日期格式应为yyyy-MM-dd"); - } - } -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java b/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java deleted file mode 100644 index 52f08b9..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 行政许可 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditAdministrativeLicense对象", description = "行政许可") -public class CreditAdministrativeLicense implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "决定文书/许可编号") - private String code; - - @Schema(description = "决定文书/许可证名称") - private String name; - - @Schema(description = "许可状态") - private String statusText; - - @Schema(description = "许可类别") - private String type; - - @Schema(description = "链接") - private String url; - - @Schema(description = "有效期自") - private String validityStart; - - @Schema(description = "有效期至") - private String validityEnd; - - @Schema(description = "许可机关") - private String licensingAuthority; - - @Schema(description = "许可内容") - @TableField("License_content") - private String licenseContent; - - @Schema(description = "数据来源单位") - private String dataSourceUnit; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "主体企业") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditBankruptcy.java b/src/main/java/com/gxwebsoft/credit/entity/CreditBankruptcy.java deleted file mode 100644 index 1b227a7..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditBankruptcy.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 破产重整 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditBankruptcy对象", description = "破产重整") -public class CreditBankruptcy implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "案号") - private String code; - - @Schema(description = "案件类型") - private String type; - - @Schema(description = "当事人") - private String party; - - @Schema(description = "链接") - private String url; - - @Schema(description = "经办法院") - private String court; - - @Schema(description = "公开日期") - private String publicDate; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "主体企业") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java b/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java deleted file mode 100644 index 215c678..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 分支机构 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditBranch对象", description = "分支机构") -public class CreditBranch implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "分支机构名称") - private String name; - - @Schema(description = "负责人") - private String curator; - - @Schema(description = "地区") - private String region; - - @Schema(description = "链接") - private String url; - - @Schema(description = "成立日期") - private String establishDate; - - @Schema(description = "状态") - private String statusText; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "主题企业") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditBreachOfTrust.java b/src/main/java/com/gxwebsoft/credit/entity/CreditBreachOfTrust.java deleted file mode 100644 index befe849..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditBreachOfTrust.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 失信被执行人 - * - * @author 科技小王子 - * @since 2025-12-19 19:46:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditBreachOfTrust对象", description = "失信被执行人") -public class CreditBreachOfTrust implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "失信被执行人") - private String plaintiffAppellant; - - @Schema(description = "疑似申请执行人") - private String appellee; - - @Schema(description = "涉案金额(元)") - private String involvedAmount; - - @Schema(description = "执行法院") - private String courtName; - - @Schema(description = "立案日期") - private String occurrenceTime; - - @Schema(description = "发布日期") - private String releaseDate; - - @Schema(description = "数据类型") - private String dataType; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCaseFiling.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCaseFiling.java deleted file mode 100644 index a0c340b..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditCaseFiling.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 司法大数据 - * - * @author 科技小王子 - * @since 2025-12-19 19:47:22 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditCaseFiling对象", description = "司法大数据") -public class CreditCaseFiling implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "数据类型") - private String dataType; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "立案日期") - private String occurrenceTime; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "项目网址") - private String url; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java deleted file mode 100644 index eec77a2..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java +++ /dev/null @@ -1,297 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 企业 - * - * @author 科技小王子 - * @since 2025-12-17 08:28:03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditCompany对象", description = "企业") -public class CreditCompany implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "原文件导入名称") - private String name; - - @Schema(description = "系统匹配企业名称") - private String matchName; - - @Schema(description = "登记状态") - private String registrationStatus; - - @Schema(description = "法定代表人") - private String legalPerson; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "实缴资本") - private String paidinCapital; - - @Schema(description = "成立日期") - private String establishDate; - - @Schema(description = "统一社会信用代码") - private String code; - - @Schema(description = "企业地址") - private String address; - - @Schema(description = "所属省份") - private String province; - - @Schema(description = "所属城市") - private String city; - - @Schema(description = "所属区县") - private String region; - - @Schema(description = "电话") - private String tel; - - @Schema(description = "更多电话") - private String moreTel; - - @Schema(description = "邮箱") - private String email; - - @Schema(description = "更多邮箱") - private String moreEmail; - - @Schema(description = "企业(机构)类型") - private String institutionType; - - @Schema(description = "纳税人识别号") - private String taxpayerCode; - - @Schema(description = "注册号") - private String registrationNumber; - - @Schema(description = "组织机构代码") - private String organizationalCode; - - @Schema(description = "参保人数") - private String numberOfInsuredPersons; - - @Schema(description = "参保人数所属年报") - private String annualReport; - - @Schema(description = "营业期限") - private String businessTerm; - - @Schema(description = "国标行业门类") - private String nationalStandardIndustryCategories; - - @Schema(description = "国标行业大类") - private String nationalStandardIndustryCategories2; - - @Schema(description = "国标行业中类") - private String nationalStandardIndustryCategories3; - - @Schema(description = "国标行业小类") - private String nationalStandardIndustryCategories4; - - @Schema(description = "企查查行业门类") - private String nationalStandardIndustryCategories5; - - @Schema(description = "企查查行业大类") - private String nationalStandardIndustryCategories6; - - @Schema(description = "企查查行业中类") - private String nationalStandardIndustryCategories7; - - @Schema(description = "企查查行业小类") - private String nationalStandardIndustryCategories8; - - @Schema(description = "企业规模") - private String companySize; - - @Schema(description = "曾用名") - private String formerName; - - @Schema(description = "英文名") - private String englishName; - - @Schema(description = "官网") - private String domain; - - @Schema(description = "通信地址") - private String mailingAddress; - - @Schema(description = "企业简介") - private String companyProfile; - - @Schema(description = "经营范围") - private String natureOfBusiness; - - @Schema(description = "登记机关") - private String registrationAuthority; - - @Schema(description = "纳税人资质") - private String taxpayerQualification; - - @Schema(description = "最新年报年份") - private String latestAnnualReportYear; - - @Schema(description = "最新年报营业收入") - private String latestAnnualReportOnOperatingRevenue; - - @Schema(description = "企查分") - private String enterpriseScoreCheck; - - @Schema(description = "信用等级") - private String creditRating; - - @Schema(description = "科创分") - private String cechnologyScore; - - @Schema(description = "科创等级") - private String cechnologyLevel; - - @Schema(description = "是否小微企业") - private String smallEnterprise; - - - @Schema(description = "项目网址") - private String url; - - @Schema(description = "类型") - private Integer type; - - @Schema(description = "是否客户") - private Integer isCustomer; - - @Schema(description = "上级id, 0是顶级") - private Integer parentId; - - @Schema(description = "所在国家") - 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 = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java deleted file mode 100644 index 45c901a..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 竞争对手 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:04 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditCompetitor对象", description = "竞争对手") -public class CreditCompetitor implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "序号") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "企业名称") - private String name; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "法定代表人") - private String legalRepresentative; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "成立日期") - private String establishmentDate; - - @Schema(description = "登记状态") - private String registrationStatus; - - @Schema(description = "所属行业") - private String industry; - - @Schema(description = "所属省份") - private String province; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "企业名称") - private String companyName; - - @Schema(description = "所属企业名称") - @TableField(exist = false) - private String mainCompanyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCourtAnnouncement.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCourtAnnouncement.java deleted file mode 100644 index 98ca4d9..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditCourtAnnouncement.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 法院公告司法大数据 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditCourtAnnouncement对象", description = "法院公告司法大数据") -public class CreditCourtAnnouncement implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "当事人") - private String otherPartiesThirdParty; - - @Schema(description = "公告类型") - private String dataType; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "刊登日期") - private String occurrenceTime; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCourtSession.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCourtSession.java deleted file mode 100644 index 0784d41..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditCourtSession.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 开庭公告司法大数据 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:32 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditCourtSession对象", description = "开庭公告司法大数据") -public class CreditCourtSession implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "数据类型") - private String dataType; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "发生时间") - private String occurrenceTime; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java deleted file mode 100644 index bcf6009..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 客户 - * - * @author 科技小王子 - * @since 2025-12-21 21:20:58 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditCustomer对象", description = "客户") -public class CreditCustomer implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "客户") - private String name; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "状态") - private String statusTxt; - - @Schema(description = "销售金额(万元)") - private String price; - - @Schema(description = "公开日期") - private String publicDate; - - @Schema(description = "数据来源") - private String dataSource; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "企业名称") - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditDeliveryNotice.java b/src/main/java/com/gxwebsoft/credit/entity/CreditDeliveryNotice.java deleted file mode 100644 index e03a4a4..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditDeliveryNotice.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 送达公告司法大数据 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:51 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditDeliveryNotice对象", description = "送达公告司法大数据") -public class CreditDeliveryNotice implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "当事人") - private String otherPartiesThirdParty; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "发布日期") - private String occurrenceTime; - - @Schema(description = "数据类型") - private String dataType; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java b/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java deleted file mode 100644 index 8cd59c2..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 对外投资 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:11 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditExternal对象", description = "对外投资") -public class CreditExternal implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "被投资企业名称") - private String name; - - @Schema(description = "状态") - private String statusTxt; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "法定代表人") - private String legalRepresentative; - - @Schema(description = "注册资本(金额)") - private String registeredCapital; - - @Schema(description = "成立日期") - private String establishmentDate; - - @Schema(description = "持股比例") - private String shareholdingRatio; - - @Schema(description = "认缴出资额") - private String subscribedInvestmentAmount; - - @Schema(description = "认缴出资日期") - private String subscribedInvestmentDate; - - @Schema(description = "间接持股比例") - private String indirectShareholdingRatio; - - @Schema(description = "投资日期") - private String investmentDate; - - @Schema(description = "所属地区") - private String region; - - @Schema(description = "所属行业") - private String industry; - - @Schema(description = "投资数量") - private Integer investmentCount; - - @Schema(description = "关联产品/机构") - private String relatedProductsInstitutions; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "企业名称") - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditFinalVersion.java b/src/main/java/com/gxwebsoft/credit/entity/CreditFinalVersion.java deleted file mode 100644 index 868fb2c..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditFinalVersion.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 终本案件 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:19 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditFinalVersion对象", description = "终本案件") -public class CreditFinalVersion implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "被执行人") - private String appellee; - - @Schema(description = "疑似申请执行人") - private String plaintiffAppellant; - - @Schema(description = "未履行金额(元)") - private String unfulfilledAmount; - - @Schema(description = "执行标的(元)") - private String involvedAmount; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "执行法院") - private String courtName; - - @Schema(description = "立案日期") - private String occurrenceTime; - - @Schema(description = "终本日期") - private String finalDate; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditGqdj.java b/src/main/java/com/gxwebsoft/credit/entity/CreditGqdj.java deleted file mode 100644 index 9b3c7b9..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditGqdj.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 股权冻结 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:37 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditGqdj对象", description = "股权冻结") -public class CreditGqdj implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "执行通知文书号") - private String caseNumber;; - - @Schema(description = "被执行人") - private String appellee; - - @Schema(description = "冻结股权标的企业") - private String plaintiffAppellant; - - @Schema(description = "被执行人持有股权、其他投资权益数额") - private String involvedAmount; - - @Schema(description = "执行法院") - private String courtName; - - @Schema(description = "类型") - private String dataType; - - @Schema(description = "状态") - private String dataStatus; - - @Schema(description = "详情链接") - private String url; - - @Schema(description = "冻结日期自") - private String freezeDateStart; - - @Schema(description = "冻结日期至") - private String freezeDateEnd; - - @Schema(description = "公示日期") - private String publicDate; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java b/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java deleted file mode 100644 index fda712c..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 历史法定代表人 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditHistoricalLegalPerson对象", description = "历史法定代表人") -public class CreditHistoricalLegalPerson implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "名称") - private String name; - - @Schema(description = "任职日期") - private String registerDate; - - @Schema(description = "卸任日期") - private String publicDate; - - @Schema(description = "链接") - private String url; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "主体企业") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditJudgmentDebtor.java b/src/main/java/com/gxwebsoft/credit/entity/CreditJudgmentDebtor.java deleted file mode 100644 index adf99d4..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditJudgmentDebtor.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; - -/** - * 被执行人 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:55 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditJudgmentDebtor对象", description = "被执行人") -public class CreditJudgmentDebtor implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "被执行人名称") - private String name; - - @Schema(description = "被执行人") - private String name1; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "证件号/组织机构代码") - private String code; - - @Schema(description = "项目网址") - private String url; - - @Schema(description = "发生时间") - private String occurrenceTime; - - @Schema(description = "涉案金额") - private String amount; - - @Schema(description = "执行标的(元)") - private String involvedAmountQcc; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "历史被执行人ID") - @TableField(exist = false) - private Integer historyId; - - @Schema(description = "历史被执行人名称") - @TableField(exist = false) - private String historyName; - - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditJudicialDocument.java b/src/main/java/com/gxwebsoft/credit/entity/CreditJudicialDocument.java deleted file mode 100644 index 9f943c1..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditJudicialDocument.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 裁判文书司法大数据 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:02 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditJudicialDocument对象", description = "裁判文书司法大数据") -public class CreditJudicialDocument implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "文书标题") - private String title; - - @Schema(description = "文书类型") - private String documentType; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "当事人") - private String otherPartiesThirdParty; - - @Schema(description = "案件金额") - private String involvedAmount; - - @Schema(description = "裁判结果") - private String defendantAppellee; - - @Schema(description = "裁判日期") - private String occurrenceTime; - - @Schema(description = "发布日期") - private String releaseDate; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditJudiciary.java b/src/main/java/com/gxwebsoft/credit/entity/CreditJudiciary.java deleted file mode 100644 index 7fcb938..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditJudiciary.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 司法案件 - * - * @author 科技小王子 - * @since 2025-12-16 15:23:58 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditJudiciary对象", description = "司法案件") -public class CreditJudiciary implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "案件名称") - private String name; - - @Schema(description = "案号") - private String code; - - @Schema(description = "详情链接") - private String url; - - @Schema(description = "类型, 0普通用户, 1招投标") - private Integer type; - - @Schema(description = "案由") - private String reason; - - @Schema(description = "上级id, 0是顶级") - private Integer parentId; - - @Schema(description = "案件类型") - private String infoType; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "街道地址") - private String address; - - @Schema(description = "案件进程") - private String caseProgress; - - @Schema(description = "案件身份") - private String caseIdentity; - - @Schema(description = "法院") - private String court; - - @Schema(description = "进程日期") - private String processDate; - - @Schema(description = "案件金额(元)") - private String caseAmount; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "到期时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime expirationTime; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditMediation.java b/src/main/java/com/gxwebsoft/credit/entity/CreditMediation.java deleted file mode 100644 index b7d2b42..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditMediation.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 诉前调解司法大数据 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:25 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditMediation对象", description = "诉前调解司法大数据") -public class CreditMediation implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "数据类型") - private String dataType; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "发生时间") - private String occurrenceTime; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "发生时间") - @TableField(exist = false) - private String occurrenceTime2; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditMpCustomer.java b/src/main/java/com/gxwebsoft/credit/entity/CreditMpCustomer.java deleted file mode 100644 index a1abf40..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditMpCustomer.java +++ /dev/null @@ -1,295 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 小程序端客户 - * - * @author 科技小王子 - * @since 2026-03-16 20:59:17 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditMpCustomer对象", description = "小程序端客户") -public class CreditMpCustomer implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "拖欠方") - private String toUser; - - @Schema(description = "拖欠金额") - private String price; - - @Schema(description = "拖欠年数") - private String years; - - @Schema(description = "链接") - private String url; - - @Schema(description = "状态") - private String statusTxt; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "文件路径") - private String files; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "步骤, 0未受理1已受理2材料提交3合同签订4执行回款5完结") - private Integer step; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0未受理, 1已受理") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "用户昵称") - @TableField(exist = false) - private String nickname; - - @Schema(description = "用户手机号") - @TableField(exist = false) - private String phone; - - @Schema(description = "用户头像") - @TableField(exist = false) - private String avatar; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - // 第1步:案件受理字段 - @Schema(description = "第1步是否已提交") - private Integer followStep1Submitted; - - @Schema(description = "第1步提交时间") - private String followStep1SubmittedAt; - - @Schema(description = "第1步联系人") - private String followStep1Contact; - - @Schema(description = "第1步联系电话") - private String followStep1Phone; - - @Schema(description = "第1步电话录音URL") - private String followStep1AudioUrl; - - @Schema(description = "第1步电话录音文件名") - private String followStep1AudioName; - - @Schema(description = "第1步短信截图JSON") - private String followStep1SmsShots; - - @Schema(description = "第1步电话沟通截图JSON") - private String followStep1CallShots; - - @Schema(description = "第1步沟通情况") - private String followStep1Remark; - - @Schema(description = "第1步意向(无意向/有意向)") - private String followStep1Intention; - - @Schema(description = "第1步沟通次数") - private Integer followStep1CommunicationCount; - - @Schema(description = "第1步是否需要审核") - private Integer followStep1NeedApproval; - - @Schema(description = "第1步是否审核通过") - private Integer followStep1Approved; - - @Schema(description = "第1步审核时间") - private String followStep1ApprovedAt; - - @Schema(description = "第1步审核人ID") - private Long followStep1ApprovedBy; - - // 第2步:材料准备字段 - @Schema(description = "第2步是否已提交") - private Integer followStep2Submitted; - - @Schema(description = "第2步提交时间") - private String followStep2SubmittedAt; - - @Schema(description = "第2步是否需要审核") - private Integer followStep2NeedApproval; - - @Schema(description = "第2步是否审核通过") - private Integer followStep2Approved; - - @Schema(description = "第2步审核时间") - private String followStep2ApprovedAt; - - @Schema(description = "第2步审核人ID") - private Long followStep2ApprovedBy; - - // 第3步:案件办理字段 - @Schema(description = "第3步是否已提交") - private Integer followStep3Submitted; - - @Schema(description = "第3步提交时间") - private String followStep3SubmittedAt; - - @Schema(description = "第3步是否需要审核") - private Integer followStep3NeedApproval; - - @Schema(description = "第3步是否审核通过") - private Integer followStep3Approved; - - @Schema(description = "第3步审核时间") - private String followStep3ApprovedAt; - - @Schema(description = "第3步审核人ID") - private Long followStep3ApprovedBy; - - // 第4步:送达签收字段 - @Schema(description = "第4步是否已提交") - private Integer followStep4Submitted; - - @Schema(description = "第4步提交时间") - private String followStep4SubmittedAt; - - @Schema(description = "第4步是否需要审核") - private Integer followStep4NeedApproval; - - @Schema(description = "第4步是否审核通过") - private Integer followStep4Approved; - - @Schema(description = "第4步审核时间") - private String followStep4ApprovedAt; - - @Schema(description = "第4步审核人ID") - private Long followStep4ApprovedBy; - - // 第5步:合同签订字段 - @Schema(description = "第5步是否已提交") - private Integer followStep5Submitted; - - @Schema(description = "第5步提交时间") - private String followStep5SubmittedAt; - - @Schema(description = "第5步合同信息JSON数组") - private String followStep5Contracts; - - @Schema(description = "第5步是否需要审核") - private Integer followStep5NeedApproval; - - @Schema(description = "第5步是否审核通过") - private Integer followStep5Approved; - - @Schema(description = "第5步审核时间") - private String followStep5ApprovedAt; - - @Schema(description = "第5步审核人ID") - private Long followStep5ApprovedBy; - - // 第6步:订单回款字段 - @Schema(description = "第6步是否已提交") - private Integer followStep6Submitted; - - @Schema(description = "第6步提交时间") - private String followStep6SubmittedAt; - - @Schema(description = "第6步财务录入的回款记录JSON数组") - private String followStep6PaymentRecords; - - @Schema(description = "第6步预计回款JSON数组") - private String followStep6ExpectedPayments; - - @Schema(description = "第6步是否需要审核") - private Integer followStep6NeedApproval; - - @Schema(description = "第6步是否审核通过") - private Integer followStep6Approved; - - @Schema(description = "第6步审核时间") - private String followStep6ApprovedAt; - - @Schema(description = "第6步审核人ID") - private Long followStep6ApprovedBy; - - // 第7步:电话回访字段 - @Schema(description = "第7步是否已提交") - private Integer followStep7Submitted; - - @Schema(description = "第7步提交时间") - private String followStep7SubmittedAt; - - @Schema(description = "第7步回访记录JSON数组") - private String followStep7VisitRecords; - - @Schema(description = "第7步是否需要审核") - private Integer followStep7NeedApproval; - - @Schema(description = "第7步是否审核通过") - private Integer followStep7Approved; - - @Schema(description = "第7步审核时间") - private String followStep7ApprovedAt; - - @Schema(description = "第7步审核人ID") - private Long followStep7ApprovedBy; - - // 流程结束字段 - @Schema(description = "流程是否已结束") - private Integer followProcessEnded; - - @Schema(description = "流程结束时间") - private String followProcessEndTime; - - @Schema(description = "流程结束原因") - private String followProcessEndReason; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java b/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java deleted file mode 100644 index 4a70e79..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java +++ /dev/null @@ -1,247 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 附近企业 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditNearbyCompany对象", description = "附近企业") -public class CreditNearbyCompany implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "企业名称") - private String name; - - @Schema(description = "登记状态") - private String registrationStatus; - - @Schema(description = "法定代表人") - private String legalPerson; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "成立日期") - private String establishDate; - - @Schema(description = "统一社会信用代码") - private String code; - - @Schema(description = "注册地址") - private String address; - - @Schema(description = "注册地址邮编") - private String postalCode; - - @Schema(description = "有效手机号") - private String phone; - - @Schema(description = "更多电话") - private String moreTel; - - @Schema(description = "邮箱") - private String email; - - @Schema(description = "更多邮箱") - private String moreEmail; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所属省份") - private String province; - - @Schema(description = "所属城市") - private String city; - - @Schema(description = "所属区县") - private String region; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "主体企业") - @TableField(exist = false) - private String companyName; - - @Schema(description = "纳税人识别号") - private String taxpayerCode; - - @Schema(description = "注册号") - private String registrationNumber; - - @Schema(description = "组织机构代码") - private String organizationalCode; - - @Schema(description = "参保人数") - private String numberOfInsuredPersons; - - @Schema(description = "参保人数所属年报") - private String annualReport; - - @Schema(description = "企业(机构)类型") - private String institutionType; - - @Schema(description = "企业规模") - private String companySize; - - @Schema(description = "营业期限") - private String businessTerm; - - @Schema(description = "国标行业门类") - private String nationalStandardIndustryCategories; - - @Schema(description = "国标行业大类") - private String nationalStandardIndustryCategories2; - - @Schema(description = "国标行业中类") - private String nationalStandardIndustryCategories3; - - @Schema(description = "国标行业小类") - private String nationalStandardIndustryCategories4; - - @Schema(description = "曾用名") - private String formerName; - - @Schema(description = "英文名") - private String englishName; - - @Schema(description = "官网网址") - private String domain; - - @Schema(description = "通信地址") - private String mailingAddress; - - @Schema(description = "通信地址邮编") - private String mailingEmail; - - @Schema(description = "企业简介") - private String companyProfile; - - @Schema(description = "经营范围") - private String natureOfBusiness; - - @Schema(description = "电话") - private String tel; - - @Schema(description = "企查查行业门类") - private String nationalStandardIndustryCategories5; - - @Schema(description = "企查查行业大类") - private String nationalStandardIndustryCategories6; - - @Schema(description = "企查查行业中类") - private String nationalStandardIndustryCategories7; - - @Schema(description = "企查查行业小类") - private String nationalStandardIndustryCategories8; - - @Schema(description = "链接") - private String url; - - @Schema(description = "类型") - private Integer type; - - @Schema(description = "上级id, 0是顶级") - private Integer parentId; - -// @Schema(description = "实缴资本") -// @TableField(exist = false) -// private String paidinCapital; -// -// @Schema(description = "登记机关") -// @TableField(exist = false) -// private String registrationAuthority; -// -// @Schema(description = "纳税人资质") -// @TableField(exist = false) -// private String taxpayerQualification; -// -// @Schema(description = "最新年报年份") -// @TableField(exist = false) -// private String latestAnnualReportYear; -// -// @Schema(description = "最新年报营业收入") -// @TableField(exist = false) -// private String latestAnnualReportOnOperatingRevenue; -// -// @Schema(description = "企查分") -// @TableField(exist = false) -// private String enterpriseScoreCheck; -// -// @Schema(description = "信用等级") -// @TableField(exist = false) -// private String creditRating; -// -// @Schema(description = "科创分") -// @TableField(exist = false) -// private String cechnologyScore; -// -// @Schema(description = "科创等级") -// @TableField(exist = false) -// private String cechnologyLevel; -// -// @Schema(description = "是否小微企业") -// @TableField(exist = false) -// private String smallEnterprise; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditPatent.java b/src/main/java/com/gxwebsoft/credit/entity/CreditPatent.java deleted file mode 100644 index a45177b..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditPatent.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 专利 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditPatent对象", description = "专利") -public class CreditPatent implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "发明名称") - private String name; - - @Schema(description = "专利类型") - private String type; - - @Schema(description = "法律状态") - private String statusText; - - @Schema(description = "申请号") - private String registerNo; - - @Schema(description = "申请日") - private String registerDate; - - @Schema(description = "公开(公告)号") - private String publicNo; - - @Schema(description = "公开(公告)日期") - private String publicDate; - - @Schema(description = "发明人") - private String inventor; - - @Schema(description = "申请(专利权)人") - private String patentApplicant; - - @Schema(description = "链接") - private String url; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "主体企业") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java b/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java deleted file mode 100644 index a26ab97..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * 风险关系表 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:40 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditRiskRelation对象", description = "风险关系表") -public class CreditRiskRelation implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "序号") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "主体名称") - private String mainBodyName; - - @Schema(description = "登记状态") - private String registrationStatus; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "省份地区") - private String provinceRegion; - - @Schema(description = "关联关系") - private String associatedRelation; - - @Schema(description = "风险关系") - private String riskRelation; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "企业名称") - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java b/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java deleted file mode 100644 index 1838547..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 供应商 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:47 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditSupplier对象", description = "供应商") -public class CreditSupplier implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "供应商") - private String supplier; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "状态") - private String statusTxt; - - @Schema(description = "采购金额(万元)") - private String purchaseAmount; - - @Schema(description = "公开日期") - private String publicDate; - - @Schema(description = "数据来源") - private String dataSource; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "企业名称") - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java b/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java deleted file mode 100644 index 5e4cac8..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 疑似关系 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditSuspectedRelationship对象", description = "疑似关系") -public class CreditSuspectedRelationship implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "企业名称") - private String name; - - @Schema(description = "状态") - private String statusText; - - @Schema(description = "法定代表人") - private String legalPerson; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "成立日期") - private String createDate; - - @Schema(description = "关联方") - private String relatedParty; - - @Schema(description = "疑似关系类型") - private String type; - - @Schema(description = "疑似关系详情") - private String detail; - - @Schema(description = "链接") - private String url; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "主体企业") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java b/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java deleted file mode 100644 index 6eb943f..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.fasterxml.jackson.annotation.JsonFormat; - -/** - * 招投标信息表 - * - * @author 科技小王子 - * @since 2025-12-15 13:16:03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditUser对象", description = "招投标信息表") -public class CreditUser implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "项目名称") - private String name; - - @Schema(description = "项目网址") - private String url; - - @Schema(description = "唯一标识") - private String code; - - @Schema(description = "类型, 0普通用户, 1招投标") - private Integer type; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "企业角色") - private String role; - - @Schema(description = "上级id, 0是顶级") - private Integer parentId; - - @Schema(description = "信息类型") - private String infoType; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "街道地址") - private String address; - - @Schema(description = "招采单位") - private String procurementName; - - @Schema(description = "中标单位") - private String winningName; - - @Schema(description = "中标金额") - private String winningPrice; - - @Schema(description = "发布日期") - private String releaseDate; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业别名") - private String companyAlias; - - @Schema(description = "企业名称") - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditXgxf.java b/src/main/java/com/gxwebsoft/credit/entity/CreditXgxf.java deleted file mode 100644 index 4304433..0000000 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditXgxf.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.gxwebsoft.credit.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 限制高消费 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:55 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "CreditXgxf对象", description = "限制高消费") -public class CreditXgxf implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "链接地址") - private String url; - - @Schema(description = "数据类型") - private String type; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "发生时间") - private String occurrenceTime; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "限消令对象") - private String dataType; - - @Schema(description = "原告/上诉人2") - private String plaintiffUser; - - @Schema(description = "被告/被上诉人2") - private String defendantUser; - - @Schema(description = "发布日期") - private String releaseDate; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "企业名称") - @TableField(exist = false) - private String companyName; - - @Schema(description = "是否有数据") - private Boolean hasData; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/credit/excel/ExcelHeaderAlias.java b/src/main/java/com/gxwebsoft/credit/excel/ExcelHeaderAlias.java deleted file mode 100644 index f8a6d55..0000000 --- a/src/main/java/com/gxwebsoft/credit/excel/ExcelHeaderAlias.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.gxwebsoft.credit.excel; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Excel 导入表头别名。 - * - *

EasyPOI 的 {@code @Excel(name=...)} 仅支持一个表头名;当上游模板存在多种表头写法时, - * 可用此注解声明别名,让 {@link com.gxwebsoft.credit.controller.ExcelImportSupport} 在导入前把别名规范化为 canonical 表头。

- */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface ExcelHeaderAlias { - - /** - * 允许匹配的表头别名列表(任意一个匹配即视为该列)。 - */ - String[] value(); -} - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditAdministrativeLicenseMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditAdministrativeLicenseMapper.java deleted file mode 100644 index 7f81ff0..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditAdministrativeLicenseMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditAdministrativeLicense; -import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 行政许可Mapper - * - * @author 科技小王子 - * @since 2026-01-07 13:52:13 - */ -public interface CreditAdministrativeLicenseMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditAdministrativeLicenseParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditAdministrativeLicenseParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditBankruptcyMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditBankruptcyMapper.java deleted file mode 100644 index 50ed5b5..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditBankruptcyMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditBankruptcy; -import com.gxwebsoft.credit.param.CreditBankruptcyParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 破产重整Mapper - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditBankruptcyMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditBankruptcyParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditBankruptcyParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditBranchMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditBranchMapper.java deleted file mode 100644 index 3f4877c..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditBranchMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditBranch; -import com.gxwebsoft.credit.param.CreditBranchParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分支机构Mapper - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditBranchMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditBranchParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditBranchParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditBreachOfTrustMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditBreachOfTrustMapper.java deleted file mode 100644 index 70da1c3..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditBreachOfTrustMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditBreachOfTrust; -import com.gxwebsoft.credit.param.CreditBreachOfTrustParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 失信被执行人Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:46:14 - */ -public interface CreditBreachOfTrustMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditBreachOfTrustParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditBreachOfTrustParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCaseFilingMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCaseFilingMapper.java deleted file mode 100644 index 8bfd804..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditCaseFilingMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditCaseFiling; -import com.gxwebsoft.credit.param.CreditCaseFilingParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 司法大数据Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:47:22 - */ -public interface CreditCaseFilingMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditCaseFilingParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditCaseFilingParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java deleted file mode 100644 index bbd7c01..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.param.CreditCompanyParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 企业Mapper - * - * @author 科技小王子 - * @since 2025-12-17 08:28:03 - */ -public interface CreditCompanyMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditCompanyParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditCompanyParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCompetitorMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCompetitorMapper.java deleted file mode 100644 index fad9fa7..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditCompetitorMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditCompetitor; -import com.gxwebsoft.credit.param.CreditCompetitorParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 竞争对手Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:49:04 - */ -public interface CreditCompetitorMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditCompetitorParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditCompetitorParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtAnnouncementMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtAnnouncementMapper.java deleted file mode 100644 index 5c6eb80..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtAnnouncementMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditCourtAnnouncement; -import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 法院公告司法大数据Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:49:13 - */ -public interface CreditCourtAnnouncementMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditCourtAnnouncementParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditCourtAnnouncementParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtSessionMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtSessionMapper.java deleted file mode 100644 index c9dd2e1..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtSessionMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditCourtSession; -import com.gxwebsoft.credit.param.CreditCourtSessionParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 开庭公告司法大数据Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:49:32 - */ -public interface CreditCourtSessionMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditCourtSessionParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditCourtSessionParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCustomerMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCustomerMapper.java deleted file mode 100644 index 6866565..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditCustomerMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditCustomer; -import com.gxwebsoft.credit.param.CreditCustomerParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 客户Mapper - * - * @author 科技小王子 - * @since 2025-12-21 21:20:58 - */ -public interface CreditCustomerMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditCustomerParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditCustomerParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditDeliveryNoticeMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditDeliveryNoticeMapper.java deleted file mode 100644 index 66ce505..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditDeliveryNoticeMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditDeliveryNotice; -import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 送达公告司法大数据Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:49:51 - */ -public interface CreditDeliveryNoticeMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditDeliveryNoticeParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditDeliveryNoticeParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditExternalMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditExternalMapper.java deleted file mode 100644 index de61c9f..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditExternalMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditExternal; -import com.gxwebsoft.credit.param.CreditExternalParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 对外投资Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:50:11 - */ -public interface CreditExternalMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditExternalParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditExternalParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditFinalVersionMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditFinalVersionMapper.java deleted file mode 100644 index dd4ef4a..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditFinalVersionMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditFinalVersion; -import com.gxwebsoft.credit.param.CreditFinalVersionParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 终本案件Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:50:19 - */ -public interface CreditFinalVersionMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditFinalVersionParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditFinalVersionParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditGqdjMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditGqdjMapper.java deleted file mode 100644 index 6cc6df7..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditGqdjMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditGqdj; -import com.gxwebsoft.credit.param.CreditGqdjParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 股权冻结Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:50:37 - */ -public interface CreditGqdjMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditGqdjParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditGqdjParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditHistoricalLegalPersonMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditHistoricalLegalPersonMapper.java deleted file mode 100644 index d13adee..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditHistoricalLegalPersonMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson; -import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 历史法定代表人Mapper - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditHistoricalLegalPersonMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditHistoricalLegalPersonParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditHistoricalLegalPersonParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditJudgmentDebtorMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditJudgmentDebtorMapper.java deleted file mode 100644 index 13ef10f..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditJudgmentDebtorMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditJudgmentDebtor; -import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 被执行人Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:50:55 - */ -public interface CreditJudgmentDebtorMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditJudgmentDebtorParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditJudgmentDebtorParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditJudicialDocumentMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditJudicialDocumentMapper.java deleted file mode 100644 index 46356c6..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditJudicialDocumentMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditJudicialDocument; -import com.gxwebsoft.credit.param.CreditJudicialDocumentParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 裁判文书司法大数据Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:51:02 - */ -public interface CreditJudicialDocumentMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditJudicialDocumentParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditJudicialDocumentParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditJudiciaryMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditJudiciaryMapper.java deleted file mode 100644 index 85c3efa..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditJudiciaryMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditJudiciary; -import com.gxwebsoft.credit.param.CreditJudiciaryParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 司法案件Mapper - * - * @author 科技小王子 - * @since 2025-12-16 15:23:58 - */ -public interface CreditJudiciaryMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditJudiciaryParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditJudiciaryParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditMediationMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditMediationMapper.java deleted file mode 100644 index f46225b..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditMediationMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditMediation; -import com.gxwebsoft.credit.param.CreditMediationParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 诉前调解司法大数据Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:51:25 - */ -public interface CreditMediationMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditMediationParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditMediationParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditMpCustomerMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditMpCustomerMapper.java deleted file mode 100644 index aa4d152..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditMpCustomerMapper.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditMpCustomer; -import com.gxwebsoft.credit.param.CreditMpCustomerParam; -import com.gxwebsoft.credit.param.FollowStepQueryDTO; -import com.gxwebsoft.credit.vo.PendingApprovalStepVO; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 小程序端客户Mapper - * - * @author 科技小王子 - * @since 2026-03-16 20:59:17 - */ -public interface CreditMpCustomerMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditMpCustomerParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditMpCustomerParam param); - - /** - * 获取待审核的跟进步骤列表 - * - * @param query 查询参数 - * @return 待审核步骤列表 - */ - List selectPendingApprovalSteps(@Param("param") FollowStepQueryDTO query); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditNearbyCompanyMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditNearbyCompanyMapper.java deleted file mode 100644 index c557744..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditNearbyCompanyMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditNearbyCompany; -import com.gxwebsoft.credit.param.CreditNearbyCompanyParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 附近企业Mapper - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditNearbyCompanyMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditNearbyCompanyParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditNearbyCompanyParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditPatentMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditPatentMapper.java deleted file mode 100644 index bb5628a..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditPatentMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditPatent; -import com.gxwebsoft.credit.param.CreditPatentParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 专利Mapper - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditPatentMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditPatentParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditPatentParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditRiskRelationMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditRiskRelationMapper.java deleted file mode 100644 index 077c758..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditRiskRelationMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditRiskRelation; -import com.gxwebsoft.credit.param.CreditRiskRelationParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 风险关系表Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:51:40 - */ -public interface CreditRiskRelationMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditRiskRelationParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditRiskRelationParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditSupplierMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditSupplierMapper.java deleted file mode 100644 index fd6d687..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditSupplierMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditSupplier; -import com.gxwebsoft.credit.param.CreditSupplierParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 供应商Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:51:47 - */ -public interface CreditSupplierMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditSupplierParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditSupplierParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditSuspectedRelationshipMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditSuspectedRelationshipMapper.java deleted file mode 100644 index 4e05d9c..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditSuspectedRelationshipMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditSuspectedRelationship; -import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 疑似关系Mapper - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditSuspectedRelationshipMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditSuspectedRelationshipParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditSuspectedRelationshipParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditUserMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditUserMapper.java deleted file mode 100644 index dd1372c..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditUserMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditUser; -import com.gxwebsoft.credit.param.CreditUserParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 招投标信息表Mapper - * - * @author 科技小王子 - * @since 2025-12-15 13:16:03 - */ -public interface CreditUserMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditUserParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditUserParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditXgxfMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditXgxfMapper.java deleted file mode 100644 index c63d8f5..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/CreditXgxfMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.credit.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.credit.entity.CreditXgxf; -import com.gxwebsoft.credit.param.CreditXgxfParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 限制高消费Mapper - * - * @author 科技小王子 - * @since 2025-12-19 19:51:55 - */ -public interface CreditXgxfMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") CreditXgxfParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") CreditXgxfParam param); - -} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml deleted file mode 100644 index 7bcd283..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - SELECT a.*, b.match_name AS companyName, u.real_name AS realName - FROM credit_administrative_license a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') - - - AND a.type LIKE CONCAT('%', #{param.type}, '%') - - - AND a.url LIKE CONCAT('%', #{param.url}, '%') - - - AND a.validity_start LIKE CONCAT('%', #{param.validityStart}, '%') - - - AND a.validity_end LIKE CONCAT('%', #{param.validityEnd}, '%') - - - AND a.licensing_authority LIKE CONCAT('%', #{param.licensingAuthority}, '%') - - - AND a.License_content LIKE CONCAT('%', #{param.licenseContent}, '%') - - - AND a.data_source_unit LIKE CONCAT('%', #{param.dataSourceUnit}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.company_id = #{param.companyId} - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.code LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBankruptcyMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBankruptcyMapper.xml deleted file mode 100644 index 4015535..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBankruptcyMapper.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_bankruptcy a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - - AND a.id = #{param.id} - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.type LIKE CONCAT('%', #{param.type}, '%') - - - AND a.party LIKE CONCAT('%', #{param.party}, '%') - - - AND a.url LIKE CONCAT('%', #{param.url}, '%') - - - AND a.court LIKE CONCAT('%', #{param.court}, '%') - - - AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.company_id = #{param.companyId} - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.code LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml deleted file mode 100644 index 3fe1102..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - SELECT a.*, b.match_name AS companyName, u.real_name AS realName - FROM credit_branch a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.curator LIKE CONCAT('%', #{param.curator}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.url LIKE CONCAT('%', #{param.url}, '%') - - - AND a.establish_date LIKE CONCAT('%', #{param.establishDate}, '%') - - - AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.company_id = #{param.companyId} - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.curator LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBreachOfTrustMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBreachOfTrustMapper.xml deleted file mode 100644 index e82aa24..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBreachOfTrustMapper.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_breach_of_trust a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') - - - AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.involved_amount = #{param.involvedAmount} - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number = #{param.keywords} - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCaseFilingMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCaseFilingMapper.xml deleted file mode 100644 index b0e4a32..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCaseFilingMapper.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_case_filing a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') - - - AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') - - - AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') - - - AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') - - - AND a.involved_amount = #{param.involvedAmount} - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml deleted file mode 100644 index 9c3d859..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - SELECT a.*, u.real_name AS realName - FROM credit_company a - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.match_name LIKE CONCAT('%', #{param.matchName}, '%') - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.type = #{param.type} - - - AND a.is_customer = #{param.isCustomer} - - - AND a.parent_id = #{param.parentId} - - - AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%') - - - AND a.legal_person LIKE CONCAT('%', #{param.legalPerson}, '%') - - - AND a.registered_capital LIKE CONCAT('%', #{param.registeredCapital}, '%') - - - AND a.paidin_capital LIKE CONCAT('%', #{param.paidinCapital}, '%') - - - AND a.establish_date LIKE CONCAT('%', #{param.establishDate}, '%') - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.tel LIKE CONCAT('%', #{param.tel}, '%') - - - AND a.more_tel LIKE CONCAT('%', #{param.moreTel}, '%') - - - AND a.email LIKE CONCAT('%', #{param.email}, '%') - - - AND a.more_email LIKE CONCAT('%', #{param.moreEmail}, '%') - - - AND a.country LIKE CONCAT('%', #{param.country}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.institution_type LIKE CONCAT('%', #{param.institutionType}, '%') - - - AND a.taxpayer_code LIKE CONCAT('%', #{param.taxpayerCode}, '%') - - - AND a.registration_number LIKE CONCAT('%', #{param.registrationNumber}, '%') - - - AND a.organizational_code LIKE CONCAT('%', #{param.organizationalCode}, '%') - - - AND a.number_of_insured_persons LIKE CONCAT('%', #{param.numberOfInsuredPersons}, '%') - - - AND a.annual_report LIKE CONCAT('%', #{param.annualReport}, '%') - - - AND a.business_term LIKE CONCAT('%', #{param.businessTerm}, '%') - - - AND a.national_standard_industry_categories LIKE CONCAT('%', #{param.nationalStandardIndustryCategories}, '%') - - - AND a.national_standard_industry_categories2 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories2}, '%') - - - AND a.national_standard_industry_categories3 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories3}, '%') - - - AND a.national_standard_industry_categories4 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories4}, '%') - - - AND a.national_standard_industry_categories5 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories5}, '%') - - - AND a.national_standard_industry_categories6 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories6}, '%') - - - AND a.national_standard_industry_categories7 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories7}, '%') - - - AND a.national_standard_industry_categories8 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories8}, '%') - - - AND a.company_size LIKE CONCAT('%', #{param.companySize}, '%') - - - AND a.former_name LIKE CONCAT('%', #{param.formerName}, '%') - - - AND a.english_name LIKE CONCAT('%', #{param.englishName}, '%') - - - AND a.domain LIKE CONCAT('%', #{param.domain}, '%') - - - AND a.mailing_address LIKE CONCAT('%', #{param.mailingAddress}, '%') - - - AND a.company_profile LIKE CONCAT('%', #{param.companyProfile}, '%') - - - AND a.nature_of_business LIKE CONCAT('%', #{param.natureOfBusiness}, '%') - - - AND a.registration_authority LIKE CONCAT('%', #{param.registrationAuthority}, '%') - - - AND a.taxpayer_qualification LIKE CONCAT('%', #{param.taxpayerQualification}, '%') - - - AND a.latest_annual_report_year LIKE CONCAT('%', #{param.latestAnnualReportYear}, '%') - - - AND a.latest_annual_report_on_operating_revenue LIKE CONCAT('%', #{param.latestAnnualReportOnOperatingRevenue}, '%') - - - AND a.enterprise_score_check LIKE CONCAT('%', #{param.enterpriseScoreCheck}, '%') - - - AND a.credit_rating LIKE CONCAT('%', #{param.creditRating}, '%') - - - AND a.cechnology_score LIKE CONCAT('%', #{param.cechnologyScore}, '%') - - - AND a.cechnology_level LIKE CONCAT('%', #{param.cechnologyLevel}, '%') - - - AND a.small_enterprise LIKE CONCAT('%', #{param.smallEnterprise}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.match_name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.code = #{param.keywords} - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompetitorMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompetitorMapper.xml deleted file mode 100644 index 744416b..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompetitorMapper.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_competitor a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.legal_representative LIKE CONCAT('%', #{param.legalRepresentative}, '%') - - - AND a.registered_capital = #{param.registeredCapital} - - - AND a.establishment_date LIKE CONCAT('%', #{param.establishmentDate}, '%') - - - AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%') - - - AND a.industry LIKE CONCAT('%', #{param.industry}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.name LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtAnnouncementMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtAnnouncementMapper.xml deleted file mode 100644 index 6877424..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtAnnouncementMapper.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_court_announcement a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') - - - AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') - - - AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') - - - AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') - - - AND a.involved_amount = #{param.involvedAmount} - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtSessionMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtSessionMapper.xml deleted file mode 100644 index 41c0cec..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtSessionMapper.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_court_session a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') - - - AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') - - - AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') - - - AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') - - - AND a.involved_amount = #{param.involvedAmount} - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCustomerMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCustomerMapper.xml deleted file mode 100644 index cf00890..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCustomerMapper.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_customer a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.status_txt LIKE CONCAT('%', #{param.statusTxt}, '%') - - - AND a.price = #{param.price} - - - AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') - - - AND a.data_source LIKE CONCAT('%', #{param.dataSource}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditDeliveryNoticeMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditDeliveryNoticeMapper.xml deleted file mode 100644 index cb22c50..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditDeliveryNoticeMapper.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_delivery_notice a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditExternalMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditExternalMapper.xml deleted file mode 100644 index 94e2362..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditExternalMapper.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_external a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.status_txt LIKE CONCAT('%', #{param.statusTxt}, '%') - - - AND a.legal_representative LIKE CONCAT('%', #{param.legalRepresentative}, '%') - - - AND a.registered_capital = #{param.registeredCapital} - - - AND a.establishment_date LIKE CONCAT('%', #{param.establishmentDate}, '%') - - - AND a.shareholding_ratio = #{param.shareholdingRatio} - - - AND a.subscribed_investment_amount = #{param.subscribedInvestmentAmount} - - - AND a.subscribed_investment_date LIKE CONCAT('%', #{param.subscribedInvestmentDate}, '%') - - - AND a.indirect_shareholding_ratio = #{param.indirectShareholdingRatio} - - - AND a.investment_date LIKE CONCAT('%', #{param.investmentDate}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.industry LIKE CONCAT('%', #{param.industry}, '%') - - - AND a.investment_count = #{param.investmentCount} - - - AND a.related_products_institutions LIKE CONCAT('%', #{param.relatedProductsInstitutions}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.name LIKE CONCAT('%', #{param.name}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditFinalVersionMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditFinalVersionMapper.xml deleted file mode 100644 index 630e357..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditFinalVersionMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_final_version a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') - - - AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.involved_amount = #{param.involvedAmount} - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number = #{param.keywords} - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditGqdjMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditGqdjMapper.xml deleted file mode 100644 index 6c90a51..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditGqdjMapper.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_gqdj a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') - - - AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') - - - AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.involved_amount = #{param.involvedAmount} - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number = #{param.keywords} - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml deleted file mode 100644 index 6353308..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - SELECT a.*, b.match_name AS companyName, u.real_name AS realName - FROM credit_historical_legal_person a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.register_date LIKE CONCAT('%', #{param.registerDate}, '%') - - - AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') - - - AND a.url LIKE CONCAT('%', #{param.url}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.company_id = #{param.companyId} - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudgmentDebtorMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudgmentDebtorMapper.xml deleted file mode 100644 index c03a9ee..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudgmentDebtorMapper.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_judgment_debtor a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.amount = #{param.amount} - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number = #{param.keywords} - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudicialDocumentMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudicialDocumentMapper.xml deleted file mode 100644 index 8f2521c..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudicialDocumentMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_judicial_document a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.title LIKE CONCAT('%', #{param.title}, '%') - - - AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') - - - AND a.involved_amount = #{param.involvedAmount} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml deleted file mode 100644 index 9b69e2f..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_judiciary a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.type = #{param.type} - - - AND a.reason LIKE CONCAT('%', #{param.reason}, '%') - - - AND a.parent_id = #{param.parentId} - - - AND a.info_type LIKE CONCAT('%', #{param.infoType}, '%') - - - AND a.country LIKE CONCAT('%', #{param.country}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.case_progress LIKE CONCAT('%', #{param.caseProgress}, '%') - - - AND a.case_identity LIKE CONCAT('%', #{param.caseIdentity}, '%') - - - AND a.court LIKE CONCAT('%', #{param.court}, '%') - - - AND a.process_date LIKE CONCAT('%', #{param.processDate}, '%') - - - AND a.case_amount LIKE CONCAT('%', #{param.caseAmount}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.code LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditMediationMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditMediationMapper.xml deleted file mode 100644 index b08bec6..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditMediationMapper.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_mediation a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') - - - AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') - - - AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') - - - AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') - - - AND a.involved_amount = #{param.involvedAmount} - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditMpCustomerMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditMpCustomerMapper.xml deleted file mode 100644 index be99d3e..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditMpCustomerMapper.xml +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - SELECT a.*, u.nickname AS nickname, u.avatar AS avatar, u.phone AS phone, u.real_name AS realName - FROM credit_mp_customer a - LEFT JOIN gxwebsoft_core.sys_user u ON u.user_id = a.user_id - - - AND a.id = #{param.id} - - - AND a.to_user LIKE CONCAT('%', #{param.toUser}, '%') - - - AND a.price LIKE CONCAT('%', #{param.price}, '%') - - - AND a.years LIKE CONCAT('%', #{param.years}, '%') - - - AND a.url LIKE CONCAT('%', #{param.url}, '%') - - - AND a.status_txt LIKE CONCAT('%', #{param.statusTxt}, '%') - - - AND a.company_id = #{param.companyId} - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.files LIKE CONCAT('%', #{param.files}, '%') - - - AND a.has_data = #{param.hasData} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.step = #{param.step} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.to_user LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml deleted file mode 100644 index 1d2bbc5..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - SELECT a.*, b.match_name AS companyName, u.real_name AS realName - FROM credit_nearby_company a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.company_id = #{param.companyId} - - - AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%') - - - AND a.legal_person LIKE CONCAT('%', #{param.legalPerson}, '%') - - - AND a.registered_capital LIKE CONCAT('%', #{param.registeredCapital}, '%') - - - AND a.establish_date LIKE CONCAT('%', #{param.establishDate}, '%') - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.postal_code LIKE CONCAT('%', #{param.postalCode}, '%') - - - AND a.phone LIKE CONCAT('%', #{param.phone}, '%') - - - AND a.more_tel LIKE CONCAT('%', #{param.moreTel}, '%') - - - AND a.email LIKE CONCAT('%', #{param.email}, '%') - - - AND a.more_email LIKE CONCAT('%', #{param.moreEmail}, '%') - - - AND a.country LIKE CONCAT('%', #{param.country}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - - - - AND a.registration_number LIKE CONCAT('%', #{param.registrationNumber}, '%') - - - AND a.organizational_code LIKE CONCAT('%', #{param.organizationalCode}, '%') - - - AND a.number_of_insured_persons LIKE CONCAT('%', #{param.numberOfInsuredPersons}, '%') - - - AND a.annual_report LIKE CONCAT('%', #{param.annualReport}, '%') - - - AND a.institution_type LIKE CONCAT('%', #{param.institutionType}, '%') - - - AND a.company_size LIKE CONCAT('%', #{param.companySize}, '%') - - - AND a.business_term LIKE CONCAT('%', #{param.businessTerm}, '%') - - - AND a.national_standard_industry_categories LIKE CONCAT('%', #{param.nationalStandardIndustryCategories}, '%') - - - AND a.national_standard_industry_categories2 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories2}, '%') - - - AND a.national_standard_industry_categories3 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories3}, '%') - - - AND a.national_standard_industry_categories4 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories4}, '%') - - - AND a.former_name LIKE CONCAT('%', #{param.formerName}, '%') - - - AND a.english_name LIKE CONCAT('%', #{param.englishName}, '%') - - - AND a.domain LIKE CONCAT('%', #{param.domain}, '%') - - - AND a.mailing_address LIKE CONCAT('%', #{param.mailingAddress}, '%') - - - AND a.mailing_email LIKE CONCAT('%', #{param.mailingEmail}, '%') - - - AND a.company_profile LIKE CONCAT('%', #{param.companyProfile}, '%') - - - AND a.nature_of_business LIKE CONCAT('%', #{param.natureOfBusiness}, '%') - - - AND a.tel LIKE CONCAT('%', #{param.tel}, '%') - - - AND a.national_standard_industry_categories5 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories5}, '%') - - - AND a.national_standard_industry_categories6 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories6}, '%') - - - AND a.national_standard_industry_categories7 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories7}, '%') - - - AND a.national_standard_industry_categories8 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories8}, '%') - - - AND a.url LIKE CONCAT('%', #{param.url}, '%') - - - AND a.type = #{param.type} - - - AND a.parent_id = #{param.parentId} - - - AND a.paidin_capital LIKE CONCAT('%', #{param.paidinCapital}, '%') - - - AND a.registration_authority LIKE CONCAT('%', #{param.registrationAuthority}, '%') - - - AND a.taxpayer_qualification LIKE CONCAT('%', #{param.taxpayerQualification}, '%') - - - AND a.latest_annual_report_year LIKE CONCAT('%', #{param.latestAnnualReportYear}, '%') - - - AND a.latest_annual_report_on_operating_revenue LIKE CONCAT('%', #{param.latestAnnualReportOnOperatingRevenue}, '%') - - - AND a.enterprise_score_check LIKE CONCAT('%', #{param.enterpriseScoreCheck}, '%') - - - AND a.credit_rating LIKE CONCAT('%', #{param.creditRating}, '%') - - - AND a.cechnology_score LIKE CONCAT('%', #{param.cechnologyScore}, '%') - - - AND a.cechnology_level LIKE CONCAT('%', #{param.cechnologyLevel}, '%') - - - AND a.small_enterprise LIKE CONCAT('%', #{param.smallEnterprise}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.name = #{param.keywords} - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditPatentMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditPatentMapper.xml deleted file mode 100644 index 091c212..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditPatentMapper.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_patent a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.type LIKE CONCAT('%', #{param.type}, '%') - - - AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') - - - AND a.register_no LIKE CONCAT('%', #{param.registerNo}, '%') - - - AND a.register_date LIKE CONCAT('%', #{param.registerDate}, '%') - - - AND a.public_no LIKE CONCAT('%', #{param.publicNo}, '%') - - - AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') - - - AND a.inventor LIKE CONCAT('%', #{param.inventor}, '%') - - - AND a.patent_applicant LIKE CONCAT('%', #{param.patentApplicant}, '%') - - - AND a.url LIKE CONCAT('%', #{param.url}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.company_id = #{param.companyId} - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.public_no LIKE CONCAT('%', #{param.keywords}, '%') - OR a.register_no LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditRiskRelationMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditRiskRelationMapper.xml deleted file mode 100644 index b425443..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditRiskRelationMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_risk_relation a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.main_body_name LIKE CONCAT('%', #{param.mainBodyName}, '%') - - - AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%') - - - AND a.registered_capital = #{param.registeredCapital} - - - AND a.province_region LIKE CONCAT('%', #{param.provinceRegion}, '%') - - - AND a.associated_relation LIKE CONCAT('%', #{param.associatedRelation}, '%') - - - AND a.risk_relation LIKE CONCAT('%', #{param.riskRelation}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name = #{param.keywords} - OR b.match_name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSupplierMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSupplierMapper.xml deleted file mode 100644 index b57a639..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSupplierMapper.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_supplier a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.supplier LIKE CONCAT('%', #{param.supplier}, '%') - - - AND a.status_txt LIKE CONCAT('%', #{param.statusTxt}, '%') - - - AND a.purchase_amount = #{param.purchaseAmount} - - - AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') - - - AND a.data_source LIKE CONCAT('%', #{param.dataSource}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.supplier LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml deleted file mode 100644 index 926d8c3..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - SELECT a.*, b.match_name AS companyName, u.real_name AS realName - FROM credit_suspected_relationship a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') - - - AND a.legal_person LIKE CONCAT('%', #{param.legalPerson}, '%') - - - AND a.registered_capital LIKE CONCAT('%', #{param.registeredCapital}, '%') - - - AND a.create_date LIKE CONCAT('%', #{param.createDate}, '%') - - - AND a.related_party LIKE CONCAT('%', #{param.relatedParty}, '%') - - - AND a.type LIKE CONCAT('%', #{param.type}, '%') - - - AND a.detail LIKE CONCAT('%', #{param.detail}, '%') - - - AND a.url LIKE CONCAT('%', #{param.url}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.company_id = #{param.companyId} - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml deleted file mode 100644 index 345e12d..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_user a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.type = #{param.type} - - - AND a.role LIKE CONCAT('%', #{param.role}, '%') - - - AND a.parent_id = #{param.parentId} - - - AND a.info_type LIKE CONCAT('%', #{param.infoType}, '%') - - - AND a.country LIKE CONCAT('%', #{param.country}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.procurement_name LIKE CONCAT('%', #{param.procurementName}, '%') - - - AND a.winning_name LIKE CONCAT('%', #{param.winningName}, '%') - - - AND a.winning_price LIKE CONCAT('%', #{param.winningPrice}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.procurement_name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.winning_name LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditXgxfMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditXgxfMapper.xml deleted file mode 100644 index d46d11a..0000000 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditXgxfMapper.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - SELECT a.*, b.name AS companyName, u.real_name AS realName - FROM credit_xgxf a - LEFT JOIN credit_company b ON a.company_id = b.id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.company_id = #{param.companyId} - - - AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') - - - AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') - - - AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') - - - AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') - - - AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') - - - AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') - - - AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') - - - AND a.involved_amount = #{param.involvedAmount} - - - AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') - - - AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.case_number = #{param.keywords} - OR a.plaintiff_appellant = #{param.keywords} - OR a.appellee = #{param.keywords} - OR a.court_name = #{param.keywords} - OR a.other_parties_third_party LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/credit/param/BatchFollowStepApprovalDTO.java b/src/main/java/com/gxwebsoft/credit/param/BatchFollowStepApprovalDTO.java deleted file mode 100644 index 13af663..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/BatchFollowStepApprovalDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.gxwebsoft.credit.param; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - * 批量跟进步骤审核DTO - * - * @author 科技小王子 - * @since 2026-03-22 - */ -@Data -@Schema(name = "BatchFollowStepApprovalDTO对象", description = "批量跟进步骤审核DTO") -public class BatchFollowStepApprovalDTO { - - @Schema(description = "审核列表", required = true) - @NotNull(message = "审核列表不能为空") - @Valid - private List approvals; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseImportParam.java deleted file mode 100644 index 91bf7f0..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseImportParam.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 行政许可导入参数 - */ -@Data -public class CreditAdministrativeLicenseImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "决定文书/许可编号") - private String code; - - @Excel(name = "决定文书/许可证名称") - private String name; - - @Excel(name = "许可状态") - private String statusText; - - @Excel(name = "许可类别") - private String type; - - @Excel(name = "有效期自") - private String validityStart; - - @Excel(name = "有效期至") - private String validityEnd; - - @Excel(name = "许可机关") - private String licensingAuthority; - - @Excel(name = "许可内容") - private String licenseContent; - - @Excel(name = "数据来源单位") - private String dataSourceUnit; - - @Excel(name = "备注") - private String comments; -} - diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseParam.java deleted file mode 100644 index 13b537b..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseParam.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 行政许可查询参数 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditAdministrativeLicenseParam对象", description = "行政许可查询参数") -public class CreditAdministrativeLicenseParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "决定文书/许可编号") - private String code; - - @Schema(description = "决定文书/许可证名称") - private String name; - - @Schema(description = "许可状态") - private String statusText; - - @Schema(description = "许可类别") - private String type; - - @Schema(description = "链接") - private String url; - - @Schema(description = "有效期自") - private String validityStart; - - @Schema(description = "有效期至") - private String validityEnd; - - @Schema(description = "许可机关") - private String licensingAuthority; - - @Schema(description = "许可内容") - private String licenseContent; - - @Schema(description = "数据来源单位") - private String dataSourceUnit; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - @QueryField(type = QueryType.EQ) - private Integer companyId; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyImportParam.java deleted file mode 100644 index b1c83b9..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyImportParam.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 破产重整导入参数 - */ -@Data -public class CreditBankruptcyImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "案号") - private String code; - - @Excel(name = "案件类型") - private String type; - - @Excel(name = "当事人") - private String party; - - @Excel(name = "经办法院") - private String court; - - @Excel(name = "公开日期") - private String publicDate; - - @Excel(name = "备注") - private String comments; -} - diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyParam.java deleted file mode 100644 index 1be91f0..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyParam.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 破产重整查询参数 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditBankruptcyParam对象", description = "破产重整查询参数") -public class CreditBankruptcyParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "案号") - private String code; - - @Schema(description = "案件类型") - private String type; - - @Schema(description = "当事人") - private String party; - - @Schema(description = "链接") - private String url; - - @Schema(description = "经办法院") - private String court; - - @Schema(description = "公开日期") - private String publicDate; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - @QueryField(type = QueryType.EQ) - private Integer companyId; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBranchImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBranchImportParam.java deleted file mode 100644 index 01c72c3..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditBranchImportParam.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 分支机构导入参数 - */ -@Data -public class CreditBranchImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "分支机构名称") - private String name; - - @Excel(name = "负责人") - private String curator; - - @Excel(name = "地区") - private String region; - - @Excel(name = "成立日期") - private String establishDate; - - @Excel(name = "状态") - private String statusText; - - @Excel(name = "备注") - private String comments; -} - diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBranchParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBranchParam.java deleted file mode 100644 index 3e24a08..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditBranchParam.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分支机构查询参数 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditBranchParam对象", description = "分支机构查询参数") -public class CreditBranchParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "分支机构名称") - private String name; - - @Schema(description = "负责人") - private String curator; - - @Schema(description = "地区") - private String region; - - @Schema(description = "链接") - private String url; - - @Schema(description = "成立日期") - private String establishDate; - - @Schema(description = "状态") - private String statusText; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - @QueryField(type = QueryType.EQ) - private Integer companyId; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java deleted file mode 100644 index e90f364..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditBreachOfTrustImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "数据类型") - private String dataType; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "失信被执行人") - private String plaintiffAppellant; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant2; - - @Excel(name = "疑似申请执行人") - private String appellee; - - @Excel(name = "被告/被上诉人") - private String appellee2; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "涉案金额(元)") - private String involvedAmount; - - @Excel(name = "涉案金额") - private String involvedAmount2; - - @Excel(name = "执行法院") - private String courtName; - - @Excel(name = "法院") - private String courtName2; - - @Excel(name = "立案日期") - private String occurrenceTime; - - @Excel(name = "发生时间") - private String occurrenceTime2; - - @Excel(name = "发布日期") - private String releaseDate; - - @Excel(name = "备注") - private String comments; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustParam.java deleted file mode 100644 index 57b340f..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustParam.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 失信被执行人查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:46:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditBreachOfTrustParam对象", description = "失信被执行人查询参数") -public class CreditBreachOfTrustParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "失信被执行人") - private String plaintiffAppellant; - - @Schema(description = "疑似申请执行人") - private String appellee; - - @Schema(description = "涉案金额(元)") - private String involvedAmount; - - @Schema(description = "执行法院") - private String courtName; - - @Schema(description = "立案日期") - private String occurrenceTime; - - @Schema(description = "发布日期") - private String releaseDate; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingImportParam.java deleted file mode 100644 index 517f455..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingImportParam.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditCaseFilingImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "数据类型") - private String dataType; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant; - - @Excel(name = "被告/被上诉人") - private String appellee; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "案由") - private String causeOfAction; - - @Excel(name = "当事人") - private String otherPartiesThirdParty; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty2; - - @Excel(name = "法院") - private String courtName; - - @Excel(name = "执行法院") - private String courtName2; - - @Excel(name = "立案日期") - private String occurrenceTime; - - @Excel(name = "发生时间") - private String occurrenceTime2; - - @Excel(name = "涉案金额") - private String involvedAmount; - - @Excel(name = "涉案金额(元)") - private String involvedAmount2; - - @Excel(name = "备注") - private String comments; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingParam.java deleted file mode 100644 index d9b8c60..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingParam.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 司法大数据查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:47:22 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditCaseFilingParam对象", description = "司法大数据查询参数") -public class CreditCaseFilingParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "数据类型") - private String dataType; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "发生时间") - private String occurrenceTime; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "项目网址") - private String url; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java deleted file mode 100644 index 9db4d95..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 企业导入参数 - * - * @author 科技小王子 - * @since 2025-12-15 - */ -@Data -public class CreditCompanyImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "原文件导入名称") - private String name; - - @Excel(name = "系统匹配企业名称") - private String matchName; - - @Excel(name = "统一社会信用代码") - private String code; - - @Excel(name = "登记状态") - private String registrationStatus; - - @Excel(name = "法定代表人") - private String legalPerson; - - @Excel(name = "注册资本") - private String registeredCapital; - - @Excel(name = "实缴资本") - private String paidinCapital; - - @Excel(name = "成立日期") - private String establishDate; - - @Excel(name = "企业地址") - private String address; - - @Excel(name = "电话") - private String tel; - - @Excel(name = "更多电话") - private String moreTel; - - @Excel(name = "邮箱") - private String email; - - @Excel(name = "更多邮箱") - private String moreEmail; - - @Excel(name = "所在国家") - private String country; - - @Excel(name = "所属省份") - private String province; - - @Excel(name = "所属城市") - private String city; - - @Excel(name = "所属区县") - private String region; - - @Excel(name = "企业(机构)类型") - private String institutionType; - - @Excel(name = "纳税人识别号") - private String taxpayerCode; - - @Excel(name = "注册号") - private String registrationNumber; - - @Excel(name = "组织机构代码") - private String organizationalCode; - - @Excel(name = "参保人数") - private String numberOfInsuredPersons; - - @Excel(name = "参保人数所属年报") - private String annualReport; - - @Excel(name = "营业期限") - private String businessTerm; - - @Excel(name = "国标行业门类") - private String nationalStandardIndustryCategories; - - @Excel(name = "国标行业大类") - private String nationalStandardIndustryCategories2; - - @Excel(name = "国标行业中类") - private String nationalStandardIndustryCategories3; - - @Excel(name = "国标行业小类") - private String nationalStandardIndustryCategories4; - - @Excel(name = "企查查行业门类") - private String nationalStandardIndustryCategories5; - - @Excel(name = "企查查行业大类") - private String nationalStandardIndustryCategories6; - - @Excel(name = "企查查行业中类") - private String nationalStandardIndustryCategories7; - - @Excel(name = "企查查行业小类") - private String nationalStandardIndustryCategories8; - - @Excel(name = "企业规模") - private String companySize; - - @Excel(name = "曾用名") - private String formerName; - - @Excel(name = "英文名") - private String englishName; - - @Excel(name = "官网") - private String domain; - - @Excel(name = "通信地址") - private String mailingAddress; - - @Excel(name = "企业简介") - private String companyProfile; - - @Excel(name = "经营范围") - private String natureOfBusiness; - - @Excel(name = "登记机关") - private String registrationAuthority; - - @Excel(name = "纳税人资质") - private String taxpayerQualification; - - @Excel(name = "最新年报年份") - private String latestAnnualReportYear; - - @Excel(name = "最新年报营业收入") - private String latestAnnualReportOnOperatingRevenue; - - @Excel(name = "企查分") - private String enterpriseScoreCheck; - - @Excel(name = "信用等级") - private String creditRating; - - @Excel(name = "科创分") - private String cechnologyScore; - - @Excel(name = "科创等级") - private String cechnologyLevel; - - @Excel(name = "是否小微企业") - private String smallEnterprise; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java deleted file mode 100644 index 0d2e969..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 企业查询参数 - * - * @author 科技小王子 - * @since 2025-12-17 08:28:02 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditCompanyParam对象", description = "企业查询参数") -public class CreditCompanyParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "原文件导入名称") - private String name; - - @Schema(description = "系统匹配企业名称") - private String matchName; - - @Schema(description = "统一社会信用代码") - private String code; - - @Schema(description = "类型") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "是否客户") - @QueryField(type = QueryType.EQ) - private Integer isCustomer; - - @Schema(description = "上级id, 0是顶级") - @QueryField(type = QueryType.EQ) - private Integer parentId; - - @Schema(description = "登记状态") - private String registrationStatus; - - @Schema(description = "法定代表人") - private String legalPerson; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "实缴资本") - private String paidinCapital; - - @Schema(description = "成立日期") - private String establishDate; - - @Schema(description = "企业地址") - private String address; - - @Schema(description = "电话") - private String tel; - - @Schema(description = "更多电话") - private String moreTel; - - @Schema(description = "邮箱") - private String email; - - @Schema(description = "更多邮箱") - private String moreEmail; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所属省份") - private String province; - - @Schema(description = "所属城市") - private String city; - - @Schema(description = "所属区县") - private String region; - - @Schema(description = "企业(机构)类型") - private String institutionType; - - @Schema(description = "纳税人识别号") - private String taxpayerCode; - - @Schema(description = "注册号") - private String registrationNumber; - - @Schema(description = "组织机构代码") - private String organizationalCode; - - @Schema(description = "参保人数") - private String numberOfInsuredPersons; - - @Schema(description = "参保人数所属年报") - private String annualReport; - - @Schema(description = "营业期限") - private String businessTerm; - - @Schema(description = "国标行业门类") - private String nationalStandardIndustryCategories; - - @Schema(description = "国标行业大类") - private String nationalStandardIndustryCategories2; - - @Schema(description = "国标行业中类") - private String nationalStandardIndustryCategories3; - - @Schema(description = "国标行业小类") - private String nationalStandardIndustryCategories4; - - @Schema(description = "企查查行业门类") - private String nationalStandardIndustryCategories5; - - @Schema(description = "企查查行业大类") - private String nationalStandardIndustryCategories6; - - @Schema(description = "企查查行业中类") - private String nationalStandardIndustryCategories7; - - @Schema(description = "企查查行业小类") - private String nationalStandardIndustryCategories8; - - @Schema(description = "企业规模") - private String companySize; - - @Schema(description = "曾用名") - private String formerName; - - @Schema(description = "英文名") - private String englishName; - - @Schema(description = "官网") - private String domain; - - @Schema(description = "通信地址") - private String mailingAddress; - - @Schema(description = "企业简介") - private String companyProfile; - - @Schema(description = "经营范围") - private String natureOfBusiness; - - @Schema(description = "登记机关") - private String registrationAuthority; - - @Schema(description = "纳税人资质") - private String taxpayerQualification; - - @Schema(description = "最新年报年份") - private String latestAnnualReportYear; - - @Schema(description = "最新年报营业收入") - private String latestAnnualReportOnOperatingRevenue; - - @Schema(description = "企查分") - private String enterpriseScoreCheck; - - @Schema(description = "信用等级") - private String creditRating; - - @Schema(description = "科创分") - private String cechnologyScore; - - @Schema(description = "科创等级") - private String cechnologyLevel; - - @Schema(description = "是否小微企业") - private String smallEnterprise; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorImportParam.java deleted file mode 100644 index 33a4066..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorImportParam.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 竞争对手导入参数 - */ -@Data -public class CreditCompetitorImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "企业名称") - private String name; - - @Excel(name = "法定代表人") - private String legalRepresentative; - - @Excel(name = "注册资本") - private String registeredCapital; - - @Excel(name = "成立日期") - private String establishmentDate; - - @Excel(name = "登记状态") - private String registrationStatus; - - @Excel(name = "所属行业") - private String industry; - - @Excel(name = "所属省份") - private String province; - - @Excel(name = "备注") - private String comments; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorParam.java deleted file mode 100644 index d265914..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorParam.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 竞争对手查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:04 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditCompetitorParam对象", description = "竞争对手查询参数") -public class CreditCompetitorParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "序号") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "企业名称") - private String name; - - @Schema(description = "法定代表人") - private String legalRepresentative; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "成立日期") - private String establishmentDate; - - @Schema(description = "登记状态") - private String registrationStatus; - - @Schema(description = "所属行业") - private String industry; - - @Schema(description = "所属省份") - private String province; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementImportParam.java deleted file mode 100644 index 42362b9..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementImportParam.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.gxwebsoft.credit.excel.ExcelHeaderAlias; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditCourtAnnouncementImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "案由") - private String causeOfAction; - - @Excel(name = "当事人") - private String otherPartiesThirdParty; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty2; - - @Excel(name = "公告类型") - private String dataType; - - @Excel(name = "数据类型") - private String dataType2; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant; - - @Excel(name = "原告/上诉人2") - private String plaintiffAppellant2; - - @Excel(name = "被告/被上诉人") - private String appellee; - - @Excel(name = "涉案金额") - private String involvedAmount; - - @Excel(name = "涉案金额(元)") - private String involvedAmount2; - - @Excel(name = "法院") - @ExcelHeaderAlias({"公告人","执行法院"}) - private String courtName; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "刊登日期") - private String occurrenceTime; - - @Excel(name = "发生时间") - private String occurrenceTime2; - - @Excel(name = "备注") - private String comments; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementParam.java deleted file mode 100644 index 177a51b..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementParam.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 法院公告司法大数据查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditCourtAnnouncementParam对象", description = "法院公告司法大数据查询参数") -public class CreditCourtAnnouncementParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "数据类型") - private String dataType; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "发生时间") - private String occurrenceTime; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionImportParam.java deleted file mode 100644 index 7d31b72..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionImportParam.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditCourtSessionImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "数据类型") - private String dataType; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant; - - @Excel(name = "被告/被上诉人") - private String appellee; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Excel(name = "发生时间") - private String occurrenceTime; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "案由") - private String causeOfAction; - - @Excel(name = "涉案金额") - private String involvedAmount; - - @Excel(name = "法院") - private String courtName; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "开庭时间") - private String occurrenceTime2; - - @Excel(name = "涉案金额(元)") - private String involvedAmount2; - - @Excel(name = "当事人") - private String otherPartiesThirdParty2; - - @Excel(name = "备注") - private String comments; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionParam.java deleted file mode 100644 index cf8a5f9..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionParam.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 开庭公告司法大数据查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:32 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditCourtSessionParam对象", description = "开庭公告司法大数据查询参数") -public class CreditCourtSessionParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "数据类型") - private String dataType; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "发生时间") - private String occurrenceTime; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCustomerImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCustomerImportParam.java deleted file mode 100644 index 1a06637..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCustomerImportParam.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 客户导入参数 - */ -@Data -public class CreditCustomerImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "客户") - private String name; - - @Excel(name = "状态") - private String statusTxt; - - @Excel(name = "销售金额(万元)") - private String price; - - @Excel(name = "公开日期") - private String publicDate; - - @Excel(name = "数据来源") - private String dataSource; - - @Excel(name = "备注") - private String comments; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCustomerParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCustomerParam.java deleted file mode 100644 index 1046bba..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditCustomerParam.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 客户查询参数 - * - * @author 科技小王子 - * @since 2025-12-21 21:20:57 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditCustomerParam对象", description = "客户查询参数") -public class CreditCustomerParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "客户") - private String name; - - @Schema(description = "状态") - private String statusTxt; - - @Schema(description = "销售金额(万元)") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "公开日期") - private String publicDate; - - @Schema(description = "数据来源") - private String dataSource; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeImportParam.java deleted file mode 100644 index 214e1a7..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeImportParam.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditDeliveryNoticeImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "数据类型") - private String dataType; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant; - - @Excel(name = "被告/被上诉人") - private String appellee; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "涉案金额") - private String involvedAmount; - - @Excel(name = "涉案金额(元)") - private String involvedAmount2; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "案由") - private String causeOfAction; - - @Excel(name = "当事人") - private String otherPartiesThirdParty; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty2; - - @Excel(name = "法院") - private String courtName; - - @Excel(name = "执行法院") - private String courtName2; - - @Excel(name = "发布日期") - private String occurrenceTime; - - @Excel(name = "发生时间") - private String occurrenceTime2; - - @Excel(name = "备注") - private String comments; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeParam.java deleted file mode 100644 index 161d039..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeParam.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 送达公告司法大数据查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:51 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditDeliveryNoticeParam对象", description = "送达公告司法大数据查询参数") -public class CreditDeliveryNoticeParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "当事人") - private String otherPartiesThirdParty; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "发布日期") - private String occurrenceTime; - - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditExternalImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditExternalImportParam.java deleted file mode 100644 index 7c51764..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditExternalImportParam.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.gxwebsoft.credit.excel.ExcelHeaderAlias; -import lombok.Data; - -import java.io.Serializable; - -/** - * 对外投资导入参数 - */ -@Data -public class CreditExternalImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "被投资企业名称") - private String name; - - @Excel(name = "状态") - private String statusTxt; - - @Excel(name = "法定代表人") - private String legalRepresentative; - - @Excel(name = "注册资本") - private String registeredCapital; - - @Excel(name = "成立日期") - private String establishmentDate; - - @Excel(name = "持股比例") - private String shareholdingRatio; - - @Excel(name = "认缴出资额") - @ExcelHeaderAlias({"认缴出资额/持股数"}) - private String subscribedInvestmentAmount; - - @Excel(name = "认缴出资日期") - private String subscribedInvestmentDate; - - @Excel(name = "间接持股比例") - private String indirectShareholdingRatio; - - @Excel(name = "投资日期") - private String investmentDate; - - @Excel(name = "所属地区") - private String region; - - @Excel(name = "所属行业") - private String industry; - - @Excel(name = "投资数量") - private Integer investmentCount; - - @Excel(name = "关联产品/机构") - private String relatedProductsInstitutions; - - @Excel(name = "备注") - private String comments; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditExternalParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditExternalParam.java deleted file mode 100644 index 4a12707..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditExternalParam.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 对外投资查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:11 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditExternalParam对象", description = "对外投资查询参数") -public class CreditExternalParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "被投资企业名称") - private String name; - - @Schema(description = "企业状态(如存续、注销等)") - private String statusTxt; - - @Schema(description = "法定代表人姓名") - private String legalRepresentative; - - @Schema(description = "注册资本(金额)") - private String registeredCapital; - - @Schema(description = "成立日期") - private String establishmentDate; - - @Schema(description = "持股比例") - private String shareholdingRatio; - - @Schema(description = "认缴出资额") - private String subscribedInvestmentAmount; - - @Schema(description = "认缴出资日期") - private String subscribedInvestmentDate; - - @Schema(description = "间接持股比例") - private String indirectShareholdingRatio; - - @Schema(description = "投资日期") - private String investmentDate; - - @Schema(description = "所属地区") - private String region; - - @Schema(description = "所属行业") - private String industry; - - @Schema(description = "投资数量") - @QueryField(type = QueryType.EQ) - private Integer investmentCount; - - @Schema(description = "关联产品/机构") - private String relatedProductsInstitutions; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionImportParam.java deleted file mode 100644 index 4aea1d7..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionImportParam.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditFinalVersionImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "被执行人") - private String appellee; - - @Excel(name = "被告/被上诉人") - private String appellee2; - - @Excel(name = "疑似申请执行人") - private String plaintiffAppellant; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant2; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Excel(name = "当事人") - private String otherPartiesThirdParty2; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "未履行金额(元)") - private String unfulfilledAmount; - - @Excel(name = "执行标的(元)") - private String involvedAmount; - - @Excel(name = "涉案金额") - private String involvedAmount2; - - @Excel(name = "执行法院") - private String courtName; - - @Excel(name = "法院") - private String courtName2; - - @Excel(name = "立案日期") - private String occurrenceTime; - - @Excel(name = "发生时间") - private String occurrenceTime2; - - @Excel(name = "终本日期") - private String finalDate; - - @Excel(name = "备注") - private String comments; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionParam.java deleted file mode 100644 index a184197..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionParam.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 终本案件查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:19 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditFinalVersionParam对象", description = "终本案件查询参数") -public class CreditFinalVersionParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "疑似申请执行人") - private String plaintiffAppellant; - - @Schema(description = "未履行金额(元)") - private String unfulfilledAmount; - - @Schema(description = "执行标的(元)") - private String involvedAmount; - - @Schema(description = "执行法院") - private String courtName; - - @Schema(description = "立案日期") - private String occurrenceTime; - - @Schema(description = "终本日期") - private String finalDate; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditGqdjImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditGqdjImportParam.java deleted file mode 100644 index 7d3168e..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditGqdjImportParam.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableField; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 股权冻结导入参数 - */ -@Data -public class CreditGqdjImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "执行通知文书号") - private String caseNumber; - - // Some upstream sources use "案号" instead of "执行通知文书号". - @Excel(name = "案号") - private String caseNumber2; - - @Excel(name = "被执行人") - private String appellee; - - // Some upstream sources use "被执行人名称" as the executed person column. - @Excel(name = "被执行人名称") - private String appellee2; - - @Excel(name = "冻结股权标的企业") - private String plaintiffAppellant; - - // Some upstream sources use "冻结股权标的企业名称" as the target company column. - @Excel(name = "冻结股权标的企业名称") - private String plaintiffAppellant2; - - @Excel(name = "被执行人持有股权、其他投资权益数额") - private String involvedAmount; - - @Excel(name = "执行法院") - private String courtName; - - @Excel(name = "数据状态") - private String dataType; - - @Excel(name = "状态") - private String dataStatus; - - // Some upstream sources use "数据状态" as the status column. - @Excel(name = "数据状态2") - private String dataStatus2; - - @Excel(name = "冻结日期自") - private String freezeDateStart; - - @Excel(name = "冻结日期至") - private String freezeDateEnd; - - @Excel(name = "冻结开始日期") - private String freezeDateStart2; - - @Excel(name = "冻结结束日期") - private String freezeDateEnd2; - - @Excel(name = "公示日期") - private String publicDate; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditGqdjParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditGqdjParam.java deleted file mode 100644 index 1641a42..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditGqdjParam.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 股权冻结查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:37 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditGqdjParam对象", description = "股权冻结查询参数") -public class CreditGqdjParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "执行通知文书号") - private String caseNumber; - - @Schema(description = "被执行人") - private String appellee; - - @Schema(description = "冻结股权标的企业") - private String plaintiffAppellant; - - @Schema(description = "被执行人持有股权、其他投资权益数额") - private String involvedAmount; - - @Schema(description = "执行法院") - private String courtName; - - @Schema(description = "类型") - private String dataType; - - @Schema(description = "状态") - private String dataStatus; - - @Schema(description = "冻结日期自") - private String freezeDateStart; - - @Schema(description = "冻结日期至") - private String freezeDateEnd; - - @Schema(description = "公示日期") - private String publicDate; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonImportParam.java deleted file mode 100644 index 19182f5..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonImportParam.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 历史法定代表人导入参数 - */ -@Data -public class CreditHistoricalLegalPersonImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "名称") - private String name; - - @Excel(name = "任职日期") - private String registerDate; - - @Excel(name = "卸任日期") - private String publicDate; - - @Excel(name = "备注") - private String comments; -} - diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonParam.java deleted file mode 100644 index 8c94edc..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonParam.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 历史法定代表人查询参数 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditHistoricalLegalPersonParam对象", description = "历史法定代表人查询参数") -public class CreditHistoricalLegalPersonParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "名称") - private String name; - - @Schema(description = "任职日期") - private String registerDate; - - @Schema(description = "卸任日期") - private String publicDate; - - @Schema(description = "链接") - private String url; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - @QueryField(type = QueryType.EQ) - private Integer companyId; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorImportParam.java deleted file mode 100644 index 24a2a2c..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorImportParam.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.gxwebsoft.credit.excel.ExcelHeaderAlias; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 被执行人导入参数 - */ -@Data -public class CreditJudgmentDebtorImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "被执行人名称") - private String name; - - @Excel(name = "被执行人") - private String name1; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant; - - @Excel(name = "被告/被上诉人") - @ExcelHeaderAlias({"被执行人名称"}) - private String appellee; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Excel(name = "证件号/组织机构代码") - private String code; - - @Excel(name = "立案日期") - private String occurrenceTime; - - @Schema(description = "涉案金额") - @Excel(name = "涉案金额") - private String involvedAmount; - - /** - * 兼容企查查“历史被执行人”表头:执行标的(元) - * 注意:模板导出仍以标准字段为主,这里仅用于增强导入兼容性。 - */ - @Excel(name = "执行标的(元)") - private String involvedAmountQcc; - - @Excel(name = "法院") - private String courtName; - - /** - * 兼容企查查“历史被执行人”表头:执行法院 - */ - @Excel(name = "执行法院") - private String courtNameQcc; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "备注") - private String comments; - - @Schema(description = "发生时间") - @Excel(name = "发生时间") - private String occurrenceTime2; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorParam.java deleted file mode 100644 index 6480ced..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorParam.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 被执行人查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:54 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditJudgmentDebtorParam对象", description = "被执行人查询参数") -public class CreditJudgmentDebtorParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "被执行人名称") - private String name; - - @Schema(description = "证件号/组织机构代码") - private String code; - - @Schema(description = "立案日期") - private String occurrenceTime; - - @Schema(description = "执行标的(元)") - @QueryField(type = QueryType.EQ) - private String amount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentImportParam.java deleted file mode 100644 index 5a756fe..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentImportParam.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditJudicialDocumentImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "文书标题") - private String title; - - @Excel(name = "文书类型") - private String documentType; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "案由") - private String causeOfAction; - - @Excel(name = "当事人") - private String otherPartiesThirdParty; - - @Excel(name = "涉案金额") - private String involvedAmount; - - @Excel(name = "案件金额(元)") - private String involvedAmount2; - - @Excel(name = "裁判结果") - private String defendantAppellee; - - @Excel(name = "裁判日期") - private String occurrenceTime; - - @Excel(name = "发布日期") - private String releaseDate; - - @Excel(name = "法院") - private String courtName; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "备注") - private String comments; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentParam.java deleted file mode 100644 index 6415b53..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentParam.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 裁判文书司法大数据查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:02 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditJudicialDocumentParam对象", description = "裁判文书司法大数据查询参数") -public class CreditJudicialDocumentParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "文书标题") - private String title; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "当事人") - private String otherPartiesThirdParty; - - @Schema(description = "案件金额(元)") - private String involvedAmount; - - @Schema(description = "裁判结果") - private String defendantAppellee; - - @Schema(description = "裁判日期") - private String occurrenceTime; - - @Schema(description = "发布日期") - private String releaseDate; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudicialImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudicialImportParam.java deleted file mode 100644 index 35436f7..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditJudicialImportParam.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditJudicialImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "数据类型") - private String dataType; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant; - - @Excel(name = "被告/被上诉人") - private String appellee; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Excel(name = "发生时间") - private String occurrenceTime; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "案由") - private String causeOfAction; - - @Excel(name = "涉案金额") - private String involvedAmount; - - @Excel(name = "法院") - private String courtName; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "备注") - private String comments; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryImportParam.java deleted file mode 100644 index 4c08656..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryImportParam.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 招投标信息导入参数 - * - * @author 科技小王子 - * @since 2025-12-15 - */ -@Data -public class CreditJudiciaryImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "案件名称") - private String name; - - @Excel(name = "案件类型") - private String infoType; - - @Excel(name = "案由") - private String reason; - - @Excel(name = "进程日期") - private String processDate; - - @Excel(name = "案件进程") - private String caseProgress; - - @Excel(name = "案件身份") - private String caseIdentity; - - @Excel(name = "案号") - private String code; - - @Excel(name = "法院") - private String court; - - @Excel(name = "案件金额(元)") - private String caseAmount; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryParam.java deleted file mode 100644 index 295cc75..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryParam.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 司法案件查询参数 - * - * @author 科技小王子 - * @since 2025-12-16 15:23:57 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditJudiciaryParam对象", description = "司法案件查询参数") -public class CreditJudiciaryParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "案件名称") - private String name; - - @Schema(description = "案号") - private String code; - - @Schema(description = "类型, 0普通用户, 1招投标") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "案由") - private String reason; - - @Schema(description = "上级id, 0是顶级") - @QueryField(type = QueryType.EQ) - private Integer parentId; - - @Schema(description = "案件类型") - private String infoType; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "街道地址") - private String address; - - @Schema(description = "案件进程") - private String caseProgress; - - @Schema(description = "案件身份") - private String caseIdentity; - - @Schema(description = "法院") - private String court; - - @Schema(description = "进程日期") - private String processDate; - - @Schema(description = "案件金额(元)") - private String caseAmount; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "到期时间") - private String expirationTime; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditMediationImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditMediationImportParam.java deleted file mode 100644 index 0799e5e..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditMediationImportParam.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditMediationImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "案由") - private String causeOfAction; - - @Excel(name = "当事人") - private String otherPartiesThirdParty; - - @Excel(name = "法院") - private String courtName; - - @Excel(name = "立案日期") - private String occurrenceTime; - - @Excel(name = "备注") - private String comments; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant; - - @Excel(name = "被告/被上诉人") - private String appellee; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "涉案金额") - private String involvedAmount; - - @Excel(name = "发生时间") - private String occurrenceTime2; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty2; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditMediationParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditMediationParam.java deleted file mode 100644 index 4561edd..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditMediationParam.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 诉前调解司法大数据查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:24 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditMediationParam对象", description = "诉前调解司法大数据查询参数") -public class CreditMediationParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "数据类型") - private String dataType; - - @Schema(description = "原告/上诉人") - private String plaintiffAppellant; - - @Schema(description = "被告/被上诉人") - private String appellee; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "发生时间") - private String occurrenceTime; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "涉案金额") - private String involvedAmount; - - @Schema(description = "法院") - private String courtName; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditMpCustomerParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditMpCustomerParam.java deleted file mode 100644 index 4c4c91f..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditMpCustomerParam.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.gxwebsoft.credit.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 小程序端客户查询参数 - * - * @author 科技小王子 - * @since 2026-03-16 20:59:17 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditMpCustomerParam对象", description = "小程序端客户查询参数") -public class CreditMpCustomerParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "拖欠方") - private String toUser; - - @Schema(description = "拖欠金额") - private String price; - - @Schema(description = "拖欠年数") - private String years; - - @Schema(description = "链接") - private String url; - - @Schema(description = "状态") - private String statusTxt; - - @Schema(description = "企业ID") - @QueryField(type = QueryType.EQ) - private Integer companyId; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "文件路径") - private String files; - - @Schema(description = "是否有数据") - @QueryField(type = QueryType.EQ) - private Boolean hasData; - - @Schema(description = "步骤, 0未受理1已受理2材料提交3合同签订4执行回款5完结") - @QueryField(type = QueryType.EQ) - private Integer step; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyImportParam.java deleted file mode 100644 index 7d55a31..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyImportParam.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 附近企业导入参数 - */ -@Data -public class CreditNearbyCompanyImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "企业名称") - private String name; - - @Excel(name = "登记状态") - private String registrationStatus; - - @Excel(name = "法定代表人") - private String legalPerson; - - @Excel(name = "注册资本") - private String registeredCapital; - - @Excel(name = "实缴资本") - private String paidinCapital; - - @Excel(name = "成立日期") - private String establishDate; - - @Excel(name = "统一社会信用代码") - private String code; - - @Excel(name = "注册地址") - private String address; - - @Excel(name = "有效手机号") - private String phone; - - @Excel(name = "邮箱") - private String email; - - @Excel(name = "更多邮箱") - private String moreEmail; - - @Excel(name = "所属省份") - private String province; - - @Excel(name = "所属城市") - private String city; - - @Excel(name = "所属区县") - private String region; - - @Excel(name = "纳税人识别号") - private String taxpayerCode; - - @Excel(name = "注册号") - private String registrationNumber; - - @Excel(name = "组织机构代码") - private String organizationalCode; - - @Excel(name = "参保人数") - private String numberOfInsuredPersons; - - @Excel(name = "参保人数所属年报") - private String annualReport; - - @Excel(name = "营业期限") - private String businessTerm; - - @Excel(name = "国标行业门类") - private String nationalStandardIndustryCategories; - - @Excel(name = "国标行业大类") - private String nationalStandardIndustryCategories2; - - @Excel(name = "国标行业中类") - private String nationalStandardIndustryCategories3; - - @Excel(name = "国标行业小类") - private String nationalStandardIndustryCategories4; - - @Excel(name = "曾用名") - private String formerName; - - @Excel(name = "英文名") - private String englishName; - - @Excel(name = "官网网址") - private String domain; - - @Excel(name = "通信地址") - private String mailingAddress; - - @Excel(name = "通信地址邮编") - private String mailingEmail; - - @Excel(name = "注册地址邮编") - private String postalCode; - - @Excel(name = "电话") - private String tel; - - @Excel(name = "更多电话") - private String moreTel; - - @Excel(name = "企查查行业门类") - private String nationalStandardIndustryCategories5; - - @Excel(name = "企查查行业大类") - private String nationalStandardIndustryCategories6; - - @Excel(name = "企查查行业中类") - private String nationalStandardIndustryCategories7; - - @Excel(name = "企查查行业小类") - private String nationalStandardIndustryCategories8; - - @Excel(name = "类型") - private Integer type; - - @Excel(name = "登记机关") - private String registrationAuthority; - - @Excel(name = "纳税人资质") - private String taxpayerQualification; - - @Excel(name = "最新年报年份") - private String latestAnnualReportYear; - - @Excel(name = "最新年报营业收入") - private String latestAnnualReportOnOperatingRevenue; - - @Excel(name = "企查分") - private String enterpriseScoreCheck; - - @Excel(name = "信用等级") - private String creditRating; - - @Excel(name = "科创分") - private String cechnologyScore; - - @Excel(name = "科创等级") - private String cechnologyLevel; - - @Excel(name = "是否小微企业") - private String smallEnterprise; - - @Excel(name = "企业(机构)类型") - private String institutionType; - - @Excel(name = "企业规模") - private String companySize; - - @Excel(name = "企业简介") - private String companyProfile; - - @Excel(name = "经营范围") - private String natureOfBusiness; - - @Excel(name = "备注") - private String comments; -} - diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyParam.java deleted file mode 100644 index f2ba839..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyParam.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 附近企业查询参数 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditNearbyCompanyParam对象", description = "附近企业查询参数") -public class CreditNearbyCompanyParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "企业名称") - private String name; - - @Schema(description = "登记状态") - private String registrationStatus; - - @Schema(description = "法定代表人") - private String legalPerson; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "成立日期") - private String establishDate; - - @Schema(description = "统一社会信用代码") - private String code; - - @Schema(description = "注册地址") - private String address; - - @Schema(description = "注册地址邮编") - private String postalCode; - - @Schema(description = "有效手机号") - private String phone; - - @Schema(description = "更多电话") - private String moreTel; - - @Schema(description = "邮箱") - private String email; - - @Schema(description = "邮箱") - private String moreEmail; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所属省份") - private String province; - - @Schema(description = "所属城市") - private String city; - - @Schema(description = "所属区县") - private String region; - - @Schema(description = "企业ID") - @QueryField(type = QueryType.EQ) - private String companyId; - - @Schema(description = "纳税人识别号") - private String taxpayerCode; - - @Schema(description = "注册号") - private String registrationNumber; - - @Schema(description = "组织机构代码") - private String organizationalCode; - - @Schema(description = "参保人数") - private String numberOfInsuredPersons; - - @Schema(description = "参保人数所属年报") - private String annualReport; - - @Schema(description = "企业(机构)类型") - private String institutionType; - - @Schema(description = "企业规模") - private String companySize; - - @Schema(description = "营业期限") - private String businessTerm; - - @Schema(description = "国标行业门类") - private String nationalStandardIndustryCategories; - - @Schema(description = "国标行业大类") - private String nationalStandardIndustryCategories2; - - @Schema(description = "国标行业中类") - private String nationalStandardIndustryCategories3; - - @Schema(description = "国标行业小类") - private String nationalStandardIndustryCategories4; - - @Schema(description = "曾用名") - private String formerName; - - @Schema(description = "英文名") - private String englishName; - - @Schema(description = "官网网址") - private String domain; - - @Schema(description = "通信地址") - private String mailingAddress; - - @Schema(description = "通信地址邮箱") - private String mailingEmail; - - @Schema(description = "企业简介") - private String companyProfile; - - @Schema(description = "经营范围") - private String natureOfBusiness; - - @Schema(description = "电话") - private String tel; - - @Schema(description = "企查查行业门类") - private String nationalStandardIndustryCategories5; - - @Schema(description = "企查查行业大类") - private String nationalStandardIndustryCategories6; - - @Schema(description = "企查查行业中类") - private String nationalStandardIndustryCategories7; - - @Schema(description = "企查查行业小类") - private String nationalStandardIndustryCategories8; - - @Schema(description = "链接") - private String url; - - @Schema(description = "类型") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "上级id, 0是顶级") - @QueryField(type = QueryType.EQ) - private Integer parentId; - - @Schema(description = "实缴资本") - private String paidinCapital; - - @Schema(description = "登记机关") - private String registrationAuthority; - - @Schema(description = "纳税人资质") - private String taxpayerQualification; - - @Schema(description = "最新年报年份") - private String latestAnnualReportYear; - - @Schema(description = "最新年报营业收入") - private String latestAnnualReportOnOperatingRevenue; - - @Schema(description = "企查分") - private String enterpriseScoreCheck; - - @Schema(description = "信用等级") - private String creditRating; - - @Schema(description = "科创分") - private String cechnologyScore; - - @Schema(description = "科创等级") - private String cechnologyLevel; - - @Schema(description = "是否小微企业") - private String smallEnterprise; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditPatentImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditPatentImportParam.java deleted file mode 100644 index 34e2777..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditPatentImportParam.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 专利导入参数 - */ -@Data -public class CreditPatentImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "发明名称") - private String name; - - @Excel(name = "专利类型") - private String type; - - @Excel(name = "法律状态") - private String statusText; - - @Excel(name = "申请号") - private String registerNo; - - @Excel(name = "申请日") - private String registerDate; - - @Excel(name = "公开(公告)号") - private String publicNo; - - @Excel(name = "公开(公告)日期") - private String publicDate; - - @Excel(name = "发明人") - private String inventor; - - @Excel(name = "申请(专利权)人") - private String patentApplicant; - - @Excel(name = "备注") - private String comments; -} - diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditPatentParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditPatentParam.java deleted file mode 100644 index ae3cd27..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditPatentParam.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 专利查询参数 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditPatentParam对象", description = "专利查询参数") -public class CreditPatentParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "发明名称") - private String name; - - @Schema(description = "专利类型") - private String type; - - @Schema(description = "法律状态") - private String statusText; - - @Schema(description = "申请号") - private String registerNo; - - @Schema(description = "申请日") - private String registerDate; - - @Schema(description = "公开(公告)号") - private String publicNo; - - @Schema(description = "公开(公告)日期") - private String publicDate; - - @Schema(description = "发明人") - private String inventor; - - @Schema(description = "申请(专利权)人") - private String patentApplicant; - - @Schema(description = "链接") - private String url; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - @QueryField(type = QueryType.EQ) - private Integer companyId; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationImportParam.java deleted file mode 100644 index b2a8ff3..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationImportParam.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 风险关系导入参数 - */ -@Data -public class CreditRiskRelationImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "主体名称") - private String mainBodyName; - - @Excel(name = "登记状态") - private String registrationStatus; - - @Excel(name = "注册资本") - private String registeredCapital; - - @Excel(name = "省份地区") - private String provinceRegion; - - @Excel(name = "关联关系") - private String associatedRelation; - - @Excel(name = "风险关系") - private String riskRelation; - - @Excel(name = "备注") - private String comments; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationParam.java deleted file mode 100644 index 6ff4f44..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationParam.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 风险关系表查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:40 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditRiskRelationParam对象", description = "风险关系表查询参数") -public class CreditRiskRelationParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "序号") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "主体名称") - private String mainBodyName; - - @Schema(description = "登记状态") - private String registrationStatus; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "省份地区") - private String provinceRegion; - - @Schema(description = "关联关系") - private String associatedRelation; - - @Schema(description = "风险关系") - private String riskRelation; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditSupplierImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditSupplierImportParam.java deleted file mode 100644 index 45ff9c0..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditSupplierImportParam.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 供应商导入参数 - */ -@Data -public class CreditSupplierImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "供应商") - private String supplier; - - @Excel(name = "状态") - private String statusTxt; - - @Excel(name = "采购金额(万元)") - private String purchaseAmount; - - @Excel(name = "公开日期") - private String publicDate; - - @Excel(name = "数据来源") - private String dataSource; - - @Excel(name = "备注") - private String comments; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditSupplierParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditSupplierParam.java deleted file mode 100644 index a2f646d..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditSupplierParam.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 供应商查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:47 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditSupplierParam对象", description = "供应商查询参数") -public class CreditSupplierParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "供应商") - private String supplier; - - @Schema(description = "状态") - private String statusTxt; - - @Schema(description = "采购金额(万元)") - private String purchaseAmount; - - @Schema(description = "公开日期") - private String publicDate; - - @Schema(description = "数据来源") - private String dataSource; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipImportParam.java deleted file mode 100644 index 575e6fd..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipImportParam.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; - -/** - * 疑似关系导入参数 - */ -@Data -public class CreditSuspectedRelationshipImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "企业名称") - private String name; - - @Excel(name = "状态") - private String statusText; - - @Excel(name = "法定代表人") - private String legalPerson; - - @Excel(name = "注册资本") - private String registeredCapital; - - @Excel(name = "成立日期") - private String createDate; - - @Excel(name = "关联方") - private String relatedParty; - - @Excel(name = "疑似关系类型") - private String type; - - @Excel(name = "疑似关系详情") - private String detail; - - @Excel(name = "备注") - private String comments; -} - diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipParam.java deleted file mode 100644 index ee87cef..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipParam.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 疑似关系查询参数 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditSuspectedRelationshipParam对象", description = "疑似关系查询参数") -public class CreditSuspectedRelationshipParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "企业名称") - private String name; - - @Schema(description = "状态") - private String statusText; - - @Schema(description = "法定代表人") - private String legalPerson; - - @Schema(description = "注册资本") - private String registeredCapital; - - @Schema(description = "成立日期") - private String createDate; - - @Schema(description = "关联方") - private String relatedParty; - - @Schema(description = "疑似关系类型") - private String type; - - @Schema(description = "疑似关系详情") - private String detail; - - @Schema(description = "链接") - private String url; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "企业ID") - @QueryField(type = QueryType.EQ) - private Integer companyId; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditUserImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditUserImportParam.java deleted file mode 100644 index f1f39c7..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditUserImportParam.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.gxwebsoft.credit.excel.ExcelHeaderAlias; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 招投标信息导入参数 - * - * @author 科技小王子 - * @since 2025-12-15 - */ -@Data -public class CreditUserImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "项目名称") - private String name; - - @Excel(name = "发布日期") - private String releaseDate; - - @Excel(name = "序号") - private String code; - - @Excel(name = "类型", replace = {"普通用户_0", "招投标_1"}) - private Integer type; - - @Excel(name = "企业角色") - private String role; - - @Excel(name = "上级ID") - private Integer parentId; - - @Excel(name = "信息类型") - private String infoType; - -// @Excel(name = "所在国家") -// private String country; - -// @Excel(name = "所在省份") -// private String province; - -// @Excel(name = "所在城市") -// private String city; - -// @Excel(name = "所在辖区") -// private String region; - - @Excel(name = "省份地区") - private String address; - - @Excel(name = "招采单位") - private String procurementName; - - @Excel(name = "中标单位") - @ExcelHeaderAlias({"中标单位(最多展示50家)"}) - private String winningName; - - @Excel(name = "中标金额") - private String winningPrice; - - @Excel(name = "原告/上诉人") - private String plaintiffAppellant; - -// @Excel(name = "备注") -// private String comments; -// -// @Excel(name = "是否推荐", replace = {"否_0", "是_1"}) -// private Integer recommend; - -// @Excel(name = "到期时间", format = "yyyy-MM-dd HH:mm:ss") -// private String expirationTime; - -// @Excel(name = "排序") -// private Integer sortNumber; -// -// @Excel(name = "状态", replace = {"正常_0", "冻结_1"}) -// private Integer status; - -// @Excel(name = "用户ID") -// private Integer userId; -// -// @Excel(name = "租户ID") -// private Integer tenantId; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditUserParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditUserParam.java deleted file mode 100644 index 202b88f..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditUserParam.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.gxwebsoft.credit.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 招投标信息表查询参数 - * - * @author 科技小王子 - * @since 2025-12-15 13:16:03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditUserParam对象", description = "招投标信息表查询参数") -public class CreditUserParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "项目名称") - private String name; - - @Schema(description = "唯一标识") - private String code; - - @Schema(description = "类型, 0普通用户, 1招投标") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "企业角色") - private String role; - - @Schema(description = "上级id, 0是顶级") - @QueryField(type = QueryType.EQ) - private Integer parentId; - - @Schema(description = "信息类型") - private String infoType; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "街道地址") - private String address; - - @Schema(description = "招采单位名称") - private String procurementName; - - @Schema(description = "中标单位名称") - private String winningName; - - @Schema(description = "中标单位名称") - private String winningPrice; - - @Schema(description = "发布日期") - private String releaseDate; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "到期时间") - private String expirationTime; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "申请人") - private String plaintiffAppellant; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java deleted file mode 100644 index f47e017..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.gxwebsoft.credit.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.gxwebsoft.credit.excel.ExcelHeaderAlias; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 司法通用导入参数 - */ -@Data -public class CreditXgxfImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "案号") - private String caseNumber; - - @Excel(name = "数据类型") - private String type; - - @Excel(name = "限消令对象") - private String dataType; - - @Excel(name = "原告/上诉人") - @ExcelHeaderAlias({"申请人"}) - private String plaintiffAppellant; - - // Some upstream multi-company exports use "申请执行人" instead of "原告/上诉人". - @Excel(name = "申请执行人") - private String plaintiffAppellant2; - - @Excel(name = "被告/被上诉人") - private String appellee; - - // Some upstream multi-company exports use "被执行人" instead of "被告/被上诉人". - @Excel(name = "被执行人") - private String appellee2; - - @Excel(name = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Excel(name = "涉案金额") - private String involvedAmount; - - @Excel(name = "发生时间") - private String occurrenceTime; - - @Excel(name = "法院") - private String courtName; - - @Excel(name = "发布日期") - private String releaseDate; - - @Excel(name = "备注") - private String comments; - - @Excel(name = "数据状态") - private String dataStatus; - - @Excel(name = "执行法院") - private String courtName2; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditXgxfParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditXgxfParam.java deleted file mode 100644 index 3934489..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/CreditXgxfParam.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.gxwebsoft.credit.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 限制高消费查询参数 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:54 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "CreditXgxfParam对象", description = "限制高消费查询参数") -public class CreditXgxfParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "案号") - private String caseNumber; - - @Schema(description = "数据类型") - private String type; - - @Schema(description = "限消令对象") - private String dataType; - - @Schema(description = "限制法定代表人") - private String plaintiffAppellant; - - @Schema(description = "申请人") - private String appellee; - - @Schema(description = "涉案金额(元)") - private String involvedAmount; - - @Schema(description = "立案日期") - private String occurrenceTime; - - @Schema(description = "执行法院") - private String courtName; - - @Schema(description = "发布日期") - private String releaseDate; - - @Schema(description = "其他当事人/第三人") - private String otherPartiesThirdParty; - - @Schema(description = "案由") - private String causeOfAction; - - @Schema(description = "数据状态") - private String dataStatus; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/credit/param/EndFollowProcessDTO.java b/src/main/java/com/gxwebsoft/credit/param/EndFollowProcessDTO.java deleted file mode 100644 index 0510829..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/EndFollowProcessDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.gxwebsoft.credit.param; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -/** - * 结束跟进流程DTO - * - * @author 科技小王子 - * @since 2026-03-22 - */ -@Data -@Schema(name = "EndFollowProcessDTO对象", description = "结束跟进流程DTO") -public class EndFollowProcessDTO { - - @Schema(description = "客户ID", required = true) - @NotNull(message = "客户ID不能为空") - private Long customerId; - - @Schema(description = "结束原因") - private String reason; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/FollowStepApprovalDTO.java b/src/main/java/com/gxwebsoft/credit/param/FollowStepApprovalDTO.java deleted file mode 100644 index be06a46..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/FollowStepApprovalDTO.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.gxwebsoft.credit.param; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Min; -import javax.validation.constraints.Max; - -/** - * 跟进步骤审核DTO - * - * @author 科技小王子 - * @since 2026-03-22 - */ -@Data -@Schema(name = "FollowStepApprovalDTO对象", description = "跟进步骤审核DTO") -public class FollowStepApprovalDTO { - - @Schema(description = "客户ID", required = true) - @NotNull(message = "客户ID不能为空") - private Long customerId; - - @Schema(description = "步骤号", required = true, example = "5") - @NotNull(message = "步骤号不能为空") - @Min(value = 1, message = "步骤号最小为1") - @Max(value = 7, message = "步骤号最大为7") - private Integer step; - - @Schema(description = "是否审核通过", required = true) - @NotNull(message = "审核状态不能为空") - private Boolean approved; - - @Schema(description = "审核备注") - private String remark; -} diff --git a/src/main/java/com/gxwebsoft/credit/param/FollowStepQueryDTO.java b/src/main/java/com/gxwebsoft/credit/param/FollowStepQueryDTO.java deleted file mode 100644 index b3bce3a..0000000 --- a/src/main/java/com/gxwebsoft/credit/param/FollowStepQueryDTO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.gxwebsoft.credit.param; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.constraints.Min; -import javax.validation.constraints.Max; - -/** - * 跟进步骤查询DTO - * - * @author 科技小王子 - * @since 2026-03-22 - */ -@Data -@Schema(name = "FollowStepQueryDTO对象", description = "跟进步骤查询DTO") -public class FollowStepQueryDTO { - - @Schema(description = "步骤号", example = "5") - @Min(value = 1, message = "步骤号最小为1") - @Max(value = 7, message = "步骤号最大为7") - private Integer step; - - @Schema(description = "客户ID") - private Long customerId; - - @Schema(description = "用户ID") - private Long userId; -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditAdministrativeLicenseService.java b/src/main/java/com/gxwebsoft/credit/service/CreditAdministrativeLicenseService.java deleted file mode 100644 index d2253e5..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditAdministrativeLicenseService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditAdministrativeLicense; -import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam; - -import java.util.List; - -/** - * 行政许可Service - * - * @author 科技小王子 - * @since 2026-01-07 13:52:13 - */ -public interface CreditAdministrativeLicenseService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditAdministrativeLicenseParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditAdministrativeLicenseParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditAdministrativeLicense - */ - CreditAdministrativeLicense getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditBankruptcyService.java b/src/main/java/com/gxwebsoft/credit/service/CreditBankruptcyService.java deleted file mode 100644 index 3a23584..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditBankruptcyService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditBankruptcy; -import com.gxwebsoft.credit.param.CreditBankruptcyParam; - -import java.util.List; - -/** - * 破产重整Service - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditBankruptcyService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditBankruptcyParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditBankruptcyParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditBankruptcy - */ - CreditBankruptcy getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditBranchService.java b/src/main/java/com/gxwebsoft/credit/service/CreditBranchService.java deleted file mode 100644 index 5cdb363..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditBranchService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditBranch; -import com.gxwebsoft.credit.param.CreditBranchParam; - -import java.util.List; - -/** - * 分支机构Service - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditBranchService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditBranchParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditBranchParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditBranch - */ - CreditBranch getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditBreachOfTrustService.java b/src/main/java/com/gxwebsoft/credit/service/CreditBreachOfTrustService.java deleted file mode 100644 index 57d40dc..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditBreachOfTrustService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditBreachOfTrust; -import com.gxwebsoft.credit.param.CreditBreachOfTrustParam; - -import java.util.List; - -/** - * 失信被执行人Service - * - * @author 科技小王子 - * @since 2025-12-19 19:46:14 - */ -public interface CreditBreachOfTrustService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditBreachOfTrustParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditBreachOfTrustParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditBreachOfTrust - */ - CreditBreachOfTrust getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCaseFilingService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCaseFilingService.java deleted file mode 100644 index 23bb227..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditCaseFilingService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCaseFiling; -import com.gxwebsoft.credit.param.CreditCaseFilingParam; - -import java.util.List; - -/** - * 司法大数据Service - * - * @author 科技小王子 - * @since 2025-12-19 19:47:22 - */ -public interface CreditCaseFilingService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditCaseFilingParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditCaseFilingParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditCaseFiling - */ - CreditCaseFiling getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCompanyRecordCountService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCompanyRecordCountService.java deleted file mode 100644 index 9cd21cc..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditCompanyRecordCountService.java +++ /dev/null @@ -1,130 +0,0 @@ -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 表内的“关联记录数”字段。 - * - *

这些字段是通过统计:credit_company.id = 关联表.company_id(且 deleted=0) 得到。

- */ -@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 companyIds) { - if (type == null || CollectionUtils.isEmpty(companyIds)) { - return; - } - List ids = normalizeCompanyIds(companyIds); - if (ids.isEmpty()) { - return; - } - - // 表/字段名来自固定枚举,不允许外部传入,避免 SQL 注入。 - // - // 这里不要用「UPDATE ... SET col=(SELECT COUNT... WHERE t.company_id=c.id)」的相关子查询: - // 如果关联表缺少 (company_id, deleted) 索引,会导致对每个 company_id 都进行一次全表扫描,极慢, - // 进而容易触发 JDBC/MySQL 侧的超时/断链(Communications link failure)。 - // - // 用聚合后再 JOIN 的方式:每个 chunk 只扫描一次关联表。 - String sql = "" - + "UPDATE credit_company c " - + "LEFT JOIN (" - + " SELECT company_id, COUNT(1) AS cnt " - + " FROM " + type.getSourceTable() + " " - + " WHERE deleted = 0 AND company_id IN (:ids) " - + " GROUP BY company_id" - + ") t ON t.company_id = c.id " - + "SET c." + type.getCompanyColumn() + " = IFNULL(t.cnt, 0) " - + "WHERE c.id IN (:ids)"; - - final int inChunkSize = 500; - for (int i = 0; i < ids.size(); i += inChunkSize) { - List chunk = ids.subList(i, Math.min(ids.size(), i + inChunkSize)); - namedJdbc.update(sql, new MapSqlParameterSource("ids", chunk)); - } - } - - /** - * 刷新全部“记录数”字段(只更新传入 companyIds)。 - */ - public void refreshAll(Collection companyIds) { - if (CollectionUtils.isEmpty(companyIds)) { - return; - } - for (CountType type : CountType.values()) { - refresh(type, companyIds); - } - } - - private static List normalizeCompanyIds(Collection companyIds) { - Set unique = new LinkedHashSet<>(); - for (Integer id : companyIds) { - if (id != null && id > 0) { - unique.add(id); - } - } - return new ArrayList<>(unique); - } -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java deleted file mode 100644 index e96c34e..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.param.CreditCompanyParam; - -import java.util.List; - -/** - * 企业Service - * - * @author 科技小王子 - * @since 2025-12-17 08:28:03 - */ -public interface CreditCompanyService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditCompanyParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditCompanyParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditCompany - */ - CreditCompany getByIdRel(Integer id); - - CreditCompany getByName(String name); - - CreditCompany getByMatchName(String name); -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCompetitorService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCompetitorService.java deleted file mode 100644 index b7612a6..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditCompetitorService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCompetitor; -import com.gxwebsoft.credit.param.CreditCompetitorParam; - -import java.util.List; - -/** - * 竞争对手Service - * - * @author 科技小王子 - * @since 2025-12-19 19:49:05 - */ -public interface CreditCompetitorService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditCompetitorParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditCompetitorParam param); - - /** - * 根据id查询 - * - * @param id 序号 - * @return CreditCompetitor - */ - CreditCompetitor getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCourtAnnouncementService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCourtAnnouncementService.java deleted file mode 100644 index a693994..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditCourtAnnouncementService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCourtAnnouncement; -import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam; - -import java.util.List; - -/** - * 法院公告司法大数据Service - * - * @author 科技小王子 - * @since 2025-12-19 19:49:13 - */ -public interface CreditCourtAnnouncementService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditCourtAnnouncementParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditCourtAnnouncementParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditCourtAnnouncement - */ - CreditCourtAnnouncement getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCourtSessionService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCourtSessionService.java deleted file mode 100644 index 6df519f..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditCourtSessionService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCourtSession; -import com.gxwebsoft.credit.param.CreditCourtSessionParam; - -import java.util.List; - -/** - * 开庭公告司法大数据Service - * - * @author 科技小王子 - * @since 2025-12-19 19:49:32 - */ -public interface CreditCourtSessionService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditCourtSessionParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditCourtSessionParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditCourtSession - */ - CreditCourtSession getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCustomerService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCustomerService.java deleted file mode 100644 index afcafb1..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditCustomerService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCustomer; -import com.gxwebsoft.credit.param.CreditCustomerParam; - -import java.util.List; - -/** - * 客户Service - * - * @author 科技小王子 - * @since 2025-12-21 21:20:58 - */ -public interface CreditCustomerService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditCustomerParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditCustomerParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditCustomer - */ - CreditCustomer getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditDeliveryNoticeService.java b/src/main/java/com/gxwebsoft/credit/service/CreditDeliveryNoticeService.java deleted file mode 100644 index 2398954..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditDeliveryNoticeService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditDeliveryNotice; -import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam; - -import java.util.List; - -/** - * 送达公告司法大数据Service - * - * @author 科技小王子 - * @since 2025-12-19 19:49:51 - */ -public interface CreditDeliveryNoticeService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditDeliveryNoticeParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditDeliveryNoticeParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditDeliveryNotice - */ - CreditDeliveryNotice getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditExternalService.java b/src/main/java/com/gxwebsoft/credit/service/CreditExternalService.java deleted file mode 100644 index c78c895..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditExternalService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditExternal; -import com.gxwebsoft.credit.param.CreditExternalParam; - -import java.util.List; - -/** - * 对外投资Service - * - * @author 科技小王子 - * @since 2025-12-19 19:50:11 - */ -public interface CreditExternalService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditExternalParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditExternalParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditExternal - */ - CreditExternal getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditFinalVersionService.java b/src/main/java/com/gxwebsoft/credit/service/CreditFinalVersionService.java deleted file mode 100644 index b68bb42..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditFinalVersionService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditFinalVersion; -import com.gxwebsoft.credit.param.CreditFinalVersionParam; - -import java.util.List; - -/** - * 终本案件Service - * - * @author 科技小王子 - * @since 2025-12-19 19:50:19 - */ -public interface CreditFinalVersionService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditFinalVersionParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditFinalVersionParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditFinalVersion - */ - CreditFinalVersion getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditGqdjService.java b/src/main/java/com/gxwebsoft/credit/service/CreditGqdjService.java deleted file mode 100644 index 18c7f15..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditGqdjService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditGqdj; -import com.gxwebsoft.credit.param.CreditGqdjParam; - -import java.util.List; - -/** - * 股权冻结Service - * - * @author 科技小王子 - * @since 2025-12-19 19:50:37 - */ -public interface CreditGqdjService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditGqdjParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditGqdjParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditGqdj - */ - CreditGqdj getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditHistoricalLegalPersonService.java b/src/main/java/com/gxwebsoft/credit/service/CreditHistoricalLegalPersonService.java deleted file mode 100644 index 0a309a6..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditHistoricalLegalPersonService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson; -import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam; - -import java.util.List; - -/** - * 历史法定代表人Service - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditHistoricalLegalPersonService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditHistoricalLegalPersonParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditHistoricalLegalPersonParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditHistoricalLegalPerson - */ - CreditHistoricalLegalPerson getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditJudgmentDebtorService.java b/src/main/java/com/gxwebsoft/credit/service/CreditJudgmentDebtorService.java deleted file mode 100644 index f46a36d..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditJudgmentDebtorService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditJudgmentDebtor; -import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam; - -import java.util.List; - -/** - * 被执行人Service - * - * @author 科技小王子 - * @since 2025-12-19 19:50:55 - */ -public interface CreditJudgmentDebtorService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditJudgmentDebtorParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditJudgmentDebtorParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditJudgmentDebtor - */ - CreditJudgmentDebtor getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditJudicialDocumentService.java b/src/main/java/com/gxwebsoft/credit/service/CreditJudicialDocumentService.java deleted file mode 100644 index 56ce04d..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditJudicialDocumentService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditJudicialDocument; -import com.gxwebsoft.credit.param.CreditJudicialDocumentParam; - -import java.util.List; - -/** - * 裁判文书司法大数据Service - * - * @author 科技小王子 - * @since 2025-12-19 19:51:02 - */ -public interface CreditJudicialDocumentService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditJudicialDocumentParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditJudicialDocumentParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditJudicialDocument - */ - CreditJudicialDocument getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditJudiciaryService.java b/src/main/java/com/gxwebsoft/credit/service/CreditJudiciaryService.java deleted file mode 100644 index 122b303..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditJudiciaryService.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditJudiciary; -import com.gxwebsoft.credit.param.CreditJudiciaryParam; - -import java.util.List; - -/** - * 司法案件Service - * - * @author 科技小王子 - * @since 2025-12-16 15:23:58 - */ -public interface CreditJudiciaryService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditJudiciaryParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditJudiciaryParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditJudiciary - */ - CreditJudiciary getByIdRel(Integer id); - - /** - * 根据名称查询 - * - * @param name 名称 - * @return CreditJudiciary - */ - CreditJudiciary getByName(String name); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditMediationService.java b/src/main/java/com/gxwebsoft/credit/service/CreditMediationService.java deleted file mode 100644 index 4870dd8..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditMediationService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditMediation; -import com.gxwebsoft.credit.param.CreditMediationParam; - -import java.util.List; - -/** - * 诉前调解司法大数据Service - * - * @author 科技小王子 - * @since 2025-12-19 19:51:25 - */ -public interface CreditMediationService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditMediationParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditMediationParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditMediation - */ - CreditMediation getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditMpCustomerService.java b/src/main/java/com/gxwebsoft/credit/service/CreditMpCustomerService.java deleted file mode 100644 index 46a90a3..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditMpCustomerService.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditMpCustomer; -import com.gxwebsoft.credit.param.CreditMpCustomerParam; -import com.gxwebsoft.credit.param.BatchFollowStepApprovalDTO; -import com.gxwebsoft.credit.param.EndFollowProcessDTO; -import com.gxwebsoft.credit.param.FollowStepApprovalDTO; -import com.gxwebsoft.credit.param.FollowStepQueryDTO; -import com.gxwebsoft.credit.vo.FollowStatisticsDTO; -import com.gxwebsoft.credit.vo.PendingApprovalStepVO; - -import java.util.List; - -/** - * 小程序端客户Service - * - * @author 科技小王子 - * @since 2026-03-16 20:59:17 - */ -public interface CreditMpCustomerService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditMpCustomerParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditMpCustomerParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditMpCustomer - */ - CreditMpCustomer getByIdRel(Integer id); - - /** - * 审核跟进步骤 - * - * @param dto 审核参数 - */ - void approveFollowStep(FollowStepApprovalDTO dto); - - /** - * 批量审核跟进步骤 - * - * @param dto 批量审核参数 - */ - void batchApproveFollowSteps(BatchFollowStepApprovalDTO dto); - - /** - * 获取待审核的跟进步骤列表 - * - * @param query 查询参数 - * @return 待审核步骤列表 - */ - List getPendingApprovalSteps(FollowStepQueryDTO query); - - /** - * 获取客户跟进统计 - * - * @param customerId 客户ID - * @return 跟进统计信息 - */ - FollowStatisticsDTO getFollowStatistics(Long customerId); - - /** - * 结束客户跟进流程 - * - * @param dto 结束流程参数 - */ - void endFollowProcess(EndFollowProcessDTO dto); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditNearbyCompanyService.java b/src/main/java/com/gxwebsoft/credit/service/CreditNearbyCompanyService.java deleted file mode 100644 index 7622af9..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditNearbyCompanyService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditNearbyCompany; -import com.gxwebsoft.credit.param.CreditNearbyCompanyParam; - -import java.util.List; - -/** - * 附近企业Service - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditNearbyCompanyService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditNearbyCompanyParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditNearbyCompanyParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditNearbyCompany - */ - CreditNearbyCompany getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditPatentService.java b/src/main/java/com/gxwebsoft/credit/service/CreditPatentService.java deleted file mode 100644 index 44d0e99..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditPatentService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditPatent; -import com.gxwebsoft.credit.param.CreditPatentParam; - -import java.util.List; - -/** - * 专利Service - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditPatentService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditPatentParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditPatentParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditPatent - */ - CreditPatent getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditRiskRelationService.java b/src/main/java/com/gxwebsoft/credit/service/CreditRiskRelationService.java deleted file mode 100644 index 141ff83..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditRiskRelationService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditRiskRelation; -import com.gxwebsoft.credit.param.CreditRiskRelationParam; - -import java.util.List; - -/** - * 风险关系表Service - * - * @author 科技小王子 - * @since 2025-12-19 19:51:40 - */ -public interface CreditRiskRelationService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditRiskRelationParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditRiskRelationParam param); - - /** - * 根据id查询 - * - * @param id 序号 - * @return CreditRiskRelation - */ - CreditRiskRelation getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditSupplierService.java b/src/main/java/com/gxwebsoft/credit/service/CreditSupplierService.java deleted file mode 100644 index 469fd34..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditSupplierService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditSupplier; -import com.gxwebsoft.credit.param.CreditSupplierParam; - -import java.util.List; - -/** - * 供应商Service - * - * @author 科技小王子 - * @since 2025-12-19 19:51:47 - */ -public interface CreditSupplierService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditSupplierParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditSupplierParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditSupplier - */ - CreditSupplier getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditSuspectedRelationshipService.java b/src/main/java/com/gxwebsoft/credit/service/CreditSuspectedRelationshipService.java deleted file mode 100644 index f44913d..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditSuspectedRelationshipService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditSuspectedRelationship; -import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam; - -import java.util.List; - -/** - * 疑似关系Service - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -public interface CreditSuspectedRelationshipService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditSuspectedRelationshipParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditSuspectedRelationshipParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditSuspectedRelationship - */ - CreditSuspectedRelationship getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditUserService.java b/src/main/java/com/gxwebsoft/credit/service/CreditUserService.java deleted file mode 100644 index e833256..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditUserService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditUser; -import com.gxwebsoft.credit.param.CreditUserParam; - -import java.util.List; - -/** - * 招投标信息表Service - * - * @author 科技小王子 - * @since 2025-12-15 13:16:03 - */ -public interface CreditUserService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditUserParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditUserParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditUser - */ - CreditUser getByIdRel(Integer id); - - CreditUser getByName(String name); -} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditXgxfService.java b/src/main/java/com/gxwebsoft/credit/service/CreditXgxfService.java deleted file mode 100644 index 7871e79..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/CreditXgxfService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.credit.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditXgxf; -import com.gxwebsoft.credit.param.CreditXgxfParam; - -import java.util.List; - -/** - * 限制高消费Service - * - * @author 科技小王子 - * @since 2025-12-19 19:51:55 - */ -public interface CreditXgxfService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(CreditXgxfParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(CreditXgxfParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return CreditXgxf - */ - CreditXgxf getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditAdministrativeLicenseServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditAdministrativeLicenseServiceImpl.java deleted file mode 100644 index 8df16b6..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditAdministrativeLicenseServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditAdministrativeLicense; -import com.gxwebsoft.credit.mapper.CreditAdministrativeLicenseMapper; -import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam; -import com.gxwebsoft.credit.service.CreditAdministrativeLicenseService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 行政许可Service实现 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:13 - */ -@Service -public class CreditAdministrativeLicenseServiceImpl extends ServiceImpl implements CreditAdministrativeLicenseService { - - @Override - public PageResult pageRel(CreditAdministrativeLicenseParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditAdministrativeLicenseParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditAdministrativeLicense getByIdRel(Integer id) { - CreditAdministrativeLicenseParam param = new CreditAdministrativeLicenseParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditBankruptcyServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditBankruptcyServiceImpl.java deleted file mode 100644 index 7ce7d70..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditBankruptcyServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditBankruptcy; -import com.gxwebsoft.credit.mapper.CreditBankruptcyMapper; -import com.gxwebsoft.credit.param.CreditBankruptcyParam; -import com.gxwebsoft.credit.service.CreditBankruptcyService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 破产重整Service实现 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Service -public class CreditBankruptcyServiceImpl extends ServiceImpl implements CreditBankruptcyService { - - @Override - public PageResult pageRel(CreditBankruptcyParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditBankruptcyParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditBankruptcy getByIdRel(Integer id) { - CreditBankruptcyParam param = new CreditBankruptcyParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditBranchServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditBranchServiceImpl.java deleted file mode 100644 index dcf4bec..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditBranchServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditBranch; -import com.gxwebsoft.credit.mapper.CreditBranchMapper; -import com.gxwebsoft.credit.param.CreditBranchParam; -import com.gxwebsoft.credit.service.CreditBranchService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分支机构Service实现 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Service -public class CreditBranchServiceImpl extends ServiceImpl implements CreditBranchService { - - @Override - public PageResult pageRel(CreditBranchParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditBranchParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditBranch getByIdRel(Integer id) { - CreditBranchParam param = new CreditBranchParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditBreachOfTrustServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditBreachOfTrustServiceImpl.java deleted file mode 100644 index 0398416..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditBreachOfTrustServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditBreachOfTrust; -import com.gxwebsoft.credit.mapper.CreditBreachOfTrustMapper; -import com.gxwebsoft.credit.param.CreditBreachOfTrustParam; -import com.gxwebsoft.credit.service.CreditBreachOfTrustService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 失信被执行人Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:46:14 - */ -@Service -public class CreditBreachOfTrustServiceImpl extends ServiceImpl implements CreditBreachOfTrustService { - - @Override - public PageResult pageRel(CreditBreachOfTrustParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditBreachOfTrustParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditBreachOfTrust getByIdRel(Integer id) { - CreditBreachOfTrustParam param = new CreditBreachOfTrustParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCaseFilingServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCaseFilingServiceImpl.java deleted file mode 100644 index 3f1f4e4..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCaseFilingServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCaseFiling; -import com.gxwebsoft.credit.mapper.CreditCaseFilingMapper; -import com.gxwebsoft.credit.param.CreditCaseFilingParam; -import com.gxwebsoft.credit.service.CreditCaseFilingService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 司法大数据Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:47:22 - */ -@Service -public class CreditCaseFilingServiceImpl extends ServiceImpl implements CreditCaseFilingService { - - @Override - public PageResult pageRel(CreditCaseFilingParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditCaseFilingParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditCaseFiling getByIdRel(Integer id) { - CreditCaseFilingParam param = new CreditCaseFilingParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java deleted file mode 100644 index ab591b3..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCompany; -import com.gxwebsoft.credit.mapper.CreditCompanyMapper; -import com.gxwebsoft.credit.param.CreditCompanyParam; -import com.gxwebsoft.credit.service.CreditCompanyService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 企业Service实现 - * - * @author 科技小王子 - * @since 2025-12-17 08:28:03 - */ -@Service -public class CreditCompanyServiceImpl extends ServiceImpl implements CreditCompanyService { - - @Override - public PageResult pageRel(CreditCompanyParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditCompanyParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditCompany getByIdRel(Integer id) { - CreditCompanyParam param = new CreditCompanyParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public CreditCompany getByName(String name) { - CreditCompanyParam param = new CreditCompanyParam(); - param.setName(name); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public CreditCompany getByMatchName(String name) { - CreditCompanyParam param = new CreditCompanyParam(); - param.setMatchName(name); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompetitorServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompetitorServiceImpl.java deleted file mode 100644 index 4204d3e..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompetitorServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCompetitor; -import com.gxwebsoft.credit.mapper.CreditCompetitorMapper; -import com.gxwebsoft.credit.param.CreditCompetitorParam; -import com.gxwebsoft.credit.service.CreditCompetitorService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 竞争对手Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:05 - */ -@Service -public class CreditCompetitorServiceImpl extends ServiceImpl implements CreditCompetitorService { - - @Override - public PageResult pageRel(CreditCompetitorParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditCompetitorParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditCompetitor getByIdRel(Integer id) { - CreditCompetitorParam param = new CreditCompetitorParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtAnnouncementServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtAnnouncementServiceImpl.java deleted file mode 100644 index d9e6ecf..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtAnnouncementServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCourtAnnouncement; -import com.gxwebsoft.credit.mapper.CreditCourtAnnouncementMapper; -import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam; -import com.gxwebsoft.credit.service.CreditCourtAnnouncementService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 法院公告司法大数据Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:13 - */ -@Service -public class CreditCourtAnnouncementServiceImpl extends ServiceImpl implements CreditCourtAnnouncementService { - - @Override - public PageResult pageRel(CreditCourtAnnouncementParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditCourtAnnouncementParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditCourtAnnouncement getByIdRel(Integer id) { - CreditCourtAnnouncementParam param = new CreditCourtAnnouncementParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtSessionServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtSessionServiceImpl.java deleted file mode 100644 index c875735..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtSessionServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCourtSession; -import com.gxwebsoft.credit.mapper.CreditCourtSessionMapper; -import com.gxwebsoft.credit.param.CreditCourtSessionParam; -import com.gxwebsoft.credit.service.CreditCourtSessionService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 开庭公告司法大数据Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:33 - */ -@Service -public class CreditCourtSessionServiceImpl extends ServiceImpl implements CreditCourtSessionService { - - @Override - public PageResult pageRel(CreditCourtSessionParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditCourtSessionParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditCourtSession getByIdRel(Integer id) { - CreditCourtSessionParam param = new CreditCourtSessionParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCustomerServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCustomerServiceImpl.java deleted file mode 100644 index edfbfc8..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCustomerServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditCustomer; -import com.gxwebsoft.credit.mapper.CreditCustomerMapper; -import com.gxwebsoft.credit.param.CreditCustomerParam; -import com.gxwebsoft.credit.service.CreditCustomerService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 客户Service实现 - * - * @author 科技小王子 - * @since 2025-12-21 21:20:58 - */ -@Service -public class CreditCustomerServiceImpl extends ServiceImpl implements CreditCustomerService { - - @Override - public PageResult pageRel(CreditCustomerParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditCustomerParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditCustomer getByIdRel(Integer id) { - CreditCustomerParam param = new CreditCustomerParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditDeliveryNoticeServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditDeliveryNoticeServiceImpl.java deleted file mode 100644 index becedc3..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditDeliveryNoticeServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditDeliveryNotice; -import com.gxwebsoft.credit.mapper.CreditDeliveryNoticeMapper; -import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam; -import com.gxwebsoft.credit.service.CreditDeliveryNoticeService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 送达公告司法大数据Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:49:51 - */ -@Service -public class CreditDeliveryNoticeServiceImpl extends ServiceImpl implements CreditDeliveryNoticeService { - - @Override - public PageResult pageRel(CreditDeliveryNoticeParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditDeliveryNoticeParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditDeliveryNotice getByIdRel(Integer id) { - CreditDeliveryNoticeParam param = new CreditDeliveryNoticeParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditExternalServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditExternalServiceImpl.java deleted file mode 100644 index 2b45a20..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditExternalServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditExternal; -import com.gxwebsoft.credit.mapper.CreditExternalMapper; -import com.gxwebsoft.credit.param.CreditExternalParam; -import com.gxwebsoft.credit.service.CreditExternalService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 对外投资Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:11 - */ -@Service -public class CreditExternalServiceImpl extends ServiceImpl implements CreditExternalService { - - @Override - public PageResult pageRel(CreditExternalParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditExternalParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditExternal getByIdRel(Integer id) { - CreditExternalParam param = new CreditExternalParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditFinalVersionServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditFinalVersionServiceImpl.java deleted file mode 100644 index c40ec14..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditFinalVersionServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditFinalVersion; -import com.gxwebsoft.credit.mapper.CreditFinalVersionMapper; -import com.gxwebsoft.credit.param.CreditFinalVersionParam; -import com.gxwebsoft.credit.service.CreditFinalVersionService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 终本案件Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:19 - */ -@Service -public class CreditFinalVersionServiceImpl extends ServiceImpl implements CreditFinalVersionService { - - @Override - public PageResult pageRel(CreditFinalVersionParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditFinalVersionParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditFinalVersion getByIdRel(Integer id) { - CreditFinalVersionParam param = new CreditFinalVersionParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditGqdjServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditGqdjServiceImpl.java deleted file mode 100644 index acc1353..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditGqdjServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditGqdj; -import com.gxwebsoft.credit.mapper.CreditGqdjMapper; -import com.gxwebsoft.credit.param.CreditGqdjParam; -import com.gxwebsoft.credit.service.CreditGqdjService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 股权冻结Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:37 - */ -@Service -public class CreditGqdjServiceImpl extends ServiceImpl implements CreditGqdjService { - - @Override - public PageResult pageRel(CreditGqdjParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditGqdjParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditGqdj getByIdRel(Integer id) { - CreditGqdjParam param = new CreditGqdjParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditHistoricalLegalPersonServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditHistoricalLegalPersonServiceImpl.java deleted file mode 100644 index ffd3d1f..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditHistoricalLegalPersonServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson; -import com.gxwebsoft.credit.mapper.CreditHistoricalLegalPersonMapper; -import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam; -import com.gxwebsoft.credit.service.CreditHistoricalLegalPersonService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 历史法定代表人Service实现 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Service -public class CreditHistoricalLegalPersonServiceImpl extends ServiceImpl implements CreditHistoricalLegalPersonService { - - @Override - public PageResult pageRel(CreditHistoricalLegalPersonParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditHistoricalLegalPersonParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditHistoricalLegalPerson getByIdRel(Integer id) { - CreditHistoricalLegalPersonParam param = new CreditHistoricalLegalPersonParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudgmentDebtorServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudgmentDebtorServiceImpl.java deleted file mode 100644 index 9291270..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudgmentDebtorServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditJudgmentDebtor; -import com.gxwebsoft.credit.mapper.CreditJudgmentDebtorMapper; -import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam; -import com.gxwebsoft.credit.service.CreditJudgmentDebtorService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 被执行人Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:50:55 - */ -@Service -public class CreditJudgmentDebtorServiceImpl extends ServiceImpl implements CreditJudgmentDebtorService { - - @Override - public PageResult pageRel(CreditJudgmentDebtorParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditJudgmentDebtorParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditJudgmentDebtor getByIdRel(Integer id) { - CreditJudgmentDebtorParam param = new CreditJudgmentDebtorParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudicialDocumentServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudicialDocumentServiceImpl.java deleted file mode 100644 index a83095a..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudicialDocumentServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditJudicialDocument; -import com.gxwebsoft.credit.mapper.CreditJudicialDocumentMapper; -import com.gxwebsoft.credit.param.CreditJudicialDocumentParam; -import com.gxwebsoft.credit.service.CreditJudicialDocumentService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 裁判文书司法大数据Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:02 - */ -@Service -public class CreditJudicialDocumentServiceImpl extends ServiceImpl implements CreditJudicialDocumentService { - - @Override - public PageResult pageRel(CreditJudicialDocumentParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditJudicialDocumentParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditJudicialDocument getByIdRel(Integer id) { - CreditJudicialDocumentParam param = new CreditJudicialDocumentParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudiciaryServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudiciaryServiceImpl.java deleted file mode 100644 index 6b31fbe..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudiciaryServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditJudiciary; -import com.gxwebsoft.credit.mapper.CreditJudiciaryMapper; -import com.gxwebsoft.credit.param.CreditJudiciaryParam; -import com.gxwebsoft.credit.service.CreditJudiciaryService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 司法案件Service实现 - * - * @author 科技小王子 - * @since 2025-12-16 15:23:58 - */ -@Service -public class CreditJudiciaryServiceImpl extends ServiceImpl implements CreditJudiciaryService { - - @Override - public PageResult pageRel(CreditJudiciaryParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditJudiciaryParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditJudiciary getByIdRel(Integer id) { - CreditJudiciaryParam param = new CreditJudiciaryParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public CreditJudiciary getByName(String name) { - CreditJudiciaryParam param = new CreditJudiciaryParam(); - param.setName(name); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditMediationServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditMediationServiceImpl.java deleted file mode 100644 index 9ec551a..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditMediationServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditMediation; -import com.gxwebsoft.credit.mapper.CreditMediationMapper; -import com.gxwebsoft.credit.param.CreditMediationParam; -import com.gxwebsoft.credit.service.CreditMediationService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 诉前调解司法大数据Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:25 - */ -@Service -public class CreditMediationServiceImpl extends ServiceImpl implements CreditMediationService { - - @Override - public PageResult pageRel(CreditMediationParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditMediationParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditMediation getByIdRel(Integer id) { - CreditMediationParam param = new CreditMediationParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditMpCustomerServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditMpCustomerServiceImpl.java deleted file mode 100644 index bfb1293..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditMpCustomerServiceImpl.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.exception.BusinessException; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.credit.mapper.CreditMpCustomerMapper; -import com.gxwebsoft.credit.service.CreditMpCustomerService; -import com.gxwebsoft.credit.entity.CreditMpCustomer; -import com.gxwebsoft.credit.param.CreditMpCustomerParam; -import com.gxwebsoft.credit.param.BatchFollowStepApprovalDTO; -import com.gxwebsoft.credit.param.EndFollowProcessDTO; -import com.gxwebsoft.credit.param.FollowStepApprovalDTO; -import com.gxwebsoft.credit.param.FollowStepQueryDTO; -import com.gxwebsoft.credit.vo.FollowStatisticsDTO; -import com.gxwebsoft.credit.vo.FollowStepDetailDTO; -import com.gxwebsoft.credit.vo.PendingApprovalStepVO; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.List; - -/** - * 小程序端客户Service实现 - * - * @author 科技小王子 - * @since 2026-03-16 20:59:17 - */ -@Service -public class CreditMpCustomerServiceImpl extends ServiceImpl implements CreditMpCustomerService { - - private final BaseController baseController = new BaseController(); - - @Override - public PageResult pageRel(CreditMpCustomerParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditMpCustomerParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditMpCustomer getByIdRel(Integer id) { - CreditMpCustomerParam param = new CreditMpCustomerParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - @Transactional - public void approveFollowStep(FollowStepApprovalDTO dto) { - CreditMpCustomer customer = getById(dto.getCustomerId()); - if (customer == null) { - throw new BusinessException("客户不存在"); - } - - // 验证步骤是否已提交 - if (!isStepSubmitted(customer, dto.getStep())) { - throw new BusinessException("该步骤尚未提交,无法审核"); - } - - // 更新审核状态 - updateStepApproval(customer, dto); - - // 如果审核通过,更新客户步骤状态 - if (dto.getApproved()) { - updateCustomerStep(customer, dto.getStep()); - } - } - - @Override - @Transactional - public void batchApproveFollowSteps(BatchFollowStepApprovalDTO dto) { - for (FollowStepApprovalDTO approval : dto.getApprovals()) { - approveFollowStep(approval); - } - } - - @Override - public List getPendingApprovalSteps(FollowStepQueryDTO query) { - return baseMapper.selectPendingApprovalSteps(query); - } - - @Override - public FollowStatisticsDTO getFollowStatistics(Long customerId) { - CreditMpCustomer customer = getById(customerId); - if (customer == null) { - throw new BusinessException("客户不存在"); - } - - FollowStatisticsDTO statistics = new FollowStatisticsDTO(); - statistics.setTotalSteps(7); - - List stepDetails = new ArrayList<>(); - int completedSteps = 0; - int currentStep = 1; - - for (int i = 1; i <= 7; i++) { - FollowStepDetailDTO detail = getStepDetail(customer, i); - stepDetails.add(detail); - - if ("approved".equals(detail.getStatus())) { - completedSteps++; - currentStep = i + 1; - } else if ("submitted".equals(detail.getStatus()) && currentStep == 1) { - currentStep = i; - } - } - - statistics.setCompletedSteps(completedSteps); - statistics.setCurrentStep(Math.min(currentStep, 7)); - statistics.setProgress((double) completedSteps / 7 * 100); - statistics.setStepDetails(stepDetails); - - return statistics; - } - - @Override - @Transactional - public void endFollowProcess(EndFollowProcessDTO dto) { - CreditMpCustomer customer = getById(dto.getCustomerId()); - if (customer == null) { - throw new BusinessException("客户不存在"); - } - - customer.setFollowProcessEnded(1); - customer.setFollowProcessEndTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); - customer.setFollowProcessEndReason(dto.getReason()); - - updateById(customer); - } - - // 私有辅助方法 - private boolean isStepSubmitted(CreditMpCustomer customer, Integer step) { - switch (step) { - case 1: return customer.getFollowStep1Submitted() != null && customer.getFollowStep1Submitted() == 1; - case 2: return customer.getFollowStep2Submitted() != null && customer.getFollowStep2Submitted() == 1; - case 3: return customer.getFollowStep3Submitted() != null && customer.getFollowStep3Submitted() == 1; - case 4: return customer.getFollowStep4Submitted() != null && customer.getFollowStep4Submitted() == 1; - case 5: return customer.getFollowStep5Submitted() != null && customer.getFollowStep5Submitted() == 1; - case 6: return customer.getFollowStep6Submitted() != null && customer.getFollowStep6Submitted() == 1; - case 7: return customer.getFollowStep7Submitted() != null && customer.getFollowStep7Submitted() == 1; - default: return false; - } - } - - private void updateStepApproval(CreditMpCustomer customer, FollowStepApprovalDTO dto) { - String currentTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); - Integer currentUserId = baseController.getLoginUserId(); - - switch (dto.getStep()) { - case 1: - customer.setFollowStep1Approved(dto.getApproved() ? 1 : 0); - customer.setFollowStep1ApprovedAt(currentTime); - customer.setFollowStep1ApprovedBy(currentUserId != null ? currentUserId.longValue() : null); - break; - case 2: - customer.setFollowStep2Approved(dto.getApproved() ? 1 : 0); - customer.setFollowStep2ApprovedAt(currentTime); - customer.setFollowStep2ApprovedBy(currentUserId != null ? currentUserId.longValue() : null); - break; - case 3: - customer.setFollowStep3Approved(dto.getApproved() ? 1 : 0); - customer.setFollowStep3ApprovedAt(currentTime); - customer.setFollowStep3ApprovedBy(currentUserId != null ? currentUserId.longValue() : null); - break; - case 4: - customer.setFollowStep4Approved(dto.getApproved() ? 1 : 0); - customer.setFollowStep4ApprovedAt(currentTime); - customer.setFollowStep4ApprovedBy(currentUserId != null ? currentUserId.longValue() : null); - break; - case 5: - customer.setFollowStep5Approved(dto.getApproved() ? 1 : 0); - customer.setFollowStep5ApprovedAt(currentTime); - customer.setFollowStep5ApprovedBy(currentUserId != null ? currentUserId.longValue() : null); - break; - case 6: - customer.setFollowStep6Approved(dto.getApproved() ? 1 : 0); - customer.setFollowStep6ApprovedAt(currentTime); - customer.setFollowStep6ApprovedBy(currentUserId != null ? currentUserId.longValue() : null); - break; - case 7: - customer.setFollowStep7Approved(dto.getApproved() ? 1 : 0); - customer.setFollowStep7ApprovedAt(currentTime); - customer.setFollowStep7ApprovedBy(currentUserId != null ? currentUserId.longValue() : null); - break; - } - - updateById(customer); - } - - private void updateCustomerStep(CreditMpCustomer customer, Integer step) { - // 更新客户的总体步骤状态 - if (step >= customer.getStep()) { - customer.setStep(step + 1); - updateById(customer); - } - } - - private FollowStepDetailDTO getStepDetail(CreditMpCustomer customer, Integer step) { - FollowStepDetailDTO detail = new FollowStepDetailDTO(); - detail.setStep(step); - - // 设置步骤标题 - String[] stepTitles = {"", "案件受理", "材料准备", "案件办理", "送达签收", "合同签订", "订单回款", "电话回访"}; - detail.setTitle(stepTitles[step]); - - // 获取步骤状态 - boolean submitted = isStepSubmitted(customer, step); - boolean approved = isStepApproved(customer, step); - - if (approved) { - detail.setStatus("approved"); - detail.setApprovedAt(getStepApprovedAt(customer, step)); - } else if (submitted) { - detail.setStatus("submitted"); - detail.setSubmittedAt(getStepSubmittedAt(customer, step)); - } else { - detail.setStatus("pending"); - } - - return detail; - } - - private boolean isStepApproved(CreditMpCustomer customer, Integer step) { - switch (step) { - case 1: return customer.getFollowStep1Approved() != null && customer.getFollowStep1Approved() == 1; - case 2: return customer.getFollowStep2Approved() != null && customer.getFollowStep2Approved() == 1; - case 3: return customer.getFollowStep3Approved() != null && customer.getFollowStep3Approved() == 1; - case 4: return customer.getFollowStep4Approved() != null && customer.getFollowStep4Approved() == 1; - case 5: return customer.getFollowStep5Approved() != null && customer.getFollowStep5Approved() == 1; - case 6: return customer.getFollowStep6Approved() != null && customer.getFollowStep6Approved() == 1; - case 7: return customer.getFollowStep7Approved() != null && customer.getFollowStep7Approved() == 1; - default: return false; - } - } - - private LocalDateTime getStepSubmittedAt(CreditMpCustomer customer, Integer step) { - String submittedAt = null; - switch (step) { - case 1: submittedAt = customer.getFollowStep1SubmittedAt(); break; - case 2: submittedAt = customer.getFollowStep2SubmittedAt(); break; - case 3: submittedAt = customer.getFollowStep3SubmittedAt(); break; - case 4: submittedAt = customer.getFollowStep4SubmittedAt(); break; - case 5: submittedAt = customer.getFollowStep5SubmittedAt(); break; - case 6: submittedAt = customer.getFollowStep6SubmittedAt(); break; - case 7: submittedAt = customer.getFollowStep7SubmittedAt(); break; - } - return submittedAt != null ? LocalDateTime.parse(submittedAt, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null; - } - - private LocalDateTime getStepApprovedAt(CreditMpCustomer customer, Integer step) { - String approvedAt = null; - switch (step) { - case 1: approvedAt = customer.getFollowStep1ApprovedAt(); break; - case 2: approvedAt = customer.getFollowStep2ApprovedAt(); break; - case 3: approvedAt = customer.getFollowStep3ApprovedAt(); break; - case 4: approvedAt = customer.getFollowStep4ApprovedAt(); break; - case 5: approvedAt = customer.getFollowStep5ApprovedAt(); break; - case 6: approvedAt = customer.getFollowStep6ApprovedAt(); break; - case 7: approvedAt = customer.getFollowStep7ApprovedAt(); break; - } - return approvedAt != null ? LocalDateTime.parse(approvedAt, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null; - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditNearbyCompanyServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditNearbyCompanyServiceImpl.java deleted file mode 100644 index 5083b95..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditNearbyCompanyServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditNearbyCompany; -import com.gxwebsoft.credit.mapper.CreditNearbyCompanyMapper; -import com.gxwebsoft.credit.param.CreditNearbyCompanyParam; -import com.gxwebsoft.credit.service.CreditNearbyCompanyService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 附近企业Service实现 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Service -public class CreditNearbyCompanyServiceImpl extends ServiceImpl implements CreditNearbyCompanyService { - - @Override - public PageResult pageRel(CreditNearbyCompanyParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditNearbyCompanyParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditNearbyCompany getByIdRel(Integer id) { - CreditNearbyCompanyParam param = new CreditNearbyCompanyParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditPatentServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditPatentServiceImpl.java deleted file mode 100644 index 3bb975d..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditPatentServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditPatent; -import com.gxwebsoft.credit.mapper.CreditPatentMapper; -import com.gxwebsoft.credit.param.CreditPatentParam; -import com.gxwebsoft.credit.service.CreditPatentService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 专利Service实现 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Service -public class CreditPatentServiceImpl extends ServiceImpl implements CreditPatentService { - - @Override - public PageResult pageRel(CreditPatentParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditPatentParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditPatent getByIdRel(Integer id) { - CreditPatentParam param = new CreditPatentParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditRiskRelationServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditRiskRelationServiceImpl.java deleted file mode 100644 index f000de1..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditRiskRelationServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditRiskRelation; -import com.gxwebsoft.credit.mapper.CreditRiskRelationMapper; -import com.gxwebsoft.credit.param.CreditRiskRelationParam; -import com.gxwebsoft.credit.service.CreditRiskRelationService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 风险关系表Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:40 - */ -@Service -public class CreditRiskRelationServiceImpl extends ServiceImpl implements CreditRiskRelationService { - - @Override - public PageResult pageRel(CreditRiskRelationParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditRiskRelationParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditRiskRelation getByIdRel(Integer id) { - CreditRiskRelationParam param = new CreditRiskRelationParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditSupplierServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditSupplierServiceImpl.java deleted file mode 100644 index 56a9c06..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditSupplierServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditSupplier; -import com.gxwebsoft.credit.mapper.CreditSupplierMapper; -import com.gxwebsoft.credit.param.CreditSupplierParam; -import com.gxwebsoft.credit.service.CreditSupplierService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 供应商Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:47 - */ -@Service -public class CreditSupplierServiceImpl extends ServiceImpl implements CreditSupplierService { - - @Override - public PageResult pageRel(CreditSupplierParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditSupplierParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditSupplier getByIdRel(Integer id) { - CreditSupplierParam param = new CreditSupplierParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditSuspectedRelationshipServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditSuspectedRelationshipServiceImpl.java deleted file mode 100644 index 4907758..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditSuspectedRelationshipServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditSuspectedRelationship; -import com.gxwebsoft.credit.mapper.CreditSuspectedRelationshipMapper; -import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam; -import com.gxwebsoft.credit.service.CreditSuspectedRelationshipService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 疑似关系Service实现 - * - * @author 科技小王子 - * @since 2026-01-07 13:52:14 - */ -@Service -public class CreditSuspectedRelationshipServiceImpl extends ServiceImpl implements CreditSuspectedRelationshipService { - - @Override - public PageResult pageRel(CreditSuspectedRelationshipParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditSuspectedRelationshipParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditSuspectedRelationship getByIdRel(Integer id) { - CreditSuspectedRelationshipParam param = new CreditSuspectedRelationshipParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditUserServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditUserServiceImpl.java deleted file mode 100644 index 9bd5a00..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditUserServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.credit.mapper.CreditUserMapper; -import com.gxwebsoft.credit.service.CreditUserService; -import com.gxwebsoft.credit.entity.CreditUser; -import com.gxwebsoft.credit.param.CreditUserParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 招投标信息表Service实现 - * - * @author 科技小王子 - * @since 2025-12-15 13:16:03 - */ -@Service -public class CreditUserServiceImpl extends ServiceImpl implements CreditUserService { - - @Override - public PageResult pageRel(CreditUserParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditUserParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditUser getByIdRel(Integer id) { - CreditUserParam param = new CreditUserParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public CreditUser getByName(String name) { - CreditUserParam param = new CreditUserParam(); - param.setName(name); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditXgxfServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditXgxfServiceImpl.java deleted file mode 100644 index d8ffa3a..0000000 --- a/src/main/java/com/gxwebsoft/credit/service/impl/CreditXgxfServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.credit.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.credit.entity.CreditXgxf; -import com.gxwebsoft.credit.mapper.CreditXgxfMapper; -import com.gxwebsoft.credit.param.CreditXgxfParam; -import com.gxwebsoft.credit.service.CreditXgxfService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 限制高消费Service实现 - * - * @author 科技小王子 - * @since 2025-12-19 19:51:55 - */ -@Service -public class CreditXgxfServiceImpl extends ServiceImpl implements CreditXgxfService { - - @Override - public PageResult pageRel(CreditXgxfParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(CreditXgxfParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public CreditXgxf getByIdRel(Integer id) { - CreditXgxfParam param = new CreditXgxfParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/credit/vo/FollowStatisticsDTO.java b/src/main/java/com/gxwebsoft/credit/vo/FollowStatisticsDTO.java deleted file mode 100644 index 6a04155..0000000 --- a/src/main/java/com/gxwebsoft/credit/vo/FollowStatisticsDTO.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.credit.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.util.List; - -/** - * 客户跟进统计DTO - * - * @author 科技小王子 - * @since 2026-03-22 - */ -@Data -@Schema(name = "FollowStatisticsDTO对象", description = "客户跟进统计DTO") -public class FollowStatisticsDTO { - - @Schema(description = "总步骤数") - private Integer totalSteps; - - @Schema(description = "已完成步骤数") - private Integer completedSteps; - - @Schema(description = "当前步骤") - private Integer currentStep; - - @Schema(description = "进度百分比") - private Double progress; - - @Schema(description = "步骤详情列表") - private List stepDetails; -} diff --git a/src/main/java/com/gxwebsoft/credit/vo/FollowStepDetailDTO.java b/src/main/java/com/gxwebsoft/credit/vo/FollowStepDetailDTO.java deleted file mode 100644 index 506c523..0000000 --- a/src/main/java/com/gxwebsoft/credit/vo/FollowStepDetailDTO.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.credit.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * 跟进步骤详情DTO - * - * @author 科技小王子 - * @since 2026-03-22 - */ -@Data -@Schema(name = "FollowStepDetailDTO对象", description = "跟进步骤详情DTO") -public class FollowStepDetailDTO { - - @Schema(description = "步骤号") - private Integer step; - - @Schema(description = "步骤标题") - private String title; - - @Schema(description = "状态: pending, submitted, approved, rejected") - private String status; - - @Schema(description = "提交时间") - private LocalDateTime submittedAt; - - @Schema(description = "审核时间") - private LocalDateTime approvedAt; -} diff --git a/src/main/java/com/gxwebsoft/credit/vo/PendingApprovalStepVO.java b/src/main/java/com/gxwebsoft/credit/vo/PendingApprovalStepVO.java deleted file mode 100644 index fbc7d2f..0000000 --- a/src/main/java/com/gxwebsoft/credit/vo/PendingApprovalStepVO.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.gxwebsoft.credit.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * 待审核跟进步骤VO - * - * @author 科技小王子 - * @since 2026-03-22 - */ -@Data -@Schema(name = "PendingApprovalStepVO对象", description = "待审核跟进步骤VO") -public class PendingApprovalStepVO { - - @Schema(description = "客户ID") - private Long customerId; - - @Schema(description = "客户名称") - private String customerName; - - @Schema(description = "步骤号") - private Integer step; - - @Schema(description = "步骤标题") - private String stepTitle; - - @Schema(description = "提交时间") - private LocalDateTime submittedAt; - - @Schema(description = "提交人") - private String submittedBy; - - @Schema(description = "内容") - private String content; -} diff --git a/src/main/java/com/gxwebsoft/glt/controller/GltTicketOrderController.java b/src/main/java/com/gxwebsoft/glt/controller/GltTicketOrderController.java deleted file mode 100644 index 7fa519e..0000000 --- a/src/main/java/com/gxwebsoft/glt/controller/GltTicketOrderController.java +++ /dev/null @@ -1,370 +0,0 @@ -package com.gxwebsoft.glt.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.exception.BusinessException; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.glt.entity.GltTicketOrder; -import com.gxwebsoft.glt.param.GltTicketOrderDeliveredParam; -import com.gxwebsoft.glt.param.GltTicketOrderParam; -import com.gxwebsoft.glt.service.GltTicketOrderService; -import com.gxwebsoft.shop.entity.ShopStoreRider; -import com.gxwebsoft.shop.entity.ShopUserAddress; -import com.gxwebsoft.shop.service.ShopStoreFenceService; -import com.gxwebsoft.shop.service.ShopStoreRiderService; -import com.gxwebsoft.shop.service.ShopUserAddressService; -import cn.hutool.core.util.StrUtil; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 送水订单控制器 - * - * @author 科技小王子 - * @since 2026-02-05 18:50:21 - */ -@Tag(name = "送水订单管理") -@RestController -@RequestMapping("/api/glt/glt-ticket-order") -public class GltTicketOrderController extends BaseController { - @Resource - private GltTicketOrderService gltTicketOrderService; - @Resource - private ShopUserAddressService shopUserAddressService; - @Resource - private ShopStoreFenceService shopStoreFenceService; - @Resource - private ShopStoreRiderService shopStoreRiderService; - - @Operation(summary = "分页查询送水订单") - @GetMapping("/page") - public ApiResult> page(GltTicketOrderParam param) { - // 使用关联查询 - return success(gltTicketOrderService.pageRel(param)); - } - - @PreAuthorize("isAuthenticated()") - @Operation(summary = "配送员端:分页查询可接单的送水订单") - @GetMapping("/rider/available") - public ApiResult> riderAvailablePage(GltTicketOrderParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - Integer tenantId = getTenantId(); - param.setTenantId(tenantId); - // 仅允许配送员访问 - requireActiveRider(loginUser.getUserId(), tenantId); - - // 查询未分配的待配送订单(riderId 为空或0) - // 设置为0表示查询未分配的订单,XML中会处理为 IS NULL OR = 0 - param.setRiderId(0); - if (param.getDeliveryStatus() == null) { - param.setDeliveryStatus(GltTicketOrderService.DELIVERY_STATUS_WAITING); - } - // 配送员端默认按期望配送时间优先 - if (StrUtil.isBlank(param.getSort())) { - param.setSort("sendTime asc, createTime desc"); - } - - // 使用现有的关联查询方法,通过参数控制 - return success(gltTicketOrderService.pageRel(param)); - } - - @PreAuthorize("isAuthenticated()") - @Operation(summary = "配送员端:分页查询我的送水订单") - @GetMapping("/rider/page") - public ApiResult> riderPage(GltTicketOrderParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - Integer tenantId = getTenantId(); - param.setTenantId(tenantId); - // 仅允许配送员访问 - requireActiveRider(loginUser.getUserId(), tenantId); - - // 关键修复:配送员只能看到分配给自己的订单 - param.setRiderId(loginUser.getUserId()); - - // 默认查询待配送和配送中的订单 - if (param.getDeliveryStatus() == null) { - // 可以通过参数传递多个状态,这里简化为只查待配送 - param.setDeliveryStatus(GltTicketOrderService.DELIVERY_STATUS_WAITING); - } - // 配送员端默认按期望配送时间优先 - if (StrUtil.isBlank(param.getSort())) { - param.setSort("sendTime asc, createTime desc"); - } - return success(gltTicketOrderService.pageRel(param)); - } - - @Operation(summary = "查询全部送水订单") - @GetMapping() - public ApiResult> list(GltTicketOrderParam param) { - // 使用关联查询 - return success(gltTicketOrderService.listRel(param)); - } - - @Operation(summary = "根据id查询送水订单") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(gltTicketOrderService.getByIdRel(id)); - } - - @Operation(summary = "添加送水订单") - @PostMapping() - public ApiResult save(@RequestBody GltTicketOrder gltTicketOrder) { - // 下单:后端原子完成(扣水票 + 写核销记录 + 生成订单) - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - if (gltTicketOrder == null) { - return fail("订单参数不能为空"); - } - - // 地址快照:把用户关联的“详细地址”落到 glt_ticket_order.address,避免用户后续修改地址导致历史订单丢失 - ShopUserAddress userAddress = null; - if (gltTicketOrder.getAddressId() != null) { - userAddress = shopUserAddressService.getByIdRel(gltTicketOrder.getAddressId()); - } else { - userAddress = shopUserAddressService.getDefaultAddress(loginUser.getUserId()); - } - if (userAddress == null) { - return fail("请先添加收货地址"); - } - if (!loginUser.getUserId().equals(userAddress.getUserId())) { - return fail("收货地址不存在或无权限"); - } - if (loginUser.getTenantId() != null && userAddress.getTenantId() != null - && !loginUser.getTenantId().equals(userAddress.getTenantId())) { - return fail("收货地址不存在或无权限"); - } - gltTicketOrder.setAddressId(userAddress.getId()); - gltTicketOrder.setAddress(buildAddressSnapshot(userAddress)); - - // 下单时校验配送范围(电子围栏):不信任前端传经纬度,使用地址表坐标校验 - if (StrUtil.isBlank(userAddress.getLat()) || StrUtil.isBlank(userAddress.getLng())) { - return fail("收货地址坐标缺失,请重新选择收货地址"); - } - try { - double lat = Double.parseDouble(userAddress.getLat().trim()); - double lng = Double.parseDouble(userAddress.getLng().trim()); - shopStoreFenceService.validatePointInEnabledFences(loginUser.getTenantId(), lng, lat); - } catch (Exception e) { - return fail(e.getMessage() == null ? "收货地址不在配送范围内" : e.getMessage()); - } - - gltTicketOrderService.createWithWriteOff(gltTicketOrder, loginUser.getUserId(), loginUser.getTenantId()); - return success("下单成功"); - } - - @PreAuthorize("isAuthenticated()") - @Operation(summary = "配送员接单") - @PostMapping("/{id}/accept") - public ApiResult accept(@PathVariable("id") Integer id) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - Integer tenantId = getTenantId(); - requireActiveRider(loginUser.getUserId(), tenantId); - gltTicketOrderService.accept(id, loginUser.getUserId(), tenantId); - return success("接单成功"); - } - - @PreAuthorize("isAuthenticated()") - @Operation(summary = "配送员开始配送") - @PostMapping("/{id}/start") - public ApiResult start(@PathVariable("id") Integer id) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - Integer tenantId = getTenantId(); - requireActiveRider(loginUser.getUserId(), tenantId); - gltTicketOrderService.start(id, loginUser.getUserId(), tenantId); - return success("开始配送"); - } - - @PreAuthorize("isAuthenticated()") - @Operation(summary = "配送员确认送达") - @PostMapping("/{id}/delivered") - public ApiResult delivered(@PathVariable("id") Integer id, - @RequestBody(required = false) GltTicketOrderDeliveredParam body) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - Integer tenantId = getTenantId(); - requireActiveRider(loginUser.getUserId(), tenantId); - String sendEndImg = body == null ? null : body.getSendEndImg(); - // 配送员提成结算:在 service 内部按“拍照上传/用户确认收货”规则幂等处理。 - gltTicketOrderService.delivered(id, loginUser.getUserId(), tenantId, sendEndImg); - return success("确认送达"); - } - - @PreAuthorize("isAuthenticated()") - @Operation(summary = "用户确认收货") - @PostMapping("/{id}/confirm-receive") - public ApiResult confirmReceive(@PathVariable("id") Integer id) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - // 配送员提成结算:在 service 内部按规则幂等处理。 - gltTicketOrderService.confirmReceive(id, loginUser.getUserId(), getTenantId()); - return success("确认收货成功"); - } - - private ShopStoreRider requireActiveRider(Integer userId, Integer tenantId) { - if (userId == null) { - throw new BusinessException("请先登录"); - } - if (tenantId == null) { - throw new BusinessException("租户信息缺失"); - } - ShopStoreRider rider = shopStoreRiderService.getOne(new LambdaQueryWrapper() - .eq(ShopStoreRider::getUserId, userId) - .eq(ShopStoreRider::getTenantId, tenantId) - .eq(ShopStoreRider::getIsDelete, 0) - .last("limit 1")); - if (rider == null) { - throw new BusinessException("非配送员,无权限操作"); - } - if (rider.getStatus() == null || rider.getStatus() != 1) { - throw new BusinessException("配送员已禁用"); - } - return rider; - } - - private String buildAddressSnapshot(ShopUserAddress addr) { - if (addr == null) { - return null; - } - if (StrUtil.isNotBlank(addr.getFullAddress())) { - return addr.getFullAddress(); - } - // 兼容旧数据:fullAddress 为空时,拼接省市区 + 详细地址 - return StrUtil.blankToDefault( - StrUtil.join("", - StrUtil.nullToEmpty(addr.getProvince()), - StrUtil.nullToEmpty(addr.getCity()), - StrUtil.nullToEmpty(addr.getRegion()), - StrUtil.nullToEmpty(addr.getAddress()) - ), - addr.getAddress() - ); - } - - @PreAuthorize("hasAuthority('glt:gltTicketOrder:update')") - @OperationLog - @Operation(summary = "修改送水订单") - @PutMapping() - public ApiResult update(@RequestBody GltTicketOrder gltTicketOrder) { - if (gltTicketOrder == null || gltTicketOrder.getId() == null) { - return fail("订单ID不能为空"); - } - Integer tenantId = getTenantId(); - - // 根据 addressId 同步更新订单地址快照 - if (gltTicketOrder.getAddressId() != null) { - ShopUserAddress userAddress = shopUserAddressService.getByIdRel(gltTicketOrder.getAddressId()); - if (userAddress == null) { - return fail("收货地址不存在"); - } - if (tenantId != null && userAddress.getTenantId() != null && !tenantId.equals(userAddress.getTenantId())) { - return fail("收货地址不存在或无权限"); - } - GltTicketOrder oldOrder = gltTicketOrderService.getById(gltTicketOrder.getId()); - if (oldOrder == null) { - return fail("订单不存在"); - } - Integer targetUserId = gltTicketOrder.getUserId() != null ? gltTicketOrder.getUserId() : oldOrder.getUserId(); - if (targetUserId != null && userAddress.getUserId() != null && !targetUserId.equals(userAddress.getUserId())) { - return fail("收货地址不存在或无权限"); - } - gltTicketOrder.setAddressId(userAddress.getId()); - gltTicketOrder.setAddress(buildAddressSnapshot(userAddress)); - } - - if (gltTicketOrderService.updateById(gltTicketOrder)) { - // 后台指派配送员(直接改 riderId)时,同步商城订单为“已发货”(deliveryStatus=20) - if (gltTicketOrder != null - && gltTicketOrder.getId() != null - && gltTicketOrder.getRiderId() != null - && gltTicketOrder.getRiderId() > 0) { - gltTicketOrderService.markShopOrderShippedAfterRiderAssigned( - gltTicketOrder.getId(), - tenantId, - gltTicketOrder.getRiderId() - ); - } - // 后台直接改“已完成”(deliveryStatus=40)时,同步商城订单为“已完成”(orderStatus=1) - if (gltTicketOrder != null - && gltTicketOrder.getId() != null - && gltTicketOrder.getDeliveryStatus() != null - && gltTicketOrder.getDeliveryStatus() == GltTicketOrderService.DELIVERY_STATUS_FINISHED) { - gltTicketOrderService.markShopOrderCompletedAfterTicketFinished(gltTicketOrder.getId(), tenantId); - } - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltTicketOrder:remove')") - @OperationLog - @Operation(summary = "删除送水订单") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (gltTicketOrderService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('glt:gltTicketOrder:save')") - @OperationLog - @Operation(summary = "批量添加送水订单") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (gltTicketOrderService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('glt:gltTicketOrder:update')") - @OperationLog - @Operation(summary = "批量修改送水订单") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(gltTicketOrderService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltTicketOrder:remove')") - @OperationLog - @Operation(summary = "批量删除送水订单") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (gltTicketOrderService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/controller/GltTicketTemplateController.java b/src/main/java/com/gxwebsoft/glt/controller/GltTicketTemplateController.java deleted file mode 100644 index fb07151..0000000 --- a/src/main/java/com/gxwebsoft/glt/controller/GltTicketTemplateController.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.gxwebsoft.glt.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.glt.service.GltTicketTemplateService; -import com.gxwebsoft.glt.entity.GltTicketTemplate; -import com.gxwebsoft.glt.param.GltTicketTemplateParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 水票控制器 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Tag(name = "水票管理") -@RestController -@RequestMapping("/api/glt/glt-ticket-template") -public class GltTicketTemplateController extends BaseController { - @Resource - private GltTicketTemplateService gltTicketTemplateService; - - @Operation(summary = "分页查询水票") - @GetMapping("/page") - public ApiResult> page(GltTicketTemplateParam param) { - // 使用关联查询 - return success(gltTicketTemplateService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('glt:gltTicketTemplate:list')") - @Operation(summary = "查询全部水票") - @GetMapping() - public ApiResult> list(GltTicketTemplateParam param) { - // 使用关联查询 - return success(gltTicketTemplateService.listRel(param)); - } - - @Operation(summary = "根据id查询水票") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(gltTicketTemplateService.getByIdRel(id)); - } - - @Operation(summary = "根据商品ID查询水票") - @GetMapping("/getByGoodsId/{goodsId}") - public ApiResult getByGoodsId(@PathVariable("goodsId") Integer goodsId) { - GltTicketTemplate template = gltTicketTemplateService.getOne( - new LambdaQueryWrapper() - .eq(GltTicketTemplate::getGoodsId, goodsId) - .eq(GltTicketTemplate::getDeleted, 0) - .orderByAsc(GltTicketTemplate::getSortNumber) - .orderByDesc(GltTicketTemplate::getCreateTime) - .last("limit 1") - ); - return success(template); - } - - - - @PreAuthorize("hasAuthority('glt:gltTicketTemplate:update')") - @OperationLog - @Operation(summary = "添加水票") - @PostMapping() - public ApiResult save(@RequestBody GltTicketTemplate gltTicketTemplate) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - gltTicketTemplate.setUserId(loginUser.getUserId()); - } - if (gltTicketTemplateService.save(gltTicketTemplate)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('glt:gltTicketTemplate:update')") - @OperationLog - @Operation(summary = "修改水票") - @PutMapping() - public ApiResult update(@RequestBody GltTicketTemplate gltTicketTemplate) { - if (gltTicketTemplateService.updateById(gltTicketTemplate)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltTicketTemplate:remove')") - @OperationLog - @Operation(summary = "删除水票") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (gltTicketTemplateService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('glt:gltTicketTemplate:update')") - @OperationLog - @Operation(summary = "批量添加水票") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (gltTicketTemplateService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('glt:gltTicketTemplate:update')") - @OperationLog - @Operation(summary = "批量修改水票") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(gltTicketTemplateService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltTicketTemplate:remove')") - @OperationLog - @Operation(summary = "批量删除水票") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (gltTicketTemplateService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketController.java b/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketController.java deleted file mode 100644 index 51bd269..0000000 --- a/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketController.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.gxwebsoft.glt.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.glt.service.GltUserTicketService; -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.glt.param.GltUserTicketParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 我的水票控制器 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Tag(name = "我的水票管理") -@RestController -@RequestMapping("/api/glt/glt-user-ticket") -public class GltUserTicketController extends BaseController { - @Resource - private GltUserTicketService gltUserTicketService; - - @Operation(summary = "分页查询我的水票") - @GetMapping("/page") - public ApiResult> page(GltUserTicketParam param) { - // 使用关联查询 - return success(gltUserTicketService.pageRel(param)); - } - - @Operation(summary = "可用水票总数") - @GetMapping("/my-total") - public ApiResult myTotal() { - Integer userId = getLoginUserId(); - if (userId == null) { - return fail("未登录"); - } - Integer tenantId = getTenantId(); - if (tenantId == null) { - return fail("租户信息缺失"); - } - Integer availableQty = gltUserTicketService.sumAvailableQtyByUserId(userId, tenantId); - Map data = new HashMap<>(); - data.put("userId", userId); - // 兼容旧字段:totalQty 表示“可用水票总数” - data.put("totalQty", availableQty); - data.put("availableQty", availableQty); - return success(data); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicket:list')") - @Operation(summary = "查询全部我的水票") - @GetMapping() - public ApiResult> list(GltUserTicketParam param) { - // 使用关联查询 - return success(gltUserTicketService.listRel(param)); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicket:list')") - @Operation(summary = "根据id查询我的水票") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(gltUserTicketService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicket:save')") - @OperationLog - @Operation(summary = "添加我的水票") - @PostMapping() - public ApiResult save(@RequestBody GltUserTicket gltUserTicket) { - if (gltUserTicketService.save(gltUserTicket)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicket:update')") - @OperationLog - @Operation(summary = "修改我的水票") - @PutMapping() - public ApiResult update(@RequestBody GltUserTicket gltUserTicket) { - if (gltUserTicketService.updateById(gltUserTicket)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicket:remove')") - @OperationLog - @Operation(summary = "删除我的水票") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (gltUserTicketService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicket:save')") - @OperationLog - @Operation(summary = "批量添加我的水票") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (gltUserTicketService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicket:update')") - @OperationLog - @Operation(summary = "批量修改我的水票") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(gltUserTicketService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicket:remove')") - @OperationLog - @Operation(summary = "批量删除我的水票") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (gltUserTicketService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketLogController.java b/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketLogController.java deleted file mode 100644 index 8cde690..0000000 --- a/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketLogController.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.gxwebsoft.glt.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.glt.service.GltUserTicketLogService; -import com.gxwebsoft.glt.entity.GltUserTicketLog; -import com.gxwebsoft.glt.param.GltUserTicketLogParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 消费日志控制器 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Tag(name = "消费日志管理") -@RestController -@RequestMapping("/api/glt/glt-user-ticket-log") -public class GltUserTicketLogController extends BaseController { - @Resource - private GltUserTicketLogService gltUserTicketLogService; - - @PreAuthorize("hasAuthority('glt:gltUserTicketLog:list')") - @Operation(summary = "分页查询消费日志") - @GetMapping("/page") - public ApiResult> page(GltUserTicketLogParam param) { - // 使用关联查询 - return success(gltUserTicketLogService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketLog:list')") - @Operation(summary = "查询全部消费日志") - @GetMapping() - public ApiResult> list(GltUserTicketLogParam param) { - // 使用关联查询 - return success(gltUserTicketLogService.listRel(param)); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketLog:list')") - @Operation(summary = "根据id查询消费日志") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(gltUserTicketLogService.getByIdRel(id)); - } - - @Operation(summary = "添加消费日志") - @PostMapping() - public ApiResult save(@RequestBody GltUserTicketLog gltUserTicketLog) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - gltUserTicketLog.setUserId(loginUser.getUserId()); - } - if (gltUserTicketLogService.save(gltUserTicketLog)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketLog:update')") - @OperationLog - @Operation(summary = "修改消费日志") - @PutMapping() - public ApiResult update(@RequestBody GltUserTicketLog gltUserTicketLog) { - if (gltUserTicketLogService.updateById(gltUserTicketLog)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketLog:remove')") - @OperationLog - @Operation(summary = "删除消费日志") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (gltUserTicketLogService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketLog:save')") - @OperationLog - @Operation(summary = "批量添加消费日志") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (gltUserTicketLogService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketLog:update')") - @OperationLog - @Operation(summary = "批量修改消费日志") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(gltUserTicketLogService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketLog:remove')") - @OperationLog - @Operation(summary = "批量删除消费日志") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (gltUserTicketLogService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketReleaseController.java b/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketReleaseController.java deleted file mode 100644 index 44198ba..0000000 --- a/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketReleaseController.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.gxwebsoft.glt.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.glt.service.GltUserTicketReleaseService; -import com.gxwebsoft.glt.entity.GltUserTicketRelease; -import com.gxwebsoft.glt.param.GltUserTicketReleaseParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 水票释放控制器 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Tag(name = "水票释放管理") -@RestController -@RequestMapping("/api/glt/glt-user-ticket-release") -public class GltUserTicketReleaseController extends BaseController { - @Resource - private GltUserTicketReleaseService gltUserTicketReleaseService; - - @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:list')") - @Operation(summary = "分页查询水票释放") - @GetMapping("/page") - public ApiResult> page(GltUserTicketReleaseParam param) { - // 使用关联查询 - return success(gltUserTicketReleaseService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:list')") - @Operation(summary = "查询全部水票释放") - @GetMapping() - public ApiResult> list(GltUserTicketReleaseParam param) { - // 使用关联查询 - return success(gltUserTicketReleaseService.listRel(param)); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:list')") - @Operation(summary = "根据id查询水票释放") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(gltUserTicketReleaseService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:save')") - @OperationLog - @Operation(summary = "添加水票释放") - @PostMapping() - public ApiResult save(@RequestBody GltUserTicketRelease gltUserTicketRelease) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - gltUserTicketRelease.setUserId(loginUser.getUserId()); - } - if (gltUserTicketReleaseService.save(gltUserTicketRelease)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:update')") - @OperationLog - @Operation(summary = "修改水票释放") - @PutMapping() - public ApiResult update(@RequestBody GltUserTicketRelease gltUserTicketRelease) { - if (gltUserTicketReleaseService.updateById(gltUserTicketRelease)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:remove')") - @OperationLog - @Operation(summary = "删除水票释放") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (gltUserTicketReleaseService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:save')") - @OperationLog - @Operation(summary = "批量添加水票释放") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (gltUserTicketReleaseService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:update')") - @OperationLog - @Operation(summary = "批量修改水票释放") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(gltUserTicketReleaseService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:remove')") - @OperationLog - @Operation(summary = "批量删除水票释放") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (gltUserTicketReleaseService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/entity/GltTicketOrder.java b/src/main/java/com/gxwebsoft/glt/entity/GltTicketOrder.java deleted file mode 100644 index 17bb743..0000000 --- a/src/main/java/com/gxwebsoft/glt/entity/GltTicketOrder.java +++ /dev/null @@ -1,218 +0,0 @@ -package com.gxwebsoft.glt.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * 送水订单 - * - * @author 科技小王子 - * @since 2026-02-05 18:50:20 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "GltTicketOrder对象", description = "送水订单") -public class GltTicketOrder implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "用户水票ID") - private Integer userTicketId; - - @Schema(description = "订单编号") - @TableField(exist = false) - private String orderNo; - - @Schema(description = "订单状态") - @TableField(exist = false) - private Integer orderStatus; - - @Schema(description = "门店ID") - private Integer storeId; - - @Schema(description = "门店名称") - @TableField(exist = false) - private String storeName; - - @Schema(description = "门店地址") - @TableField(exist = false) - private String storeAddress; - - @Schema(description = "门店手机号") - @TableField(exist = false) - private String storePhone; - - @Schema(description = "配送员") - private Integer riderId; - - @Schema(description = "配送员名称") - @TableField(exist = false) - private String riderName; - - @Schema(description = "配送员手机号") - @TableField(exist = false) - private String riderPhone; - - @Schema(description = "仓库ID") - private Integer warehouseId; - - @Schema(description = "仓库名称") - @TableField(exist = false) - private String warehouseName; - - @Schema(description = "仓库地址") - @TableField(exist = false) - private String warehouseAddress; - - @Schema(description = "仓库手机号") - @TableField(exist = false) - private String warehousePhone; - - @Schema(description = "关联收货地址") - private Integer addressId; - - @Schema(description = "收货地址") - private String address; - - @Schema(description = "省") - @TableField(exist = false) - private String province; - - @Schema(description = "市") - @TableField(exist = false) - private String city; - - @Schema(description = "区") - @TableField(exist = false) - private String region; - - @Schema(description = "买家留言") - private String buyerRemarks; - - @Schema(description = "用于统计") - private BigDecimal price; - - @Schema(description = "购买数量") - private Integer totalNum; - - @Schema(description = "配送时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private String sendTime; - - @Schema(description = "配送状态:10待配送、20配送中、30待客户确认、40已完成") - private Integer deliveryStatus; - - @Schema(description = "开始配送时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime sendStartTime; - - @Schema(description = "确认送达时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime sendEndTime; - - @Schema(description = "送达拍照留档图片URL") - private String sendEndImg; - - @Schema(description = "客户确认收货时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime receiveConfirmTime; - - @Schema(description = "确认方式:10客户手动确认、20配送照片自动确认、30超时自动确认") - private Integer receiveConfirmType; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "昵称") - @TableField(exist = false) - private String nickname; - - @Schema(description = "手机号") - @TableField(exist = false) - private String phone; - - @Schema(description = "头像") - @TableField(exist = false) - private String avatar; - - @Schema(description = "收货人姓名") - @TableField(exist = false) - private String receiverName; - - @Schema(description = "收货人手机号") - @TableField(exist = false) - private String receiverPhone; - - @Schema(description = "收货省") - @TableField(exist = false) - private String receiverProvince; - - @Schema(description = "收货市") - @TableField(exist = false) - private String receiverCity; - - @Schema(description = "收货区") - @TableField(exist = false) - private String receiverRegion; - - @Schema(description = "收货详细地址") - @TableField(exist = false) - private String receiverAddress; - - @Schema(description = "收货完整地址") - @TableField(exist = false) - private String receiverFullAddress; - - @Schema(description = "收货纬度") - @TableField(exist = false) - private String receiverLat; - - @Schema(description = "收货经度") - @TableField(exist = false) - private String receiverLng; - - @Schema(description = "门店经纬度(lng,lat)") - @TableField(exist = false) - private String storeLngAndLat; - - @Schema(description = "仓库经纬度(lng,lat)") - @TableField(exist = false) - private String warehouseLngAndLat; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/glt/entity/GltTicketTemplate.java b/src/main/java/com/gxwebsoft/glt/entity/GltTicketTemplate.java deleted file mode 100644 index 95338a9..0000000 --- a/src/main/java/com/gxwebsoft/glt/entity/GltTicketTemplate.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.gxwebsoft.glt.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.fasterxml.jackson.annotation.JsonFormat; - -/** - * 水票 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:54 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "GltTicketTemplate对象", description = "水票") -public class GltTicketTemplate implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "关联商品ID") - private Integer goodsId; - - @Schema(description = "名称") - private String name; - - @Schema(description = "启用") - private Boolean enabled; - - @Schema(description = "单位名称") - private String unitName; - - @Schema(description = "最小购买数量") - private Integer minBuyQty; - - @Schema(description = "起始发送数量") - private Integer startSendQty; - - @Schema(description = "买赠:买1送4 => gift_multiplier=4") - private Integer giftMultiplier; - - @Schema(description = "是否把购买量也计入套票总量(默认仅计入赠送量)") - private Boolean includeBuyQty; - - @Schema(description = "每期释放数量(默认每月释放10)") - private Integer monthlyReleaseQty; - - @Schema(description = "总共释放多少期(若配置>0,则按期数平均分摊)") - private Integer releasePeriods; - - @Schema(description = "首期释放时机:0=支付成功当刻;1=下个月同日") - private Integer firstReleaseMode; - - @Schema(description = "步长") - private Integer step; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/glt/entity/GltUserTicket.java b/src/main/java/com/gxwebsoft/glt/entity/GltUserTicket.java deleted file mode 100644 index 4a6e8a4..0000000 --- a/src/main/java/com/gxwebsoft/glt/entity/GltUserTicket.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.gxwebsoft.glt.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.fasterxml.jackson.annotation.JsonFormat; - -/** - * 我的水票 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "GltUserTicket对象", description = "我的水票") -public class GltUserTicket implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "模板ID") - private Integer templateId; - - @Schema(description = "模板名称") - @TableField(exist = false) - private String templateName; - - @Schema(description = "商品ID") - private Integer goodsId; - - @Schema(description = "购买价格") - @TableField(exist = false) - private BigDecimal payPrice; - - @Schema(description = "商品名称") - @TableField(exist = false) - private String goodsName; - - @Schema(description = "订单ID") - private Integer orderId; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "订单商品ID") - private Integer orderGoodsId; - - @Schema(description = "订单商品数量") - private Integer orderGoodsQty; - - @Schema(description = "总数量") - private Integer totalQty; - - @Schema(description = "可用数量") - private Integer availableQty; - - @Schema(description = "冻结数量") - private Integer frozenQty; - - @Schema(description = "已使用数量") - private Integer usedQty; - - @Schema(description = "已释放数量") - private Integer releasedQty; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "用户昵称") - @TableField(exist = false) - private String nickname; - - @Schema(description = "用户头像") - @TableField(exist = false) - private String avatar; - - @Schema(description = "用户手机号") - @TableField(exist = false) - private String phone; - - @Schema(description = "订单状态") - @TableField(exist = false) - private Integer orderStatus; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketLog.java b/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketLog.java deleted file mode 100644 index 4c83b91..0000000 --- a/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketLog.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.gxwebsoft.glt.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.fasterxml.jackson.annotation.JsonFormat; - -/** - * 消费日志 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "GltUserTicketLog对象", description = "消费日志") -public class GltUserTicketLog implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "用户水票ID") - private Integer userTicketId; - - @Schema(description = "变更类型") - private Integer changeType; - - @Schema(description = "可更改") - private Integer changeAvailable; - - @Schema(description = "更改冻结状态") - private Integer changeFrozen; - - @Schema(description = "已使用更改") - private Integer changeUsed; - - @Schema(description = "可用后") - private Integer availableAfter; - - @Schema(description = "冻结后") - private Integer frozenAfter; - - @Schema(description = "使用后") - private Integer usedAfter; - - @Schema(description = "订单ID") - private Integer orderId; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "用户昵称") - @TableField(exist = false) - private String nickname; - - @Schema(description = "用户头像") - @TableField(exist = false) - private String avatar; - - @Schema(description = "用户手机号") - @TableField(exist = false) - private String phone; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketRelease.java b/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketRelease.java deleted file mode 100644 index 26131d9..0000000 --- a/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketRelease.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.gxwebsoft.glt.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.fasterxml.jackson.annotation.JsonFormat; - -/** - * 水票释放 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "GltUserTicketRelease对象", description = "水票释放") -public class GltUserTicketRelease implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "水票ID") - private Long userTicketId; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "用户昵称") - @TableField(exist = false) - private String nickname; - - @Schema(description = "用户头像") - @TableField(exist = false) - private String avatar; - - @Schema(description = "用户手机号") - @TableField(exist = false) - private String phone; - - @Schema(description = "周期编号") - private Integer periodNo; - - @Schema(description = "释放数量") - private Integer releaseQty; - - @Schema(description = "释放时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime releaseTime; - - @Schema(description = "状态") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/GltTicketOrderMapper.java b/src/main/java/com/gxwebsoft/glt/mapper/GltTicketOrderMapper.java deleted file mode 100644 index 8af4a07..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/GltTicketOrderMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.glt.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.glt.entity.GltTicketOrder; -import com.gxwebsoft.glt.param.GltTicketOrderParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 送水订单Mapper - * - * @author 科技小王子 - * @since 2026-02-05 18:50:20 - */ -public interface GltTicketOrderMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") GltTicketOrderParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") GltTicketOrderParam param); - -} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/GltTicketTemplateMapper.java b/src/main/java/com/gxwebsoft/glt/mapper/GltTicketTemplateMapper.java deleted file mode 100644 index c293a30..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/GltTicketTemplateMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.glt.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.glt.entity.GltTicketTemplate; -import com.gxwebsoft.glt.param.GltTicketTemplateParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 水票Mapper - * - * @author 科技小王子 - * @since 2026-02-03 18:55:54 - */ -public interface GltTicketTemplateMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") GltTicketTemplateParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") GltTicketTemplateParam param); - -} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketLogMapper.java b/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketLogMapper.java deleted file mode 100644 index b635ade..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketLogMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.glt.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.glt.entity.GltUserTicketLog; -import com.gxwebsoft.glt.param.GltUserTicketLogParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 消费日志Mapper - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -public interface GltUserTicketLogMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") GltUserTicketLogParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") GltUserTicketLogParam param); - -} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketMapper.java b/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketMapper.java deleted file mode 100644 index d46a767..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketMapper.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.gxwebsoft.glt.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.glt.param.GltUserTicketParam; -import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Update; -import org.apache.ibatis.annotations.Param; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * 我的水票Mapper - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -public interface GltUserTicketMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") GltUserTicketParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") GltUserTicketParam param); - - /** - * 统计用户可用水票总数(sum(available_qty)) - * - * @param userId 用户ID - * @param tenantId 租户ID - * @return 可用总数 - */ - Integer sumAvailableQtyByUserId(@Param("userId") Integer userId, - @Param("tenantId") Integer tenantId); - - /** - * 按当前用户锁定水票记录(用于扣减/核销的事务场景) - */ - @Select(""" - SELECT * - FROM glt_user_ticket - WHERE id = #{id} - AND user_id = #{userId} - AND tenant_id = #{tenantId} - AND status = 0 - AND deleted = 0 - LIMIT 1 - FOR UPDATE - """) - GltUserTicket selectByIdForUpdate(@Param("id") Integer id, - @Param("userId") Integer userId, - @Param("tenantId") Integer tenantId); - - /** - * 释放冻结水票(冻结 -> 可用;并累加已释放数量) - *

- * 返回值为受影响行数:1 表示释放成功;0 表示记录不存在/状态不符/冻结不足。 - */ - @Update(""" - UPDATE glt_user_ticket - SET available_qty = COALESCE(available_qty, 0) + #{qty}, - frozen_qty = COALESCE(frozen_qty, 0) - #{qty}, - released_qty = COALESCE(released_qty, 0) + #{qty}, - update_time = #{now} - WHERE id = #{id} - AND user_id = #{userId} - AND tenant_id = #{tenantId} - AND status = 0 - AND deleted = 0 - AND COALESCE(frozen_qty, 0) >= #{qty} - """) - int releaseFrozenQty(@Param("id") Integer id, - @Param("userId") Integer userId, - @Param("tenantId") Integer tenantId, - @Param("qty") Integer qty, - @Param("now") LocalDateTime now); - -} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketReleaseMapper.java b/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketReleaseMapper.java deleted file mode 100644 index baf5639..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketReleaseMapper.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.gxwebsoft.glt.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.glt.entity.GltUserTicketRelease; -import com.gxwebsoft.glt.param.GltUserTicketReleaseParam; -import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Update; -import org.apache.ibatis.annotations.Param; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * 水票释放Mapper - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -public interface GltUserTicketReleaseMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") GltUserTicketReleaseParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") GltUserTicketReleaseParam param); - - /** - * 查询待释放且到期的记录(加行锁,防止多实例重复处理) - * - * status: 0=待释放, 1=已释放, 2=释放失败(数据异常) - */ - @Select(""" - SELECT * - FROM glt_user_ticket_release - WHERE status = 0 - AND deleted = 0 - AND release_time <= #{now} - ORDER BY release_time ASC, id ASC - LIMIT #{limit} - FOR UPDATE - """) - List selectDueForUpdate(@Param("now") LocalDateTime now, - @Param("limit") int limit); - - /** - * 更新释放记录状态 - */ - @Update(""" - UPDATE glt_user_ticket_release - SET status = #{status}, - update_time = #{now} - WHERE id = #{id} - AND deleted = 0 - AND status = 0 - """) - int updateStatus(@Param("id") Long id, - @Param("status") Integer status, - @Param("now") LocalDateTime now); - -} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltTicketOrderMapper.xml b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltTicketOrderMapper.xml deleted file mode 100644 index f7efe52..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltTicketOrderMapper.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - SELECT a.*, b.name as storeName, b.address as storeAddress, b.phone as storePhone, b.lng_and_lat as storeLngAndLat, - w.name as warehouseName, w.address as warehouseAddress, w.phone as warehousePhone, w.lng_and_lat as warehouseLngAndLat, - c.real_name as riderName, c.mobile as riderPhone, - u.nickname, u.phone, u.avatar, - d.name as receiverName, d.phone as receiverPhone, - d.province as receiverProvince, d.city as receiverCity, d.region as receiverRegion, - d.address as receiverAddress, d.full_address as receiverFullAddress, d.lat as receiverLat, d.lng as receiverLng, - COALESCE(o.order_no, f.order_no) as orderNo, o.order_status as orderStatus - FROM glt_ticket_order a - LEFT JOIN shop_store b ON a.store_id = b.id - LEFT JOIN shop_store_warehouse w ON a.warehouse_id = w.id - LEFT JOIN shop_store_rider c ON a.rider_id = c.user_id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - LEFT JOIN shop_user_address d ON a.address_id = d.id - LEFT JOIN glt_user_ticket f ON a.user_ticket_id = f.id - LEFT JOIN shop_order o ON f.order_id = o.order_id AND f.tenant_id = o.tenant_id AND o.deleted = 0 - - - - AND a.id = #{param.id} - - - AND a.user_ticket_id = #{param.userTicketId} - - - AND a.store_id = #{param.storeId} - - - - AND (a.rider_id IS NULL OR a.rider_id = 0) - - - AND a.rider_id = #{param.riderId} - - - - AND a.delivery_status = #{param.deliveryStatus} - - - AND a.warehouse_id = #{param.warehouseId} - - - AND a.address_id = #{param.addressId} - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.buyer_remarks LIKE CONCAT('%', #{param.buyerRemarks}, '%') - - - AND a.price = #{param.price} - - - AND a.total_num = #{param.totalNum} - - - AND a.user_id = #{param.userId} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.tenant_id = #{param.tenantId} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND ( - a.address LIKE CONCAT('%', #{param.keywords}, '%') - OR a.buyer_remarks LIKE CONCAT('%', #{param.keywords}, '%') - OR a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR b.name LIKE CONCAT('%', #{param.keywords}, '%') - OR u.nickname LIKE CONCAT('%', #{param.keywords}, '%') - OR u.phone LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltTicketTemplateMapper.xml b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltTicketTemplateMapper.xml deleted file mode 100644 index aaa9af3..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltTicketTemplateMapper.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - SELECT a.* - FROM glt_ticket_template a - - - AND a.id = #{param.id} - - - AND a.goods_id = #{param.goodsId} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.enabled = #{param.enabled} - - - AND a.unit_name LIKE CONCAT('%', #{param.unitName}, '%') - - - AND a.min_buy_qty = #{param.minBuyQty} - - - AND a.start_send_qty = #{param.startSendQty} - - - AND a.gift_multiplier = #{param.giftMultiplier} - - - AND a.include_buy_qty = #{param.includeBuyQty} - - - AND a.monthly_release_qty = #{param.monthlyReleaseQty} - - - AND a.release_periods = #{param.releasePeriods} - - - AND a.first_release_mode = #{param.firstReleaseMode} - - - AND a.user_id = #{param.userId} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketLogMapper.xml b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketLogMapper.xml deleted file mode 100644 index 695b9d1..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketLogMapper.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - SELECT a.*, u.nickname, u.avatar, u.phone - FROM glt_user_ticket_log a - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.user_ticket_id = #{param.userTicketId} - - - AND a.change_type = #{param.changeType} - - - AND a.change_available = #{param.changeAvailable} - - - AND a.change_frozen = #{param.changeFrozen} - - - AND a.change_used = #{param.changeUsed} - - - AND a.available_after = #{param.availableAfter} - - - AND a.frozen_after = #{param.frozenAfter} - - - AND a.used_after = #{param.usedAfter} - - - AND a.order_id = #{param.orderId} - - - AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.user_id = #{param.keywords} - OR a.user_ticket_id = #{param.keywords} - OR a.order_no = #{param.keywords} - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketMapper.xml b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketMapper.xml deleted file mode 100644 index 7ba5daf..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketMapper.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - SELECT a.*, u.nickname, u.avatar, u.phone, m.name AS templateName, o.pay_price AS payPrice, o.order_status as orderStatus - FROM glt_user_ticket a - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - LEFT JOIN glt_ticket_template m ON a.template_id = m.id - - LEFT JOIN shop_order o ON a.order_no = o.order_no AND a.tenant_id = o.tenant_id AND o.deleted = 0 - - - AND a.id = #{param.id} - - - AND a.template_id = #{param.templateId} - - - AND a.goods_id = #{param.goodsId} - - - AND a.order_id = #{param.orderId} - - - AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') - - - AND o.order_status = #{param.orderStatus} - - - AND a.order_goods_id = #{param.orderGoodsId} - - - AND a.total_qty = #{param.totalQty} - - - AND a.available_qty = #{param.availableQty} - - - AND a.frozen_qty = #{param.frozenQty} - - - AND a.used_qty = #{param.usedQty} - - - AND a.released_qty = #{param.releasedQty} - - - AND a.user_id = #{param.userId} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.user_id = #{param.keywords} - OR a.order_no = #{param.keywords} - ) - - - - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketReleaseMapper.xml b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketReleaseMapper.xml deleted file mode 100644 index a8364a9..0000000 --- a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketReleaseMapper.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - SELECT a.*, u.nickname, u.avatar, u.phone - FROM glt_user_ticket_release a - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.user_ticket_id LIKE CONCAT('%', #{param.userTicketId}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.period_no = #{param.periodNo} - - - AND a.release_qty = #{param.releaseQty} - - - AND a.release_time LIKE CONCAT('%', #{param.releaseTime}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.user_ticket_id = #{param.keywords} - OR u.user_id = #{param.keywords} - ) - - - - - - - - - - - diff --git a/src/main/java/com/gxwebsoft/glt/param/GltTicketOrderDeliveredParam.java b/src/main/java/com/gxwebsoft/glt/param/GltTicketOrderDeliveredParam.java deleted file mode 100644 index 7158cd2..0000000 --- a/src/main/java/com/gxwebsoft/glt/param/GltTicketOrderDeliveredParam.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.gxwebsoft.glt.param; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 配送员确认送达参数 - */ -@Data -public class GltTicketOrderDeliveredParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "送达拍照留档图片URL") - private String sendEndImg; -} - diff --git a/src/main/java/com/gxwebsoft/glt/param/GltTicketOrderParam.java b/src/main/java/com/gxwebsoft/glt/param/GltTicketOrderParam.java deleted file mode 100644 index 963d775..0000000 --- a/src/main/java/com/gxwebsoft/glt/param/GltTicketOrderParam.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.gxwebsoft.glt.param; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 送水订单查询参数 - * - * @author 科技小王子 - * @since 2026-02-05 18:50:19 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "GltTicketOrderParam对象", description = "送水订单查询参数") -public class GltTicketOrderParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "用户水票ID") - @QueryField(type = QueryType.EQ) - private Integer userTicketId; - - @Schema(description = "门店ID") - @QueryField(type = QueryType.EQ) - private Integer storeId; - - @Schema(description = "配送员") - @QueryField(type = QueryType.EQ) - private Integer riderId; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "配送状态:10待配送、20配送中、30待客户确认、40已完成") - @QueryField(type = QueryType.EQ) - private Integer deliveryStatus; - - @Schema(description = "仓库ID") - @QueryField(type = QueryType.EQ) - private Integer warehouseId; - - @Schema(description = "关联收货地址") - @QueryField(type = QueryType.EQ) - private Integer addressId; - - @Schema(description = "收货地址") - private String address; - - @Schema(description = "买家留言") - private String buyerRemarks; - - @Schema(description = "用于统计") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "购买数量") - @QueryField(type = QueryType.EQ) - private Integer totalNum; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "订单状态") - @QueryField(type = QueryType.EQ) - private Integer orderStatus; - -} diff --git a/src/main/java/com/gxwebsoft/glt/param/GltTicketTemplateParam.java b/src/main/java/com/gxwebsoft/glt/param/GltTicketTemplateParam.java deleted file mode 100644 index aa0cb74..0000000 --- a/src/main/java/com/gxwebsoft/glt/param/GltTicketTemplateParam.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.gxwebsoft.glt.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 水票查询参数 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:54 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "GltTicketTemplateParam对象", description = "水票查询参数") -public class GltTicketTemplateParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "关联商品ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "名称") - private String name; - - @Schema(description = "启用") - @QueryField(type = QueryType.EQ) - private Boolean enabled; - - @Schema(description = "单位名称") - private String unitName; - - @Schema(description = "最小购买数量") - @QueryField(type = QueryType.EQ) - private Integer minBuyQty; - - @Schema(description = "起始发送数量") - @QueryField(type = QueryType.EQ) - private Integer startSendQty; - - @Schema(description = "买赠:买1送4 => gift_multiplier=4") - @QueryField(type = QueryType.EQ) - private Integer giftMultiplier; - - @Schema(description = "是否把购买量也计入套票总量(默认仅计入赠送量)") - @QueryField(type = QueryType.EQ) - private Boolean includeBuyQty; - - @Schema(description = "每期释放数量(默认每月释放10)") - @QueryField(type = QueryType.EQ) - private Integer monthlyReleaseQty; - - @Schema(description = "总共释放多少期(若配置>0,则按期数平均分摊)") - @QueryField(type = QueryType.EQ) - private Integer releasePeriods; - - @Schema(description = "首期释放时机:0=支付成功当刻;1=下个月同日") - @QueryField(type = QueryType.EQ) - private Integer firstReleaseMode; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/src/main/java/com/gxwebsoft/glt/param/GltUserTicketLogParam.java b/src/main/java/com/gxwebsoft/glt/param/GltUserTicketLogParam.java deleted file mode 100644 index d0cc687..0000000 --- a/src/main/java/com/gxwebsoft/glt/param/GltUserTicketLogParam.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.gxwebsoft.glt.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 消费日志查询参数 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "GltUserTicketLogParam对象", description = "消费日志查询参数") -public class GltUserTicketLogParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "用户水票ID") - @QueryField(type = QueryType.EQ) - private Integer userTicketId; - - @Schema(description = "变更类型") - @QueryField(type = QueryType.EQ) - private Integer changeType; - - @Schema(description = "可更改") - @QueryField(type = QueryType.EQ) - private Integer changeAvailable; - - @Schema(description = "更改冻结状态") - @QueryField(type = QueryType.EQ) - private Integer changeFrozen; - - @Schema(description = "已使用更改") - @QueryField(type = QueryType.EQ) - private Integer changeUsed; - - @Schema(description = "可用后") - @QueryField(type = QueryType.EQ) - private Integer availableAfter; - - @Schema(description = "冻结后") - @QueryField(type = QueryType.EQ) - private Integer frozenAfter; - - @Schema(description = "使用后") - @QueryField(type = QueryType.EQ) - private Integer usedAfter; - - @Schema(description = "订单ID") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/src/main/java/com/gxwebsoft/glt/param/GltUserTicketParam.java b/src/main/java/com/gxwebsoft/glt/param/GltUserTicketParam.java deleted file mode 100644 index 93873e7..0000000 --- a/src/main/java/com/gxwebsoft/glt/param/GltUserTicketParam.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.gxwebsoft.glt.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 我的水票查询参数 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "GltUserTicketParam对象", description = "我的水票查询参数") -public class GltUserTicketParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "模板ID") - @QueryField(type = QueryType.EQ) - private Integer templateId; - - @Schema(description = "商品ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "订单ID") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "订单状态") - @QueryField(type = QueryType.EQ) - private Integer orderStatus; - - @Schema(description = "订单商品ID") - @QueryField(type = QueryType.EQ) - private Integer orderGoodsId; - - @Schema(description = "总数量") - @QueryField(type = QueryType.EQ) - private Integer totalQty; - - @Schema(description = "可用数量") - @QueryField(type = QueryType.EQ) - private Integer availableQty; - - @Schema(description = "冻结数量") - @QueryField(type = QueryType.EQ) - private Integer frozenQty; - - @Schema(description = "已使用数量") - @QueryField(type = QueryType.EQ) - private Integer usedQty; - - @Schema(description = "已释放数量") - @QueryField(type = QueryType.EQ) - private Integer releasedQty; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/src/main/java/com/gxwebsoft/glt/param/GltUserTicketReleaseParam.java b/src/main/java/com/gxwebsoft/glt/param/GltUserTicketReleaseParam.java deleted file mode 100644 index 3ce4bff..0000000 --- a/src/main/java/com/gxwebsoft/glt/param/GltUserTicketReleaseParam.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.gxwebsoft.glt.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 水票释放查询参数 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "GltUserTicketReleaseParam对象", description = "水票释放查询参数") -public class GltUserTicketReleaseParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "水票ID") - private Integer userTicketId; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "周期编号") - @QueryField(type = QueryType.EQ) - private Integer periodNo; - - @Schema(description = "释放数量") - @QueryField(type = QueryType.EQ) - private Integer releaseQty; - - @Schema(description = "释放时间") - private String releaseTime; - - @Schema(description = "状态") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltTicketIssueService.java b/src/main/java/com/gxwebsoft/glt/service/GltTicketIssueService.java deleted file mode 100644 index 5b4ccae..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/GltTicketIssueService.java +++ /dev/null @@ -1,448 +0,0 @@ -package com.gxwebsoft.glt.service; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.gxwebsoft.glt.entity.GltTicketTemplate; -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.glt.entity.GltUserTicketLog; -import com.gxwebsoft.glt.entity.GltUserTicketRelease; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.shop.service.ShopOrderGoodsService; -import com.gxwebsoft.shop.service.ShopOrderService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.support.TransactionTemplate; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -/** - * 套票发放(从订单生成用户套票 + 释放计划)的业务逻辑。 - * - * 说明: - * - 定时任务无登录态时,MyBatis-Plus 多租户插件可能拿不到 tenantId; - * 外层任务方法会通过 @IgnoreTenant 禁用租户拦截,本服务内部强制用 tenantId 过滤。 - * - 幂等:以 (tenantId, templateId, orderNo, orderGoodsId) 判断是否已发放。 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class GltTicketIssueService { - - public static final int CHANGE_TYPE_ISSUE = 10; - - private enum IssueOutcome { - ISSUED, - ALREADY_ISSUED, - SKIPPED, - NO_TEMPLATE - } - - private final ShopOrderService shopOrderService; - private final ShopOrderGoodsService shopOrderGoodsService; - - private final GltTicketTemplateService gltTicketTemplateService; - private final GltUserTicketService gltUserTicketService; - private final GltUserTicketReleaseService gltUserTicketReleaseService; - private final GltUserTicketLogService gltUserTicketLogService; - private final TransactionTemplate transactionTemplate; - - /** - * 扫描“今日订单”,执行套票发放。 - */ - public void issueTodayOrders(Integer tenantId, Integer formId) { - if (formId == null) { - return; - } - issueTodayOrders(tenantId, List.of(formId)); - } - - /** - * 扫描“今日订单”,执行套票发放(支持多个商品/模板)。 - */ - public void issueTodayOrders(Integer tenantId, List goodsIds) { - if (tenantId == null || goodsIds == null || goodsIds.isEmpty()) { - return; - } - List uniqueGoodsIds = goodsIds.stream() - .filter(Objects::nonNull) - .distinct() - .toList(); - if (uniqueGoodsIds.isEmpty()) { - return; - } - Set goodsIdSet = new HashSet<>(uniqueGoodsIds); - - LocalDateTime todayStart = LocalDate.now().atStartOfDay(); - LocalDateTime tomorrowStart = todayStart.plusDays(1); - - List orders = shopOrderService.list( - new LambdaQueryWrapper() - .eq(ShopOrder::getTenantId, tenantId) - .in(ShopOrder::getFormId, uniqueGoodsIds) - .eq(ShopOrder::getPayStatus, true) - .eq(ShopOrder::getOrderStatus, 0) - // 今日订单(兼容:以 create_time 或 pay_time 任一落在今日即可) - .and(w -> w - .ge(ShopOrder::getCreateTime, todayStart).lt(ShopOrder::getCreateTime, tomorrowStart) - .or() - .ge(ShopOrder::getPayTime, todayStart).lt(ShopOrder::getPayTime, tomorrowStart) - ) - .orderByAsc(ShopOrder::getPayTime) - .orderByAsc(ShopOrder::getOrderId) - ); - - if (orders.isEmpty()) { - log.debug("套票发放扫描:今日无符合条件的订单 tenantId={}, goodsIds={}", tenantId, uniqueGoodsIds); - return; - } - - int success = 0; - int skipped = 0; - int failed = 0; - - for (ShopOrder order : orders) { - try { - int issuedCount = issueForOrder(tenantId, goodsIdSet, order); - if (issuedCount > 0) { - success += issuedCount; - } else { - skipped++; - } - } catch (Exception e) { - failed++; - log.error("套票发放失败 - tenantId={}, orderNo={}, orderId={}", - tenantId, order.getOrderNo(), order.getOrderId(), e); - } - } - - log.info("套票发放扫描完成 - tenantId={}, goodsIds={}, 订单数={}, 发放成功={}, 跳过={}, 失败={}", - tenantId, uniqueGoodsIds, orders.size(), success, skipped, failed); - } - - private int issueForOrder(Integer tenantId, Set goodsIds, ShopOrder order) { - List goodsList = shopOrderGoodsService.getListByOrderIdIgnoreTenant(order.getOrderId()); - if (goodsList == null || goodsList.isEmpty()) { - return 0; - } - - int issuedCount = 0; // 本轮新增发放数量(用于统计) - boolean shouldCompleteOrder = false; - - for (ShopOrderGoods og : goodsList) { - if (og.getGoodsId() == null || !goodsIds.contains(og.getGoodsId())) { - continue; - } - - IssueOutcome outcome = transactionTemplate.execute(status -> doIssueOne(tenantId, order, og)); - if (outcome == IssueOutcome.ISSUED) { - issuedCount++; - shouldCompleteOrder = true; - } else if (outcome == IssueOutcome.ALREADY_ISSUED) { - // 幂等:已处理过也应视为完成,避免重复扫描 - shouldCompleteOrder = true; - } - } - - if (shouldCompleteOrder) { - LocalDateTime now = LocalDateTime.now(); - // 任务执行完后将订单置为“已完成”,避免后续扫描重复处理(幂等虽可挡住,但会产生大量无意义查询)。 - shopOrderService.update( - new LambdaUpdateWrapper() - .eq(ShopOrder::getOrderId, order.getOrderId()) - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getOrderStatus, 0) - .set(ShopOrder::getOrderStatus, 1) - .set(ShopOrder::getHasTakeGift, true) - .set(ShopOrder::getUpdateTime, now) - ); - } - - return issuedCount; - } - - private IssueOutcome doIssueOne(Integer tenantId, ShopOrder order, ShopOrderGoods og) { - if (order.getUserId() == null) { - log.warn("套票发放跳过:订单缺少 userId - tenantId={}, orderNo={}", tenantId, order.getOrderNo()); - return IssueOutcome.SKIPPED; - } - if (og.getId() == null) { - log.warn("套票发放跳过:订单商品缺少 id - tenantId={}, orderNo={}", tenantId, order.getOrderNo()); - return IssueOutcome.SKIPPED; - } - - // 并发幂等兜底: - // - 该任务可能在多实例部署下并发执行;若不加锁,在没有唯一索引的情况下可能重复发放/重复核销。 - // - 这里先对商城订单行加行锁,保证同一订单在同一时刻只会被一个事务处理。 - // (注意:需数据库支持 SELECT ... FOR UPDATE,且 shop_order.order_id 为主键/有索引) - if (order.getOrderId() != null) { - shopOrderService.getOne( - new LambdaQueryWrapper() - .eq(ShopOrder::getOrderId, order.getOrderId()) - .eq(ShopOrder::getTenantId, tenantId) - .last("for update") - ); - } - - // 同一商品允许存在多条模板记录(历史数据/误操作)。为避免取到“错误模板”,这里做确定性排序取第一条。 - // 排序规则与后台 getByGoodsId 保持一致:sortNumber 越小越靠前,其次取最新创建时间。 - GltTicketTemplate template = gltTicketTemplateService.getOne( - new LambdaQueryWrapper() - .eq(GltTicketTemplate::getTenantId, tenantId) - .eq(GltTicketTemplate::getGoodsId, og.getGoodsId()) - .eq(GltTicketTemplate::getDeleted, 0) - .orderByAsc(GltTicketTemplate::getSortNumber) - .orderByDesc(GltTicketTemplate::getCreateTime) - .orderByDesc(GltTicketTemplate::getId) - .last("limit 1") - ); - - if (template == null) { - log.warn("套票发放跳过:未配置套票模板 - tenantId={}, goodsId={}, orderNo={}", - tenantId, og.getGoodsId(), order.getOrderNo()); - return IssueOutcome.NO_TEMPLATE; - } - if (!Boolean.TRUE.equals(template.getEnabled())) { - log.info("套票发放跳过:套票模板未启用 - tenantId={}, templateId={}, goodsId={}", - tenantId, template.getId(), template.getGoodsId()); - return IssueOutcome.SKIPPED; - } - - // 幂等:同一 orderNo + orderGoodsId 只发放一次 - GltUserTicket existing = gltUserTicketService.getOne( - new LambdaQueryWrapper() - .eq(GltUserTicket::getTenantId, tenantId) - .eq(GltUserTicket::getTemplateId, template.getId()) - .eq(GltUserTicket::getOrderNo, order.getOrderNo()) - .eq(GltUserTicket::getOrderGoodsId, og.getId()) - .eq(GltUserTicket::getDeleted, 0) - .last("limit 1") - ); - if (existing != null) { - log.debug("套票已发放,跳过 - tenantId={}, orderNo={}, orderGoodsId={}, userTicketId={}", - tenantId, order.getOrderNo(), og.getId(), existing.getId()); - return IssueOutcome.ALREADY_ISSUED; - } - - int buyQty = og.getTotalNum() != null ? og.getTotalNum() : 0; - if (buyQty <= 0) { - log.warn("套票发放跳过:购买数量无效 - tenantId={}, orderNo={}, orderGoodsId={}, totalNum={}", - tenantId, order.getOrderNo(), og.getId(), og.getTotalNum()); - return IssueOutcome.SKIPPED; - } - - Integer minBuyQty = template.getMinBuyQty(); - if (minBuyQty != null && minBuyQty > 0 && buyQty < minBuyQty) { - log.info("套票发放跳过:未达到最小购买数量 - tenantId={}, orderNo={}, buyQty={}, minBuyQty={}", - tenantId, order.getOrderNo(), buyQty, minBuyQty); - return IssueOutcome.SKIPPED; - } - - int giftMultiplier = template.getGiftMultiplier() != null ? template.getGiftMultiplier() : 0; - int giftQty = buyQty * Math.max(giftMultiplier, 0); - - // 总票数(购买量 + 赠送量) - int totalQty = buyQty + giftQty; - - if (totalQty <= 0) { - log.info("套票发放跳过:计算结果为0 - tenantId={}, orderNo={}, buyQty={}, giftMultiplier={}, includeBuyQty={}", - tenantId, order.getOrderNo(), buyQty, giftMultiplier, template.getIncludeBuyQty()); - return IssueOutcome.SKIPPED; - } - - LocalDateTime now = LocalDateTime.now(); - - boolean useReleasePeriods = template.getReleasePeriods() != null && template.getReleasePeriods() > 0; - - // 释放期数(releasePeriods)为高优先级: - // - 配置了期数:按期数平均分摊 totalQty,每期释放;不再“先把购买桶数一次性释放”。 - // - 未配置期数:保持原逻辑(购买量立即可用,赠送量冻结并按计划释放)。 - int initAvailableQty = useReleasePeriods ? 0 : buyQty; - int initFrozenQty = useReleasePeriods ? totalQty : giftQty; - int initReleasedQty = useReleasePeriods ? 0 : buyQty; - - GltUserTicket userTicket = new GltUserTicket(); - userTicket.setTemplateId(template.getId()); - userTicket.setGoodsId(og.getGoodsId()); - userTicket.setOrderId(order.getOrderId()); - userTicket.setOrderNo(order.getOrderNo()); - userTicket.setOrderGoodsId(og.getId()); - userTicket.setTotalQty(totalQty); - userTicket.setAvailableQty(initAvailableQty); - userTicket.setFrozenQty(initFrozenQty); - userTicket.setUsedQty(0); - userTicket.setReleasedQty(initReleasedQty); - userTicket.setOrderGoodsQty(og.getTotalNum()); - userTicket.setUserId(order.getUserId()); - userTicket.setSortNumber(0); - userTicket.setComments("订单发放套票"); - userTicket.setStatus(0); - userTicket.setDeleted(0); - userTicket.setTenantId(tenantId); - userTicket.setCreateTime(now); - userTicket.setUpdateTime(now); - - gltUserTicketService.save(userTicket); - - // 生成释放计划: - // - 配置 releasePeriods:按 totalQty 生成每期释放量(periods 优先) - // - 未配置 releasePeriods:按 giftQty 生成每期释放量 - LocalDateTime baseTime = order.getPayTime() != null ? order.getPayTime() : order.getCreateTime(); - if (baseTime == null) { - baseTime = now; - } - int planQty = useReleasePeriods ? totalQty : giftQty; - List releases = buildReleasePlan(template, userTicket, baseTime, planQty, now); - - // 若启用了 releasePeriods 且首期释放时机为“支付成功当刻”,则将首期释放量直接计入可用, - // 避免用户刚购买后短时间内无可用水票;后续期数仍由自动释放任务按 release_time 释放。 - if (useReleasePeriods && !releases.isEmpty() && !Objects.equals(template.getFirstReleaseMode(), 1)) { - GltUserTicketRelease first = releases.get(0); - Integer firstQtyObj = first.getReleaseQty(); - LocalDateTime firstTime = first.getReleaseTime(); - int firstQty = firstQtyObj != null ? firstQtyObj : 0; - if (firstQty > 0 && (firstTime == null || !firstTime.isAfter(now))) { - first.setStatus(1); - first.setUpdateTime(now); - - userTicket.setAvailableQty((userTicket.getAvailableQty() != null ? userTicket.getAvailableQty() : 0) + firstQty); - userTicket.setFrozenQty((userTicket.getFrozenQty() != null ? userTicket.getFrozenQty() : 0) - firstQty); - userTicket.setReleasedQty((userTicket.getReleasedQty() != null ? userTicket.getReleasedQty() : 0) + firstQty); - userTicket.setUpdateTime(now); - if (!gltUserTicketService.updateById(userTicket)) { - throw new IllegalStateException("首期释放:更新用户水票失败 userTicketId=" + userTicket.getId()); - } - } - } - if (!releases.isEmpty()) { - gltUserTicketReleaseService.saveBatch(releases); - } - - // 发放流水 - GltUserTicketLog issueLog = new GltUserTicketLog(); - issueLog.setUserTicketId(userTicket.getId()); - issueLog.setChangeType(CHANGE_TYPE_ISSUE); - issueLog.setChangeAvailable(userTicket.getAvailableQty() != null ? userTicket.getAvailableQty() : 0); - issueLog.setChangeFrozen(userTicket.getFrozenQty() != null ? userTicket.getFrozenQty() : 0); - issueLog.setChangeUsed(0); - issueLog.setAvailableAfter(userTicket.getAvailableQty() != null ? userTicket.getAvailableQty() : 0); - issueLog.setFrozenAfter(userTicket.getFrozenQty() != null ? userTicket.getFrozenQty() : 0); - issueLog.setUsedAfter(0); - issueLog.setOrderId(order.getOrderId()); - issueLog.setOrderNo(order.getOrderNo()); - issueLog.setUserId(order.getUserId()); - issueLog.setSortNumber(0); - issueLog.setComments("套票发放"); - issueLog.setStatus(0); - issueLog.setDeleted(0); - issueLog.setTenantId(tenantId); - issueLog.setCreateTime(now); - issueLog.setUpdateTime(now); - gltUserTicketLogService.save(issueLog); - - // 按整改需求:水票购买(囤券预付费)与水票核销(下单履约)应为两次独立用户动作; - // 因此模板 startSendQty 不再在“发放”阶段自动核销/自动生成送水订单。 - Integer startSendQtyObj = template.getStartSendQty(); - int startSendQty = startSendQtyObj != null ? startSendQtyObj : 0; - if (startSendQty > 0) { - log.info("套票模板配置了 startSendQty,但不再自动送水/自动核销 - tenantId={}, orderNo={}, templateId={}, userTicketId={}, startSendQty={}", - tenantId, order.getOrderNo(), template.getId(), userTicket.getId(), startSendQty); - } - - log.info("套票发放成功 - tenantId={}, orderNo={}, orderGoodsId={}, templateId={}, userTicketId={}, orderGoodsQty={}, buyQty={}, giftQty={}, startSendQty={}, totalQty={}", - tenantId, order.getOrderNo(), og.getId(), template.getId(), userTicket.getId(), og.getTotalNum(), buyQty, giftQty, startSendQty, totalQty); - - return IssueOutcome.ISSUED; - } - - private List buildReleasePlan(GltTicketTemplate template, - GltUserTicket userTicket, - LocalDateTime baseTime, - int totalQty, - LocalDateTime now) { - List list = new ArrayList<>(); - - if (totalQty <= 0) { - return list; - } - - // 首期释放时间 - LocalDateTime firstReleaseTime; - if (Objects.equals(template.getFirstReleaseMode(), 1)) { - firstReleaseTime = nextMonthSameDay(baseTime); - } else { - firstReleaseTime = baseTime; - } - - // 每期释放数量计算 - Integer releasePeriods = template.getReleasePeriods(); - if (releasePeriods != null && releasePeriods > 0) { - int base = totalQty / releasePeriods; - int remainder = totalQty % releasePeriods; - // periodNo 从 0 开始:第0期、第1期……(更贴近任务执行计数) - for (int i = 0; i < releasePeriods; i++) { - int qty = base + (i < remainder ? 1 : 0); - if (qty <= 0) { - continue; - } - list.add(buildRelease(userTicket, i, qty, firstReleaseTime.plusMonths(i), now)); - } - return list; - } - - int monthlyReleaseQty = template.getMonthlyReleaseQty() != null && template.getMonthlyReleaseQty() > 0 - ? template.getMonthlyReleaseQty() - : 10; - int periods = (totalQty + monthlyReleaseQty - 1) / monthlyReleaseQty; - int remaining = totalQty; - // periodNo 从 0 开始:第0期、第1期…… - for (int i = 0; i < periods; i++) { - int qty = Math.min(monthlyReleaseQty, remaining); - if (qty <= 0) { - break; - } - remaining -= qty; - list.add(buildRelease(userTicket, i, qty, firstReleaseTime.plusMonths(i), now)); - } - - return list; - } - - private GltUserTicketRelease buildRelease(GltUserTicket userTicket, - int periodNo, - int releaseQty, - LocalDateTime releaseTime, - LocalDateTime now) { - GltUserTicketRelease r = new GltUserTicketRelease(); - r.setUserTicketId(userTicket.getId() != null ? userTicket.getId().longValue() : null); - r.setUserId(userTicket.getUserId()); - r.setPeriodNo(periodNo); - r.setReleaseQty(releaseQty); - r.setReleaseTime(releaseTime); - r.setStatus(0); - r.setDeleted(0); - r.setTenantId(userTicket.getTenantId()); - r.setCreateTime(now); - r.setUpdateTime(now); - return r; - } - - private static LocalDateTime nextMonthSameDay(LocalDateTime baseTime) { - LocalDate baseDate = baseTime.toLocalDate(); - LocalTime time = baseTime.toLocalTime(); - - LocalDate nextMonth = baseDate.plusMonths(1); - int day = Math.min(baseDate.getDayOfMonth(), nextMonth.lengthOfMonth()); - LocalDate adjusted = nextMonth.withDayOfMonth(day); - return LocalDateTime.of(adjusted, time); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderAutoDispatchService.java b/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderAutoDispatchService.java deleted file mode 100644 index b6d7842..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderAutoDispatchService.java +++ /dev/null @@ -1,355 +0,0 @@ -package com.gxwebsoft.glt.service; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.gxwebsoft.glt.entity.GltTicketOrder; -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.shop.entity.ShopStoreRider; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.shop.entity.ShopUserAddress; -import com.gxwebsoft.shop.service.ShopOrderGoodsService; -import com.gxwebsoft.shop.service.ShopOrderService; -import com.gxwebsoft.shop.service.ShopStoreRiderService; -import com.gxwebsoft.shop.service.ShopUserAddressService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.util.StringUtils; - -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * 送水订单自动派单: - * - 扫描待配送且未指派配送员的 glt_ticket_order; - * - 取收货地址坐标(优先 ShopOrder.addressLat/addressLng 订单快照;兜底 addressId -> shop_user_address.lat/lng); - * - 在同门店、在线、启用、开启自动派单且有坐标的配送员中,按距离最近优先; - * - 派单写入 glt_ticket_order.rider_id(即配送员 userId),并同步商城订单 riderId/deliveryStatus(复用 accept 逻辑)。 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class GltTicketOrderAutoDispatchService { - - private final GltTicketOrderService gltTicketOrderService; - private final GltUserTicketService gltUserTicketService; - private final ShopStoreRiderService shopStoreRiderService; - private final ShopUserAddressService shopUserAddressService; - private final ShopOrderService shopOrderService; - private final ShopOrderGoodsService shopOrderGoodsService; - - /** - * 自动派单(按距离最近)。 - * - * @param tenantId 租户ID - * @param batchSize 单次扫描最大处理条数 - * @return 成功派单数量 - */ - public int autoDispatchWaitingOrders(Integer tenantId, int batchSize) { - if (tenantId == null || tenantId <= 0) { - return 0; - } - if (batchSize <= 0) { - batchSize = 50; - } - - List waiting = gltTicketOrderService.list( - new LambdaQueryWrapper() - .select(GltTicketOrder::getId, GltTicketOrder::getUserTicketId, GltTicketOrder::getStoreId, GltTicketOrder::getAddressId, GltTicketOrder::getCreateTime) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .and(w -> w.eq(GltTicketOrder::getStatus, 0).or().isNull(GltTicketOrder::getStatus)) - .and(w -> w.eq(GltTicketOrder::getDeliveryStatus, GltTicketOrderService.DELIVERY_STATUS_WAITING) - .or().isNull(GltTicketOrder::getDeliveryStatus)) - .and(w -> w.isNull(GltTicketOrder::getRiderId).or().eq(GltTicketOrder::getRiderId, 0)) - .orderByAsc(GltTicketOrder::getCreateTime) - .orderByAsc(GltTicketOrder::getId) - .last("limit " + batchSize) - ); - - if (waiting == null || waiting.isEmpty()) { - return 0; - } - - int dispatched = 0; - // 简化实现:按门店分组,避免对同一门店重复查配送员/在途单数。 - Map poolByStoreId = new HashMap<>(); - - for (GltTicketOrder order : waiting) { - if (order == null || order.getId() == null) { - continue; - } - - LngLat receiver = resolveReceiverLngLat(tenantId, order); - if (receiver == null) { - log.debug("自动派单跳过:无法获取收货坐标 - tenantId={}, ticketOrderId={}, addressId={}", - tenantId, order.getId(), order.getAddressId()); - continue; - } - - Integer storeId = order.getStoreId(); - int storeKey = storeId == null ? -1 : storeId; - CandidatePool pool = poolByStoreId.computeIfAbsent(storeKey, k -> buildCandidatePool(tenantId, storeId)); - if (pool == null || pool.candidates.isEmpty()) { - log.debug("自动派单跳过:无可用配送员 - tenantId={}, ticketOrderId={}, storeId={}", - tenantId, order.getId(), storeId); - continue; - } - - ShopStoreRider best = pickNearest(pool, receiver); - if (best == null || best.getUserId() == null || best.getUserId() <= 0) { - log.debug("自动派单跳过:未选出配送员 - tenantId={}, ticketOrderId={}, storeId={}", - tenantId, order.getId(), storeId); - continue; - } - - try { - // 复用“接单”的原子更新 + 同步商城订单逻辑;这里的 riderId 即配送员 userId。 - gltTicketOrderService.accept(order.getId(), best.getUserId(), tenantId); - dispatched++; - - // 派单成功后,更新 pool 中该骑手的在途数(便于同批次后续订单使用 maxOnhandOrders) - pool.onhandCount.merge(best.getUserId(), 1, Integer::sum); - } catch (Exception e) { - // accept 本身包含幂等条件(riderId 为空才会写入);此处吞掉异常,避免一单影响整批。 - log.warn("自动派单失败 - tenantId={}, ticketOrderId={}, storeId={}, riderUserId={}", - tenantId, order.getId(), storeId, best.getUserId(), e); - } - } - - return dispatched; - } - - private CandidatePool buildCandidatePool(Integer tenantId, Integer storeId) { - List riders = shopStoreRiderService.list( - new LambdaQueryWrapper() - .eq(ShopStoreRider::getTenantId, tenantId) - .eq(ShopStoreRider::getIsDelete, 0) - .eq(ShopStoreRider::getStatus, 1) - .eq(ShopStoreRider::getWorkStatus, 1) // 仅在线 - .eq(ShopStoreRider::getAutoDispatchEnabled, 1) - .eq(storeId != null, ShopStoreRider::getStoreId, storeId) - ); - - if (riders == null || riders.isEmpty()) { - return new CandidatePool(List.of(), Map.of()); - } - - // 过滤无 userId/无坐标,并提前解析坐标(避免每单重复 parse) - List candidates = riders.stream() - .filter(Objects::nonNull) - .filter(r -> r.getUserId() != null && r.getUserId() > 0) - .filter(r -> parseLngLat(r.getLongitude(), r.getLatitude()) != null) - .toList(); - - if (candidates.isEmpty()) { - return new CandidatePool(List.of(), Map.of()); - } - - List riderUserIds = candidates.stream().map(ShopStoreRider::getUserId).distinct().toList(); - Map onhand = loadOnhandCounts(tenantId, riderUserIds); - return new CandidatePool(candidates, onhand); - } - - private Map loadOnhandCounts(Integer tenantId, List riderUserIds) { - if (riderUserIds == null || riderUserIds.isEmpty()) { - return new HashMap<>(); - } - - // 统计各配送员“未完成”的在途单数:10/20/30 - QueryWrapper qw = new QueryWrapper<>(); - qw.select("rider_id AS riderId", "COUNT(1) AS cnt") - .eq("tenant_id", tenantId) - .eq("deleted", 0) - .in("rider_id", riderUserIds) - .in("delivery_status", - GltTicketOrderService.DELIVERY_STATUS_WAITING, - GltTicketOrderService.DELIVERY_STATUS_DELIVERING, - GltTicketOrderService.DELIVERY_STATUS_WAIT_CONFIRM - ) - .groupBy("rider_id"); - - Map map = new HashMap<>(); - List> rows = gltTicketOrderService.listMaps(qw); - if (rows == null || rows.isEmpty()) { - return map; - } - for (Map row : rows) { - if (row == null) { - continue; - } - Object riderIdObj = row.get("riderId"); - Object cntObj = row.get("cnt"); - if (!(riderIdObj instanceof Number) || !(cntObj instanceof Number)) { - continue; - } - map.put(((Number) riderIdObj).intValue(), ((Number) cntObj).intValue()); - } - return map; - } - - private ShopStoreRider pickNearest(CandidatePool pool, LngLat receiver) { - // 优先距离;距离相同用 dispatchPriority 兜底(越大越优先);再用 userId 稳定排序 - return pool.candidates.stream() - .filter(r -> { - Integer userId = r.getUserId(); - if (userId == null || userId <= 0) { - return false; - } - int max = r.getMaxOnhandOrders() == null ? 0 : r.getMaxOnhandOrders(); - if (max <= 0) { - return true; // 0表示不限制 - } - int onhand = pool.onhandCount.getOrDefault(userId, 0); - return onhand < max; - }) - .min(Comparator - .comparingDouble((ShopStoreRider r) -> distanceMeters(receiver, parseLngLat(r.getLongitude(), r.getLatitude()))) - .thenComparingInt((ShopStoreRider r) -> -(r.getDispatchPriority() == null ? 0 : r.getDispatchPriority())) - .thenComparing(r -> r.getUserId() == null ? Integer.MAX_VALUE : r.getUserId()) - ) - .orElse(null); - } - - private static double distanceMeters(LngLat a, LngLat b) { - if (a == null || b == null) { - return Double.POSITIVE_INFINITY; - } - // Haversine - double lat1 = Math.toRadians(a.lat); - double lat2 = Math.toRadians(b.lat); - double dLat = lat2 - lat1; - double dLng = Math.toRadians(b.lng - a.lng); - double sinLat = Math.sin(dLat / 2); - double sinLng = Math.sin(dLng / 2); - double aa = sinLat * sinLat + Math.cos(lat1) * Math.cos(lat2) * sinLng * sinLng; - double c = 2 * Math.atan2(Math.sqrt(aa), Math.sqrt(1 - aa)); - return 6371000.0 * c; // Earth radius (meters) - } - - private LngLat resolveReceiverLngLat(Integer tenantId, GltTicketOrder order) { - if (order == null) { - return null; - } - - // 1) 优先使用“商城订单快照坐标”(ShopOrder.addressLat/addressLng),避免地址表坐标被事后修改影响历史订单派单。 - LngLat byOrderSnapshot = resolveReceiverLngLatFromShopOrderSnapshot(tenantId, order); - if (byOrderSnapshot != null) { - return byOrderSnapshot; - } - - // 2) 兜底:用地址表坐标(适用于没有关联商城订单的水票下单等场景) - Integer addressId = order.getAddressId(); - if (addressId == null || addressId <= 0) { - return null; - } - ShopUserAddress addr = shopUserAddressService.getOne(new LambdaQueryWrapper() - .select(ShopUserAddress::getLat, ShopUserAddress::getLng) - .eq(ShopUserAddress::getId, addressId) - .eq(ShopUserAddress::getTenantId, tenantId) - .last("limit 1")); - return addr == null ? null : parseLngLat(addr.getLng(), addr.getLat()); - } - - private LngLat resolveReceiverLngLatFromShopOrderSnapshot(Integer tenantId, GltTicketOrder ticketOrder) { - Integer userTicketId = ticketOrder.getUserTicketId(); - if (userTicketId == null || userTicketId <= 0) { - return null; - } - - GltUserTicket userTicket = gltUserTicketService.getOne(new LambdaQueryWrapper() - .select(GltUserTicket::getOrderId, GltUserTicket::getOrderNo, GltUserTicket::getOrderGoodsId) - .eq(GltUserTicket::getTenantId, tenantId) - .eq(GltUserTicket::getDeleted, 0) - .eq(GltUserTicket::getId, userTicketId) - .last("limit 1")); - if (userTicket == null) { - return null; - } - - Integer shopOrderId = userTicket.getOrderId(); - String shopOrderNo = userTicket.getOrderNo(); - - // 兼容:历史数据只写了 orderGoodsId - if (shopOrderId == null && !StringUtils.hasText(shopOrderNo) && userTicket.getOrderGoodsId() != null) { - ShopOrderGoods og = shopOrderGoodsService.getOne(new LambdaQueryWrapper() - .select(ShopOrderGoods::getOrderId) - .eq(ShopOrderGoods::getTenantId, tenantId) - .eq(ShopOrderGoods::getId, userTicket.getOrderGoodsId()) - .last("limit 1")); - if (og != null) { - shopOrderId = og.getOrderId(); - } - } - - LambdaQueryWrapper qw = new LambdaQueryWrapper() - .select(ShopOrder::getAddressLat, ShopOrder::getAddressLng) - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getDeleted, 0) - .last("limit 1"); - if (shopOrderId != null && shopOrderId > 0) { - qw.eq(ShopOrder::getOrderId, shopOrderId); - } else if (StringUtils.hasText(shopOrderNo)) { - qw.eq(ShopOrder::getOrderNo, shopOrderNo); - } else { - return null; - } - - ShopOrder shopOrder = shopOrderService.getOne(qw); - if (shopOrder == null) { - return null; - } - return parseLngLat(shopOrder.getAddressLng(), shopOrder.getAddressLat()); - } - - private static LngLat parseLngLat(String lngRaw, String latRaw) { - Double lng = parseDoubleOrNull(lngRaw); - Double lat = parseDoubleOrNull(latRaw); - if (lng == null || lat == null) { - return null; - } - - // 若明显是 (lat,lng) 则交换 - if (Math.abs(lng) <= 90 && Math.abs(lat) > 90 && Math.abs(lat) <= 180) { - double tmp = lng; - lng = lat; - lat = tmp; - } - if (Math.abs(lat) > 90 || Math.abs(lng) > 180) { - return null; - } - return new LngLat(lng, lat); - } - - private static Double parseDoubleOrNull(String raw) { - if (raw == null) { - return null; - } - String s = raw.trim(); - if (s.isEmpty()) { - return null; - } - try { - return Double.parseDouble(s); - } catch (Exception e) { - return null; - } - } - - private record LngLat(double lng, double lat) { - } - - private static final class CandidatePool { - final List candidates; - final Map onhandCount; - - CandidatePool(List candidates, Map onhandCount) { - this.candidates = candidates; - this.onhandCount = new HashMap<>(onhandCount == null ? Map.of() : onhandCount); - } - } -} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderService.java b/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderService.java deleted file mode 100644 index 9f3fc81..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderService.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.gxwebsoft.glt.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.glt.entity.GltTicketOrder; -import com.gxwebsoft.glt.param.GltTicketOrderParam; - -import java.util.List; -import java.time.LocalDateTime; - -/** - * 送水订单Service - * - * @author 科技小王子 - * @since 2026-02-05 18:50:20 - */ -public interface GltTicketOrderService extends IService { - - int DELIVERY_STATUS_WAITING = 10; - int DELIVERY_STATUS_DELIVERING = 20; - int DELIVERY_STATUS_WAIT_CONFIRM = 30; - int DELIVERY_STATUS_FINISHED = 40; - - int RECEIVE_CONFIRM_TYPE_MANUAL = 10; - int RECEIVE_CONFIRM_TYPE_PHOTO = 20; - int RECEIVE_CONFIRM_TYPE_TIMEOUT = 30; - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(GltTicketOrderParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(GltTicketOrderParam param); - - /** - * 根据id查询 - * - * @param id - * @return GltTicketOrder - */ - GltTicketOrder getByIdRel(Integer id); - - /** - * 下单(事务):校验水票 -> 扣减水票 -> 写核销记录 -> 创建送水订单。 - * - * @param gltTicketOrder 订单请求体 - * @param userId 当前登录用户ID - * @param tenantId 当前租户ID - * @return 创建后的订单(含id) - */ - GltTicketOrder createWithWriteOff(GltTicketOrder gltTicketOrder, Integer userId, Integer tenantId); - - /** - * 配送员接单(原子):仅当 riderId 为空(或0)且 deliveryStatus=10 时写入 riderId。 - */ - void accept(Integer id, Integer riderId, Integer tenantId); - - /** - * 指派/接单成功后,同步关联商城订单发货状态为“已发货”(deliveryStatus=20)。 - * - *

用于后台指派配送员(不走接单接口)等场景的状态兜底同步。

- */ - void markShopOrderShippedAfterRiderAssigned(Integer ticketOrderId, Integer tenantId, Integer riderId); - - /** - * 送水订单完成后,同步关联商城订单为“已完成”(orderStatus=1)。 - * - *

用于后台直接改 deliveryStatus=40 等不经过 confirmReceive/autoConfirmTimeout 的兜底同步。

- */ - void markShopOrderCompletedAfterTicketFinished(Integer ticketOrderId, Integer tenantId); - - /** - * 配送员开始配送:10 -> 20,并写 sendStartTime。 - */ - void start(Integer id, Integer riderId, Integer tenantId); - - /** - * 配送员确认送达:20 -> 30,并写 sendEndTime / sendEndImg。 - */ - void delivered(Integer id, Integer riderId, Integer tenantId, String sendEndImg); - - /** - * 用户确认收货:30 -> 40,并写 receiveConfirmTime / receiveConfirmType=10。 - */ - void confirmReceive(Integer id, Integer userId, Integer tenantId); - - /** - * 超时自动确认收货: - * - 扫描已送达待确认(30)且送达时间(sendEndTime)超过指定小时数的订单 - * - 自动置为已完成(40),并写 receiveConfirmTime / receiveConfirmType=30 - * - * @param tenantId 租户ID - * @param now 当前时间 - * @param timeoutHours 超时小时数(如24) - * @param batchSize 每次处理条数上限 - * @return 本次自动确认条数 - */ - int autoConfirmTimeout(Integer tenantId, LocalDateTime now, int timeoutHours, int batchSize); - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltTicketRevokeService.java b/src/main/java/com/gxwebsoft/glt/service/GltTicketRevokeService.java deleted file mode 100644 index 196be88..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/GltTicketRevokeService.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.gxwebsoft.glt.service; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.gxwebsoft.glt.entity.GltTicketOrder; -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.glt.entity.GltUserTicketRelease; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.shop.service.ShopOrderGoodsService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * 水票撤销(订单取消/退款成功后的清理): - * - 取消/隐藏用户水票(glt_user_ticket.deleted=1) - * - 删除未完成的释放计划(glt_user_ticket_release.deleted=1, status!=1) - * - 删除未完成的送水订单(glt_ticket_order.deleted=1, delivery_status!=40) - * - *

说明:该操作需保证幂等;若无关联水票则无任何副作用。

- */ -@Slf4j -@Service -@RequiredArgsConstructor -public class GltTicketRevokeService { - - /** release.status:已释放 */ - private static final int RELEASE_STATUS_DONE = 1; - /** ticketOrder.deliveryStatus:已完成 */ - private static final int TICKET_ORDER_DELIVERY_STATUS_FINISHED = 40; - - private final GltUserTicketService gltUserTicketService; - private final GltUserTicketReleaseService gltUserTicketReleaseService; - private final GltTicketOrderService gltTicketOrderService; - private final ShopOrderGoodsService shopOrderGoodsService; - - @Transactional(rollbackFor = Exception.class) - public int revokeByShopOrder(Integer tenantId, Integer shopOrderId, String shopOrderNo, String reason) { - if (tenantId == null) { - return 0; - } - if (shopOrderId == null && StrUtil.isBlank(shopOrderNo)) { - return 0; - } - - LambdaQueryWrapper qw = new LambdaQueryWrapper() - .eq(GltUserTicket::getTenantId, tenantId) - .eq(GltUserTicket::getDeleted, 0); - - if (shopOrderId != null && StrUtil.isNotBlank(shopOrderNo)) { - qw.and(w -> w.eq(GltUserTicket::getOrderId, shopOrderId).or().eq(GltUserTicket::getOrderNo, shopOrderNo)); - } else if (shopOrderId != null) { - qw.eq(GltUserTicket::getOrderId, shopOrderId); - } else { - qw.eq(GltUserTicket::getOrderNo, shopOrderNo); - } - - List tickets = gltUserTicketService.list(qw); - - // 兼容历史数据:部分水票只记录了 orderGoodsId,未记录 orderId/orderNo - if ((tickets == null || tickets.isEmpty()) && shopOrderId != null) { - try { - List goodsList = shopOrderGoodsService.list( - new LambdaQueryWrapper() - .select(ShopOrderGoods::getId) - .eq(ShopOrderGoods::getTenantId, tenantId) - .eq(ShopOrderGoods::getOrderId, shopOrderId) - ); - List orderGoodsIds = goodsList == null ? List.of() : goodsList.stream() - .map(ShopOrderGoods::getId) - .filter(id -> id != null && id > 0) - .distinct() - .toList(); - if (!orderGoodsIds.isEmpty()) { - tickets = gltUserTicketService.list( - new LambdaQueryWrapper() - .eq(GltUserTicket::getTenantId, tenantId) - .eq(GltUserTicket::getDeleted, 0) - .in(GltUserTicket::getOrderGoodsId, orderGoodsIds) - ); - } - } catch (Exception e) { - log.warn("撤销水票:通过orderGoodsId兜底反查失败 - tenantId={}, shopOrderId={}", tenantId, shopOrderId, e); - } - } - if (tickets == null || tickets.isEmpty()) { - return 0; - } - - LocalDateTime now = LocalDateTime.now(); - int revoked = 0; - // 不强制覆盖 comments,避免影响后台人工备注;reason 仅用于日志。 - String reasonForLog = StrUtil.isBlank(reason) ? "订单取消/退款撤销水票" : reason.trim(); - - // 去重(避免 orderId/orderNo 与 orderGoodsId 两种路径重复命中) - Set seen = new HashSet<>(); - for (GltUserTicket t : tickets) { - if (t == null || t.getId() == null) { - continue; - } - if (!seen.add(t.getId())) { - continue; - } - - Integer userTicketId = t.getId(); - - // 1) 删除未完成的送水订单(避免继续配送/接单/确认) - try { - LambdaUpdateWrapper uw = new LambdaUpdateWrapper() - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .eq(GltTicketOrder::getUserTicketId, userTicketId) - // 兼容历史/脏数据:deliveryStatus 为空时也按“未完成”处理 - .and(w -> w.ne(GltTicketOrder::getDeliveryStatus, TICKET_ORDER_DELIVERY_STATUS_FINISHED) - .or().isNull(GltTicketOrder::getDeliveryStatus)) - .set(GltTicketOrder::getDeleted, 1) - .set(GltTicketOrder::getUpdateTime, now); - gltTicketOrderService.update(null, uw); - } catch (Exception e) { - log.warn("撤销送水订单失败(继续尝试撤销水票/释放计划) - tenantId={}, shopOrderId={}, userTicketId={}", - tenantId, shopOrderId, userTicketId, e); - } - - // 2) 删除未完成的释放计划(防止后续继续自动释放) - try { - LambdaUpdateWrapper uw = new LambdaUpdateWrapper() - .eq(GltUserTicketRelease::getTenantId, tenantId) - .eq(GltUserTicketRelease::getDeleted, 0) - .eq(GltUserTicketRelease::getUserTicketId, userTicketId.longValue()) - // status 为空时也视为“未完成” - .and(w -> w.ne(GltUserTicketRelease::getStatus, RELEASE_STATUS_DONE) - .or().isNull(GltUserTicketRelease::getStatus)) - .set(GltUserTicketRelease::getDeleted, 1) - .set(GltUserTicketRelease::getUpdateTime, now); - gltUserTicketReleaseService.update(null, uw); - } catch (Exception e) { - log.warn("撤销水票释放计划失败(继续尝试撤销水票) - tenantId={}, shopOrderId={}, userTicketId={}", - tenantId, shopOrderId, userTicketId, e); - } - - // 3) 撤销水票本身(软删除;幂等) - boolean ok = gltUserTicketService.update( - null, - new LambdaUpdateWrapper() - .eq(GltUserTicket::getTenantId, tenantId) - .eq(GltUserTicket::getDeleted, 0) - .eq(GltUserTicket::getId, userTicketId) - .set(GltUserTicket::getDeleted, 1) - .set(GltUserTicket::getUpdateTime, now) - ); - if (ok) { - revoked++; - } - } - - log.info("撤销水票完成 - tenantId={}, shopOrderId={}, shopOrderNo={}, tickets={}, reason={}", - tenantId, shopOrderId, shopOrderNo, revoked, reasonForLog); - return revoked; - } -} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltTicketTemplateService.java b/src/main/java/com/gxwebsoft/glt/service/GltTicketTemplateService.java deleted file mode 100644 index 8ebb330..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/GltTicketTemplateService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.glt.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.glt.entity.GltTicketTemplate; -import com.gxwebsoft.glt.param.GltTicketTemplateParam; - -import java.util.List; - -/** - * 水票Service - * - * @author 科技小王子 - * @since 2026-02-03 18:55:54 - */ -public interface GltTicketTemplateService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(GltTicketTemplateParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(GltTicketTemplateParam param); - - /** - * 根据id查询 - * - * @param id - * @return GltTicketTemplate - */ - GltTicketTemplate getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketAutoReleaseService.java b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketAutoReleaseService.java deleted file mode 100644 index 83a7fb3..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketAutoReleaseService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.gxwebsoft.glt.service; - -import java.time.LocalDateTime; - -/** - * 冻结水票自动释放(到达 release_time 后执行:frozen -> available)。 - */ -public interface GltUserTicketAutoReleaseService { - - /** - * 释放到期的冻结水票 - * - * @param now 当前时间(用于测试/可控时钟) - * @param batchSize 单次处理上限 - * @return 成功释放的条数 - */ - int releaseDue(LocalDateTime now, int batchSize); - - /** - * 释放到期的冻结水票(使用系统当前时间) - */ - default int releaseDue(int batchSize) { - return releaseDue(LocalDateTime.now(), batchSize); - } -} - diff --git a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketLogService.java b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketLogService.java deleted file mode 100644 index 7bdda87..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketLogService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.glt.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.glt.entity.GltUserTicketLog; -import com.gxwebsoft.glt.param.GltUserTicketLogParam; - -import java.util.List; - -/** - * 消费日志Service - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -public interface GltUserTicketLogService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(GltUserTicketLogParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(GltUserTicketLogParam param); - - /** - * 根据id查询 - * - * @param id - * @return GltUserTicketLog - */ - GltUserTicketLog getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketReleaseService.java b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketReleaseService.java deleted file mode 100644 index f023cf8..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketReleaseService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.glt.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.glt.entity.GltUserTicketRelease; -import com.gxwebsoft.glt.param.GltUserTicketReleaseParam; - -import java.util.List; - -/** - * 水票释放Service - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -public interface GltUserTicketReleaseService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(GltUserTicketReleaseParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(GltUserTicketReleaseParam param); - - /** - * 根据id查询 - * - * @param id - * @return GltUserTicketRelease - */ - GltUserTicketRelease getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketService.java b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketService.java deleted file mode 100644 index 615ef75..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketService.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.gxwebsoft.glt.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.glt.param.GltUserTicketParam; - -import java.util.List; - -/** - * 我的水票Service - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -public interface GltUserTicketService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(GltUserTicketParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(GltUserTicketParam param); - - /** - * 根据id查询 - * - * @param id - * @return GltUserTicket - */ - GltUserTicket getByIdRel(Integer id); - - /** - * 统计指定用户可用水票总数(sum(available_qty)) - * - * @param userId 用户ID - * @param tenantId 租户ID - * @return 可用总数(无记录返回0) - */ - Integer sumAvailableQtyByUserId(Integer userId, Integer tenantId); - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltTicketOrderServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltTicketOrderServiceImpl.java deleted file mode 100644 index d9dcb41..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/impl/GltTicketOrderServiceImpl.java +++ /dev/null @@ -1,923 +0,0 @@ -package com.gxwebsoft.glt.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.exception.BusinessException; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.common.system.mapper.UserMapper; -import com.gxwebsoft.glt.entity.GltTicketOrder; -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.glt.entity.GltUserTicketLog; -import com.gxwebsoft.glt.mapper.GltTicketOrderMapper; -import com.gxwebsoft.glt.mapper.GltUserTicketMapper; -import com.gxwebsoft.glt.param.GltTicketOrderParam; -import com.gxwebsoft.glt.service.GltTicketOrderService; -import com.gxwebsoft.glt.service.GltUserTicketLogService; -import com.gxwebsoft.glt.service.GltUserTicketService; -import com.gxwebsoft.shop.entity.ShopDealerCapital; -import com.gxwebsoft.shop.entity.ShopDealerUser; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.shop.service.ShopDealerCapitalService; -import com.gxwebsoft.shop.service.ShopDealerUserService; -import com.gxwebsoft.shop.service.ShopOrderGoodsService; -import com.gxwebsoft.shop.service.ShopOrderService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.util.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.transaction.support.TransactionTemplate; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; -import java.time.LocalDateTime; -import java.util.List; - -/** - * 送水订单Service实现 - * - * @author 科技小王子 - * @since 2026-02-05 18:50:20 - */ -@Slf4j -@Service -public class GltTicketOrderServiceImpl extends ServiceImpl implements GltTicketOrderService { - - public static final int CHANGE_TYPE_WRITE_OFF = 20; - private static final BigDecimal RIDER_UNIT_COMMISSION = new BigDecimal("0.10"); - private static final int RIDER_COMMISSION_SCALE = 2; - private static final int TENANT_ID_10584 = 10584; - private static final DateTimeFormatter SEND_TIME_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - - @Resource - private GltUserTicketMapper gltUserTicketMapper; - - @Resource - private GltUserTicketService gltUserTicketService; - - @Resource - private GltUserTicketLogService gltUserTicketLogService; - - @Resource - private TransactionTemplate transactionTemplate; - - @Resource - private ShopDealerUserService shopDealerUserService; - - @Resource - private ShopDealerCapitalService shopDealerCapitalService; - - @Resource - private UserMapper userMapper; - - @Resource - private ShopOrderService shopOrderService; - - @Resource - private ShopOrderGoodsService shopOrderGoodsService; - - @Override - public PageResult pageRel(GltTicketOrderParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(GltTicketOrderParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public GltTicketOrder getByIdRel(Integer id) { - GltTicketOrderParam param = new GltTicketOrderParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public GltTicketOrder createWithWriteOff(GltTicketOrder gltTicketOrder, Integer userId, Integer tenantId) { - if (gltTicketOrder == null) { - throw new BusinessException("订单参数不能为空"); - } - if (userId == null) { - throw new BusinessException("请先登录"); - } - Integer userTicketId = gltTicketOrder.getUserTicketId(); - if (userTicketId == null) { - throw new BusinessException("userTicketId不能为空"); - } - int totalNum = gltTicketOrder.getTotalNum() == null ? 0 : gltTicketOrder.getTotalNum(); - if (totalNum <= 0) { - throw new BusinessException("totalNum必须大于0"); - } - if (tenantId == null) { - throw new BusinessException("租户信息缺失"); - } - - // 1) 校验水票归属当前用户 + 正常状态,并锁定记录,避免并发扣减导致日志不准确 - GltUserTicket userTicket = gltUserTicketMapper.selectByIdForUpdate(userTicketId, userId, tenantId); - if (userTicket == null) { - throw new BusinessException("水票不存在、已失效或无权限"); - } - int availableQty = userTicket.getAvailableQty() == null ? 0 : userTicket.getAvailableQty(); - int usedQty = userTicket.getUsedQty() == null ? 0 : userTicket.getUsedQty(); - if (availableQty < totalNum) { - throw new BusinessException("水票数量不足"); - } - - // 2) 更新 glt_user_ticket: availableQty -= totalNum, usedQty += totalNum - LocalDateTime now = LocalDateTime.now(); - int availableAfter = availableQty - totalNum; - int usedAfter = usedQty + totalNum; - userTicket.setAvailableQty(availableAfter); - userTicket.setUsedQty(usedAfter); - userTicket.setUpdateTime(now); - if (!gltUserTicketService.updateById(userTicket)) { - throw new BusinessException("扣减水票失败"); - } - - // 4) 插入 glt_ticket_order(storeId/addressId/totalNum/buyerRemarks…) - gltTicketOrder.setUserId(userId); - // 订单基础字段由后端兜底,避免前端误传/恶意传参 - gltTicketOrder.setStatus(0); - gltTicketOrder.setDeleted(0); - gltTicketOrder.setTenantId(tenantId); - // 关联商城订单号(用于后台/对账/追踪);优先取水票上的 orderNo,缺失则按 orderId/orderGoodsId 兜底反查。 - gltTicketOrder.setOrderNo(resolveShopOrderNo(userTicket, tenantId)); - if (gltTicketOrder.getDeliveryStatus() == null) { - gltTicketOrder.setDeliveryStatus(DELIVERY_STATUS_WAITING); - } - if (gltTicketOrder.getSortNumber() == null) { - gltTicketOrder.setSortNumber(0); - } - if (gltTicketOrder.getCreateTime() == null) { - gltTicketOrder.setCreateTime(now); - } - // “立刻送水”下单场景不再需要前端选择配送时间;若未传则默认当前时间,便于排序与派单。 - if (!StringUtils.hasText(gltTicketOrder.getSendTime())) { - gltTicketOrder.setSendTime(now.format(SEND_TIME_FMT)); - } - gltTicketOrder.setUpdateTime(now); - if (!this.save(gltTicketOrder)) { - throw new BusinessException("创建订单失败"); - } - - // 3) 插入 glt_user_ticket_log(核销记录) - GltUserTicketLog log = new GltUserTicketLog(); - log.setUserTicketId(userTicketId); - log.setChangeType(CHANGE_TYPE_WRITE_OFF); - log.setChangeAvailable(-totalNum); - log.setChangeFrozen(0); - log.setChangeUsed(totalNum); - log.setAvailableAfter(availableAfter); - log.setFrozenAfter(userTicket.getFrozenQty() == null ? 0 : userTicket.getFrozenQty()); - log.setUsedAfter(usedAfter); - log.setOrderId(gltTicketOrder.getId()); - log.setOrderNo(gltTicketOrder.getId() == null ? null : String.valueOf(gltTicketOrder.getId())); - log.setUserId(userId); - log.setSortNumber(0); - String comments = gltTicketOrder.getComments(); - if (StrUtil.isBlank(comments)) { - comments = gltTicketOrder.getBuyerRemarks(); - } - if (StrUtil.isBlank(comments)) { - comments = "水票下单核销"; - } - log.setComments(comments); - log.setStatus(0); - log.setDeleted(0); - log.setTenantId(tenantId); - log.setCreateTime(now); - log.setUpdateTime(now); - if (!gltUserTicketLogService.save(log)) { - throw new BusinessException("写入核销记录失败"); - } - - return gltTicketOrder; - } - - private String resolveShopOrderNo(GltUserTicket userTicket, Integer tenantId) { - if (userTicket == null || tenantId == null) { - return null; - } - if (StringUtils.hasText(userTicket.getOrderNo())) { - return userTicket.getOrderNo(); - } - - Integer orderId = userTicket.getOrderId(); - // 兜底:历史数据可能只写了 orderGoodsId,未写 orderId/orderNo - if (orderId == null && userTicket.getOrderGoodsId() != null) { - ShopOrderGoods og = shopOrderGoodsService.getOne( - new LambdaQueryWrapper() - .select(ShopOrderGoods::getOrderId) - .eq(ShopOrderGoods::getTenantId, tenantId) - .eq(ShopOrderGoods::getId, userTicket.getOrderGoodsId()) - .last("limit 1") - ); - if (og != null) { - orderId = og.getOrderId(); - } - } - if (orderId == null) { - return null; - } - - ShopOrder order = shopOrderService.getOne( - new LambdaQueryWrapper() - .select(ShopOrder::getOrderNo) - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getDeleted, 0) - .eq(ShopOrder::getOrderId, orderId) - .last("limit 1") - ); - return order == null ? null : order.getOrderNo(); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void accept(Integer id, Integer riderId, Integer tenantId) { - if (id == null) { - throw new BusinessException("订单id不能为空"); - } - if (riderId == null) { - throw new BusinessException("配送员信息缺失"); - } - if (tenantId == null) { - throw new BusinessException("租户信息缺失"); - } - - // 原子接单:避免并发抢单 - LocalDateTime now = LocalDateTime.now(); - boolean ok = this.lambdaUpdate() - .set(GltTicketOrder::getRiderId, riderId) - .set(GltTicketOrder::getUpdateTime, now) - .eq(GltTicketOrder::getId, id) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .and(w -> w.eq(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_WAITING) - .or().isNull(GltTicketOrder::getDeliveryStatus)) - .and(w -> w.isNull(GltTicketOrder::getRiderId).or().eq(GltTicketOrder::getRiderId, 0)) - .update(); - if (ok) { - // 接单成功后,同步商城订单发货状态:10未发货 -> 20已发货 - updateShopOrderDeliveryStatusAfterAccept(id, tenantId, riderId, now); - return; - } - - // 回查给出更明确的错误 - GltTicketOrder order = this.lambdaQuery() - .eq(GltTicketOrder::getId, id) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .one(); - if (order == null) { - throw new BusinessException("订单不存在"); - } - if (order.getRiderId() != null && order.getRiderId() > 0) { - throw new BusinessException("订单已被其他配送员接单"); - } - throw new BusinessException("订单状态不允许接单"); - } - - @Override - public void markShopOrderShippedAfterRiderAssigned(Integer ticketOrderId, Integer tenantId, Integer riderId) { - updateShopOrderDeliveryStatusAfterAccept(ticketOrderId, tenantId, riderId, LocalDateTime.now()); - } - - @Override - public void markShopOrderCompletedAfterTicketFinished(Integer ticketOrderId, Integer tenantId) { - updateShopOrderOrderStatusAfterTicketFinished(ticketOrderId, tenantId, LocalDateTime.now()); - } - - private void updateShopOrderDeliveryStatusAfterAccept(Integer ticketOrderId, Integer tenantId, Integer riderId, LocalDateTime now) { - if (ticketOrderId == null || tenantId == null) { - return; - } - - // 找到关联水票的商城订单(glt_user_ticket.orderId / orderNo) - GltTicketOrder ticketOrder = this.lambdaQuery() - .select(GltTicketOrder::getId, GltTicketOrder::getUserTicketId, GltTicketOrder::getRiderId) - .eq(GltTicketOrder::getId, ticketOrderId) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .last("limit 1") - .one(); - if (ticketOrder == null || ticketOrder.getUserTicketId() == null) { - return; - } - - Integer actualRiderId = (riderId != null && riderId > 0) ? riderId : ticketOrder.getRiderId(); - - GltUserTicket userTicket = gltUserTicketService.getOne( - new LambdaQueryWrapper() - .eq(GltUserTicket::getTenantId, tenantId) - .eq(GltUserTicket::getDeleted, 0) - .eq(GltUserTicket::getId, ticketOrder.getUserTicketId()) - .last("limit 1") - ); - if (userTicket == null) { - return; - } - - Integer shopOrderId = userTicket.getOrderId(); - String shopOrderNo = userTicket.getOrderNo(); - boolean resolvedByOrderGoodsId = false; - // 兼容历史数据:部分水票可能只写了 orderGoodsId(未写 orderId/orderNo),此处兜底通过 orderGoodsId 反查 ShopOrder.orderId。 - if (shopOrderId == null && !StringUtils.hasText(shopOrderNo) && userTicket.getOrderGoodsId() != null) { - ShopOrderGoods og = shopOrderGoodsService.getOne( - new LambdaQueryWrapper() - .select(ShopOrderGoods::getOrderId) - .eq(ShopOrderGoods::getTenantId, tenantId) - .eq(ShopOrderGoods::getId, userTicket.getOrderGoodsId()) - .last("limit 1") - ); - if (og != null) { - shopOrderId = og.getOrderId(); - resolvedByOrderGoodsId = shopOrderId != null; - } - } - if (shopOrderId == null && !StringUtils.hasText(shopOrderNo)) { - log.warn("同步商城订单发货状态失败:未找到关联商城订单 - tenantId={}, ticketOrderId={}, userTicketId={}, userTicket.orderId={}, userTicket.orderNo={}, userTicket.orderGoodsId={}", - tenantId, ticketOrderId, userTicket.getId(), userTicket.getOrderId(), userTicket.getOrderNo(), userTicket.getOrderGoodsId()); - return; - } - // 若是通过 orderGoodsId 兜底反查到 orderId,则顺便回填 glt_user_ticket.order_id/order_no,减少后续同步/查询依赖兜底分支。 - if (resolvedByOrderGoodsId && userTicket.getOrderId() == null && shopOrderId != null) { - if (!StringUtils.hasText(shopOrderNo)) { - ShopOrder order = shopOrderService.getOne( - new LambdaQueryWrapper() - .select(ShopOrder::getOrderNo) - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getDeleted, 0) - .eq(ShopOrder::getOrderId, shopOrderId) - .last("limit 1") - ); - if (order != null) { - shopOrderNo = order.getOrderNo(); - } - } - - LambdaUpdateWrapper backfill = new LambdaUpdateWrapper() - .eq(GltUserTicket::getTenantId, tenantId) - .eq(GltUserTicket::getDeleted, 0) - .eq(GltUserTicket::getId, userTicket.getId()); - backfill.set(GltUserTicket::getOrderId, shopOrderId); - if (!StringUtils.hasText(userTicket.getOrderNo()) && StringUtils.hasText(shopOrderNo)) { - backfill.set(GltUserTicket::getOrderNo, shopOrderNo); - } - backfill.set(GltUserTicket::getUpdateTime, now); - try { - gltUserTicketService.update(backfill); - } catch (Exception e) { - log.debug("回填水票关联商城订单信息失败(不影响主流程) - tenantId={}, userTicketId={}, orderId={}, orderNo={}", - tenantId, userTicket.getId(), shopOrderId, shopOrderNo, e); - } - } - - LambdaUpdateWrapper uw = new LambdaUpdateWrapper() - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getDeleted, 0) - // deliveryStatus 已经是 20 时也可能需要补写/更新 riderId,因此条件包含 riderId 不一致的场景 - .and(w -> { - w.ne(ShopOrder::getDeliveryStatus, 20).or().isNull(ShopOrder::getDeliveryStatus); - if (actualRiderId != null && actualRiderId > 0) { - w.or().ne(ShopOrder::getRiderId, actualRiderId).or().isNull(ShopOrder::getRiderId); - } - }) - .set(ShopOrder::getDeliveryStatus, 20) - .set(ShopOrder::getUpdateTime, now); - if (actualRiderId != null && actualRiderId > 0) { - uw.set(ShopOrder::getRiderId, actualRiderId); - } - if (shopOrderId != null) { - uw.eq(ShopOrder::getOrderId, shopOrderId); - } else { - uw.eq(ShopOrder::getOrderNo, shopOrderNo); - } - - boolean updated = shopOrderService.update(uw); - if (updated) { - return; - } - - // 幂等:若已是 20,则视为成功;否则记录日志便于排查关联关系/数据缺失 - LambdaQueryWrapper qw = new LambdaQueryWrapper() - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getDeleted, 0) - .eq(ShopOrder::getDeliveryStatus, 20); - if (actualRiderId != null && actualRiderId > 0) { - qw.eq(ShopOrder::getRiderId, actualRiderId); - } - if (shopOrderId != null) { - qw.eq(ShopOrder::getOrderId, shopOrderId); - } else { - qw.eq(ShopOrder::getOrderNo, shopOrderNo); - } - if (shopOrderService.count(qw) <= 0) { - log.warn("接单/指派成功但同步商城订单发货状态/配送员失败 - tenantId={}, ticketOrderId={}, riderId={}, shopOrderId={}, shopOrderNo={}", - tenantId, ticketOrderId, actualRiderId, shopOrderId, shopOrderNo); - } - } - - @Override - public void start(Integer id, Integer riderId, Integer tenantId) { - if (id == null) { - throw new BusinessException("订单id不能为空"); - } - if (riderId == null) { - throw new BusinessException("配送员信息缺失"); - } - if (tenantId == null) { - throw new BusinessException("租户信息缺失"); - } - - LocalDateTime now = LocalDateTime.now(); - boolean ok = this.lambdaUpdate() - .set(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_DELIVERING) - .set(GltTicketOrder::getSendStartTime, now) - .set(GltTicketOrder::getUpdateTime, now) - .eq(GltTicketOrder::getId, id) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .eq(GltTicketOrder::getRiderId, riderId) - .and(w -> w.eq(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_WAITING) - .or().isNull(GltTicketOrder::getDeliveryStatus)) - .update(); - if (ok) { - return; - } - - GltTicketOrder order = this.lambdaQuery() - .eq(GltTicketOrder::getId, id) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .one(); - if (order == null) { - throw new BusinessException("订单不存在"); - } - if (!riderId.equals(order.getRiderId())) { - throw new BusinessException("无权限操作该订单"); - } - if (order.getDeliveryStatus() != null && order.getDeliveryStatus() == DELIVERY_STATUS_DELIVERING) { - // 幂等:重复开始配送视为成功 - return; - } - throw new BusinessException("订单状态不允许开始配送"); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delivered(Integer id, Integer riderId, Integer tenantId, String sendEndImg) { - if (id == null) { - throw new BusinessException("订单id不能为空"); - } - if (riderId == null) { - throw new BusinessException("配送员信息缺失"); - } - if (tenantId == null) { - throw new BusinessException("租户信息缺失"); - } - - LocalDateTime now = LocalDateTime.now(); - var update = this.lambdaUpdate() - .set(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_WAIT_CONFIRM) - .set(GltTicketOrder::getSendEndTime, now) - .set(GltTicketOrder::getUpdateTime, now); - if (StringUtils.hasText(sendEndImg)) { - update.set(GltTicketOrder::getSendEndImg, sendEndImg); - } - boolean ok = update - .eq(GltTicketOrder::getId, id) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .eq(GltTicketOrder::getRiderId, riderId) - .eq(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_DELIVERING) - .update(); - if (ok) { - // 配送员拍照上传送达后可触发提成结算(幂等,重复调用不会重复入账) - settleRiderCommissionIfEligible(id, tenantId, true); - // 配送员确认送达后,同步商城订单为“已完成”(orderStatus=1) - updateShopOrderOrderStatusAfterTicketFinished(id, tenantId, now); - return; - } - - GltTicketOrder order = this.lambdaQuery() - .eq(GltTicketOrder::getId, id) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .one(); - if (order == null) { - throw new BusinessException("订单不存在"); - } - if (!riderId.equals(order.getRiderId())) { - throw new BusinessException("无权限操作该订单"); - } - if (order.getDeliveryStatus() != null - && (order.getDeliveryStatus() == DELIVERY_STATUS_WAIT_CONFIRM - || order.getDeliveryStatus() == DELIVERY_STATUS_FINISHED)) { - // 幂等:重复送达视为成功 - settleRiderCommissionIfEligible(id, tenantId, true); - updateShopOrderOrderStatusAfterTicketFinished(id, tenantId, LocalDateTime.now()); - return; - } - throw new BusinessException("订单状态不允许确认送达"); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void confirmReceive(Integer id, Integer userId, Integer tenantId) { - if (id == null) { - throw new BusinessException("订单id不能为空"); - } - if (userId == null) { - throw new BusinessException("请先登录"); - } - if (tenantId == null) { - throw new BusinessException("租户信息缺失"); - } - - LocalDateTime now = LocalDateTime.now(); - boolean ok = this.lambdaUpdate() - .set(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_FINISHED) - .set(GltTicketOrder::getReceiveConfirmTime, now) - .set(GltTicketOrder::getReceiveConfirmType, RECEIVE_CONFIRM_TYPE_MANUAL) - .set(GltTicketOrder::getUpdateTime, now) - .eq(GltTicketOrder::getId, id) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .eq(GltTicketOrder::getUserId, userId) - .eq(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_WAIT_CONFIRM) - .update(); - if (ok) { - // 用户确认收货完成后触发配送员提成结算(幂等,重复调用不会重复入账) - settleRiderCommissionIfEligible(id, tenantId, false); - // 送水订单完成后,同步商城订单为“已完成”(orderStatus=1) - updateShopOrderOrderStatusAfterTicketFinished(id, tenantId, now); - return; - } - - GltTicketOrder order = this.lambdaQuery() - .eq(GltTicketOrder::getId, id) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .one(); - if (order == null) { - throw new BusinessException("订单不存在"); - } - if (!userId.equals(order.getUserId())) { - throw new BusinessException("无权限操作该订单"); - } - if (order.getDeliveryStatus() != null && order.getDeliveryStatus() == DELIVERY_STATUS_FINISHED) { - // 幂等:重复确认收货视为成功 - settleRiderCommissionIfEligible(id, tenantId, false); - updateShopOrderOrderStatusAfterTicketFinished(id, tenantId, LocalDateTime.now()); - return; - } - throw new BusinessException("订单状态不允许确认收货"); - } - - @Override - public int autoConfirmTimeout(Integer tenantId, LocalDateTime now, int timeoutHours, int batchSize) { - if (tenantId == null) { - return 0; - } - if (now == null) { - now = LocalDateTime.now(); - } - int hours = Math.max(timeoutHours, 1); - int limit = Math.max(batchSize, 1); - LocalDateTime deadline = now.minusHours(hours); - - List candidates = this.lambdaQuery() - .select(GltTicketOrder::getId) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .eq(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_WAIT_CONFIRM) - .isNotNull(GltTicketOrder::getSendEndTime) - .le(GltTicketOrder::getSendEndTime, deadline) - .orderByAsc(GltTicketOrder::getSendEndTime) - .orderByAsc(GltTicketOrder::getId) - .last("limit " + limit) - .list(); - if (candidates == null || candidates.isEmpty()) { - return 0; - } - - int confirmed = 0; - for (GltTicketOrder item : candidates) { - Integer id = item != null ? item.getId() : null; - if (id == null) { - continue; - } - try { - final LocalDateTime nowFinal = now; - final LocalDateTime deadlineFinal = deadline; - Boolean ok = transactionTemplate.execute(status -> { - boolean updated = this.lambdaUpdate() - .set(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_FINISHED) - .set(GltTicketOrder::getReceiveConfirmTime, nowFinal) - .set(GltTicketOrder::getReceiveConfirmType, RECEIVE_CONFIRM_TYPE_TIMEOUT) - .set(GltTicketOrder::getUpdateTime, nowFinal) - .eq(GltTicketOrder::getId, id) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .eq(GltTicketOrder::getDeliveryStatus, DELIVERY_STATUS_WAIT_CONFIRM) - .le(GltTicketOrder::getSendEndTime, deadlineFinal) - .update(); - if (!updated) { - return false; - } - // 超时自动确认收货后,也按“完成”逻辑触发配送员提成结算(幂等)。 - settleRiderCommissionIfEligible(id, tenantId, false); - updateShopOrderOrderStatusAfterTicketFinished(id, tenantId, nowFinal); - return true; - }); - if (Boolean.TRUE.equals(ok)) { - confirmed++; - } - } catch (Exception e) { - log.warn("送水订单超时自动确认收货失败 - tenantId={}, ticketOrderId={}", tenantId, id, e); - } - } - return confirmed; - } - - private void updateShopOrderOrderStatusAfterTicketFinished(Integer ticketOrderId, Integer tenantId, LocalDateTime now) { - if (ticketOrderId == null || tenantId == null) { - return; - } - if (now == null) { - now = LocalDateTime.now(); - } - - // 找到关联水票的商城订单(glt_user_ticket.orderId / orderNo) - GltTicketOrder ticketOrder = this.lambdaQuery() - .select(GltTicketOrder::getId, GltTicketOrder::getUserTicketId) - .eq(GltTicketOrder::getId, ticketOrderId) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .last("limit 1") - .one(); - if (ticketOrder == null || ticketOrder.getUserTicketId() == null) { - return; - } - - GltUserTicket userTicket = gltUserTicketService.getOne( - new LambdaQueryWrapper() - .eq(GltUserTicket::getTenantId, tenantId) - .eq(GltUserTicket::getDeleted, 0) - .eq(GltUserTicket::getId, ticketOrder.getUserTicketId()) - .last("limit 1") - ); - if (userTicket == null) { - return; - } - - Integer shopOrderId = userTicket.getOrderId(); - String shopOrderNo = userTicket.getOrderNo(); - boolean resolvedByOrderGoodsId = false; - // 兼容历史数据:部分水票可能只写了 orderGoodsId(未写 orderId/orderNo),此处兜底通过 orderGoodsId 反查 ShopOrder.orderId。 - if (shopOrderId == null && !StringUtils.hasText(shopOrderNo) && userTicket.getOrderGoodsId() != null) { - ShopOrderGoods og = shopOrderGoodsService.getOne( - new LambdaQueryWrapper() - .select(ShopOrderGoods::getOrderId) - .eq(ShopOrderGoods::getTenantId, tenantId) - .eq(ShopOrderGoods::getId, userTicket.getOrderGoodsId()) - .last("limit 1") - ); - if (og != null) { - shopOrderId = og.getOrderId(); - resolvedByOrderGoodsId = shopOrderId != null; - } - } - if (shopOrderId == null && !StringUtils.hasText(shopOrderNo)) { - log.warn("送水订单完成但未找到关联商城订单,无法同步完成状态 - tenantId={}, ticketOrderId={}, userTicketId={}, userTicket.orderId={}, userTicket.orderNo={}, userTicket.orderGoodsId={}", - tenantId, ticketOrderId, userTicket.getId(), userTicket.getOrderId(), userTicket.getOrderNo(), userTicket.getOrderGoodsId()); - return; - } - // 若是通过 orderGoodsId 兜底反查到 orderId,则顺便回填 glt_user_ticket.order_id/order_no,减少后续同步/查询依赖兜底分支。 - if (resolvedByOrderGoodsId && userTicket.getOrderId() == null && shopOrderId != null) { - if (!StringUtils.hasText(shopOrderNo)) { - ShopOrder order = shopOrderService.getOne( - new LambdaQueryWrapper() - .select(ShopOrder::getOrderNo) - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getDeleted, 0) - .eq(ShopOrder::getOrderId, shopOrderId) - .last("limit 1") - ); - if (order != null) { - shopOrderNo = order.getOrderNo(); - } - } - - LambdaUpdateWrapper backfill = new LambdaUpdateWrapper() - .eq(GltUserTicket::getTenantId, tenantId) - .eq(GltUserTicket::getDeleted, 0) - .eq(GltUserTicket::getId, userTicket.getId()); - backfill.set(GltUserTicket::getOrderId, shopOrderId); - if (!StringUtils.hasText(userTicket.getOrderNo()) && StringUtils.hasText(shopOrderNo)) { - backfill.set(GltUserTicket::getOrderNo, shopOrderNo); - } - backfill.set(GltUserTicket::getUpdateTime, now); - try { - gltUserTicketService.update(backfill); - } catch (Exception e) { - log.debug("回填水票关联商城订单信息失败(不影响主流程) - tenantId={}, userTicketId={}, orderId={}, orderNo={}", - tenantId, userTicket.getId(), shopOrderId, shopOrderNo, e); - } - } - - LambdaUpdateWrapper uw = new LambdaUpdateWrapper() - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getDeleted, 0) - .and(w -> w.ne(ShopOrder::getOrderStatus, 1).or().isNull(ShopOrder::getOrderStatus)) - .set(ShopOrder::getOrderStatus, 1) - .set(ShopOrder::getUpdateTime, now); - if (shopOrderId != null) { - uw.eq(ShopOrder::getOrderId, shopOrderId); - } else { - uw.eq(ShopOrder::getOrderNo, shopOrderNo); - } - - boolean updated = shopOrderService.update(uw); - if (updated) { - return; - } - - // 幂等:若已是 1,则视为成功;否则记录日志便于排查关联关系/数据缺失 - LambdaQueryWrapper qw = new LambdaQueryWrapper() - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getDeleted, 0) - .eq(ShopOrder::getOrderStatus, 1); - if (shopOrderId != null) { - qw.eq(ShopOrder::getOrderId, shopOrderId); - } else { - qw.eq(ShopOrder::getOrderNo, shopOrderNo); - } - if (shopOrderService.count(qw) <= 0) { - log.warn("送水订单完成但同步商城订单完成状态失败 - tenantId={}, ticketOrderId={}, shopOrderId={}, shopOrderNo={}", - tenantId, ticketOrderId, shopOrderId, shopOrderNo); - } - } - - private void settleRiderCommissionIfEligible(Integer ticketOrderId, Integer tenantId, boolean requirePhoto) { - if (ticketOrderId == null || tenantId == null) { - return; - } - // 目前仅租户10584启用该提成规则,避免影响其他租户历史逻辑。 - if (tenantId != TENANT_ID_10584) { - return; - } - - transactionTemplate.executeWithoutResult(status -> { - // 锁定送水订单行:避免并发下重复结算(如:配送员送达&用户确认收货同时触发) - GltTicketOrder order = this.lambdaQuery() - .eq(GltTicketOrder::getId, ticketOrderId) - .eq(GltTicketOrder::getTenantId, tenantId) - .eq(GltTicketOrder::getDeleted, 0) - .last("limit 1 for update") - .one(); - if (order == null) { - return; - } - - Integer riderId = order.getRiderId(); - if (riderId == null || riderId <= 0) { - return; - } - - Integer deliveryStatus = order.getDeliveryStatus(); - if (requirePhoto) { - // 配送员拍照上传触发:至少需要到“待客户确认”或“已完成”状态,且存在送达照片。 - if (deliveryStatus == null || (deliveryStatus != DELIVERY_STATUS_WAIT_CONFIRM && deliveryStatus != DELIVERY_STATUS_FINISHED)) { - return; - } - if (!StringUtils.hasText(order.getSendEndImg())) { - return; - } - } else { - // 用户确认收货触发:必须为“已完成”状态。 - if (deliveryStatus == null || deliveryStatus != DELIVERY_STATUS_FINISHED) { - return; - } - } - - int qty = order.getTotalNum() == null ? 0 : order.getTotalNum(); - if (qty <= 0) { - return; - } - - BigDecimal money = RIDER_UNIT_COMMISSION - .multiply(BigDecimal.valueOf(qty)) - .setScale(RIDER_COMMISSION_SCALE, RoundingMode.HALF_UP); - if (money.signum() <= 0) { - return; - } - - String orderNo = "gltTicketOrder:" + order.getId(); - String comments = "配送员提成(ticketOrderId=" + order.getId() + ",unit=" + RIDER_UNIT_COMMISSION + ",qty=" + qty + ")"; - - // 幂等:同一送水订单同一配送员只结算一次 - boolean already = shopDealerCapitalService.count( - new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper() - .eq(ShopDealerCapital::getTenantId, tenantId) - .eq(ShopDealerCapital::getFlowType, 10) - .eq(ShopDealerCapital::getUserId, riderId) - .eq(ShopDealerCapital::getOrderNo, orderNo) - .likeRight(ShopDealerCapital::getComments, "配送员提成(ticketOrderId=" + order.getId() + ",") - ) > 0; - if (already) { - return; - } - - // 送水订单提成:先入冻结金额 freeze_money(与分销订单佣金一致) - LocalDateTime now = LocalDateTime.now(); - boolean updated = shopDealerUserService.update( - new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper() - .eq(ShopDealerUser::getTenantId, tenantId) - .eq(ShopDealerUser::getUserId, riderId) - .setSql("freeze_money = IFNULL(freeze_money,0) + " + money.toPlainString()) - .setSql("total_money = IFNULL(total_money,0) + " + money.toPlainString()) - .set(ShopDealerUser::getUpdateTime, now) - ); - - if (!updated) { - // 配送员可能未开通分销账户:创建后再尝试入账一次(与分销结算逻辑保持一致) - ShopDealerUser existed = shopDealerUserService.getOne( - new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper() - .eq(ShopDealerUser::getTenantId, tenantId) - .eq(ShopDealerUser::getUserId, riderId) - .last("limit 1") - ); - if (existed == null) { - ShopDealerUser newDealerUser = new ShopDealerUser(); - newDealerUser.setTenantId(tenantId); - newDealerUser.setUserId(riderId); - newDealerUser.setType(0); - newDealerUser.setIsDelete(0); - newDealerUser.setSortNumber(0); - newDealerUser.setFirstNum(0); - newDealerUser.setSecondNum(0); - newDealerUser.setThirdNum(0); - newDealerUser.setMoney(BigDecimal.ZERO); - newDealerUser.setFreezeMoney(BigDecimal.ZERO); - newDealerUser.setTotalMoney(BigDecimal.ZERO); - try { - User sysUser = userMapper.selectByIdIgnoreTenant(riderId); - if (sysUser != null) { - newDealerUser.setRealName(sysUser.getRealName() != null ? sysUser.getRealName() : sysUser.getNickname()); - newDealerUser.setMobile(sysUser.getPhone()); - } - } catch (Exception ignore) { - // 基础信息补齐失败不影响入账 - } - newDealerUser.setCreateTime(now); - newDealerUser.setUpdateTime(now); - shopDealerUserService.save(newDealerUser); - } - - updated = shopDealerUserService.update( - new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper() - .eq(ShopDealerUser::getTenantId, tenantId) - .eq(ShopDealerUser::getUserId, riderId) - .setSql("freeze_money = IFNULL(freeze_money,0) + " + money.toPlainString()) - .setSql("total_money = IFNULL(total_money,0) + " + money.toPlainString()) - .set(ShopDealerUser::getUpdateTime, now) - ); - if (!updated) { - log.warn("配送员提成入账失败:未找到/创建分销账户 - tenantId={}, ticketOrderId={}, riderId={}", tenantId, order.getId(), riderId); - return; - } - } - - ShopDealerCapital cap = new ShopDealerCapital(); - cap.setUserId(riderId); - cap.setOrderNo(orderNo); - cap.setFlowType(10); - cap.setMoney(money); - cap.setComments(comments); - cap.setToUserId(order.getUserId()); - cap.setMonth(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"))); - cap.setTenantId(tenantId); - cap.setCreateTime(now); - cap.setUpdateTime(now); - shopDealerCapitalService.save(cap); - }); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltTicketTemplateServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltTicketTemplateServiceImpl.java deleted file mode 100644 index 082acb8..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/impl/GltTicketTemplateServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.glt.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.glt.mapper.GltTicketTemplateMapper; -import com.gxwebsoft.glt.service.GltTicketTemplateService; -import com.gxwebsoft.glt.entity.GltTicketTemplate; -import com.gxwebsoft.glt.param.GltTicketTemplateParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 水票Service实现 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:54 - */ -@Service -public class GltTicketTemplateServiceImpl extends ServiceImpl implements GltTicketTemplateService { - - @Override - public PageResult pageRel(GltTicketTemplateParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(GltTicketTemplateParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public GltTicketTemplate getByIdRel(Integer id) { - GltTicketTemplateParam param = new GltTicketTemplateParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketAutoReleaseServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketAutoReleaseServiceImpl.java deleted file mode 100644 index fb576e4..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketAutoReleaseServiceImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.gxwebsoft.glt.service.impl; - -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.glt.entity.GltUserTicketLog; -import com.gxwebsoft.glt.entity.GltUserTicketRelease; -import com.gxwebsoft.glt.mapper.GltUserTicketLogMapper; -import com.gxwebsoft.glt.mapper.GltUserTicketMapper; -import com.gxwebsoft.glt.mapper.GltUserTicketReleaseMapper; -import com.gxwebsoft.glt.service.GltUserTicketAutoReleaseService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * 冻结水票自动释放实现: - * - 读取到期且待释放的 release 记录(FOR UPDATE 加锁,防止重复处理) - * - 释放成功:更新 user_ticket 数量 & 将 release.status 置为 1,并写入流水 - * - 释放失败:将 release.status 置为 2(数据异常/冻结不足等) - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class GltUserTicketAutoReleaseServiceImpl implements GltUserTicketAutoReleaseService { - - /** - * 变更类型:冻结释放 - *

- * 现有发放类型为 10(见 GltTicketIssueService.CHANGE_TYPE_ISSUE),这里取 11。 - */ - private static final int CHANGE_TYPE_RELEASE = 11; - - /** release.status:待释放 */ - private static final int RELEASE_STATUS_PENDING = 0; - /** release.status:已释放 */ - private static final int RELEASE_STATUS_DONE = 1; - /** release.status:释放失败(数据异常/冻结不足等,需人工处理) */ - private static final int RELEASE_STATUS_FAILED = 2; - - private final GltUserTicketReleaseMapper releaseMapper; - private final GltUserTicketMapper userTicketMapper; - private final GltUserTicketLogMapper userTicketLogMapper; - - @Override - @Transactional(rollbackFor = Exception.class) - public int releaseDue(LocalDateTime now, int batchSize) { - int limit = Math.max(batchSize, 1); - List dueList = releaseMapper.selectDueForUpdate(now, limit); - if (dueList == null || dueList.isEmpty()) { - return 0; - } - - int success = 0; - for (GltUserTicketRelease rel : dueList) { - if (rel.getId() == null || rel.getStatus() == null || rel.getStatus() != RELEASE_STATUS_PENDING) { - continue; - } - - Integer qtyObj = rel.getReleaseQty(); - if (qtyObj == null || qtyObj <= 0) { - markFailed(rel.getId(), now, "releaseQty无效"); - continue; - } - int qty = qtyObj; - - if (rel.getUserTicketId() == null || rel.getUserId() == null || rel.getTenantId() == null) { - markFailed(rel.getId(), now, "缺少userTicketId/userId/tenantId"); - continue; - } - - long userTicketIdLong = rel.getUserTicketId(); - if (userTicketIdLong > Integer.MAX_VALUE || userTicketIdLong < 1) { - markFailed(rel.getId(), now, "userTicketId超范围"); - continue; - } - Integer userTicketId = (int) userTicketIdLong; - - // 先释放冻结数量(条件更新,确保 frozen_qty >= qty) - int updated = userTicketMapper.releaseFrozenQty( - userTicketId, - rel.getUserId(), - rel.getTenantId(), - qty, - now - ); - if (updated <= 0) { - markFailed(rel.getId(), now, "冻结不足/水票不存在/状态不符"); - continue; - } - - // 写入流水(可用 +qty,冻结 -qty) - GltUserTicket ticket = userTicketMapper.selectById(userTicketId); - GltUserTicketLog logRow = new GltUserTicketLog(); - logRow.setUserTicketId(userTicketId); - logRow.setChangeType(CHANGE_TYPE_RELEASE); - logRow.setChangeAvailable(qty); - logRow.setChangeFrozen(-qty); - logRow.setChangeUsed(0); - if (ticket != null) { - logRow.setAvailableAfter(ticket.getAvailableQty()); - logRow.setFrozenAfter(ticket.getFrozenQty()); - logRow.setUsedAfter(ticket.getUsedQty()); - } - logRow.setOrderId(null); - logRow.setOrderNo(null); - logRow.setUserId(rel.getUserId()); - logRow.setSortNumber(0); - logRow.setComments("冻结水票到期释放"); - logRow.setStatus(0); - logRow.setDeleted(0); - logRow.setTenantId(rel.getTenantId()); - logRow.setCreateTime(now); - logRow.setUpdateTime(now); - userTicketLogMapper.insert(logRow); - - // 标记释放记录已完成(放在最后:若流水失败则回滚) - releaseMapper.updateStatus(rel.getId(), RELEASE_STATUS_DONE, now); - - success++; - } - - return success; - } - - private void markFailed(Long releaseId, LocalDateTime now, String reason) { - releaseMapper.updateStatus(releaseId, RELEASE_STATUS_FAILED, now); - log.warn("冻结水票释放标记失败 - releaseId={}, reason={}", releaseId, reason); - } -} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketLogServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketLogServiceImpl.java deleted file mode 100644 index a0d6acc..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketLogServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.glt.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.glt.mapper.GltUserTicketLogMapper; -import com.gxwebsoft.glt.service.GltUserTicketLogService; -import com.gxwebsoft.glt.entity.GltUserTicketLog; -import com.gxwebsoft.glt.param.GltUserTicketLogParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 消费日志Service实现 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Service -public class GltUserTicketLogServiceImpl extends ServiceImpl implements GltUserTicketLogService { - - @Override - public PageResult pageRel(GltUserTicketLogParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(GltUserTicketLogParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public GltUserTicketLog getByIdRel(Integer id) { - GltUserTicketLogParam param = new GltUserTicketLogParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketReleaseServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketReleaseServiceImpl.java deleted file mode 100644 index e85881b..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketReleaseServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.glt.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.glt.mapper.GltUserTicketReleaseMapper; -import com.gxwebsoft.glt.service.GltUserTicketReleaseService; -import com.gxwebsoft.glt.entity.GltUserTicketRelease; -import com.gxwebsoft.glt.param.GltUserTicketReleaseParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 水票释放Service实现 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Service -public class GltUserTicketReleaseServiceImpl extends ServiceImpl implements GltUserTicketReleaseService { - - @Override - public PageResult pageRel(GltUserTicketReleaseParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(GltUserTicketReleaseParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public GltUserTicketRelease getByIdRel(Integer id) { - GltUserTicketReleaseParam param = new GltUserTicketReleaseParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketServiceImpl.java deleted file mode 100644 index d5547a9..0000000 --- a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketServiceImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.gxwebsoft.glt.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.glt.mapper.GltUserTicketMapper; -import com.gxwebsoft.glt.service.GltUserTicketService; -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.glt.param.GltUserTicketParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 我的水票Service实现 - * - * @author 科技小王子 - * @since 2026-02-03 18:55:55 - */ -@Service -public class GltUserTicketServiceImpl extends ServiceImpl implements GltUserTicketService { - - @Override - public PageResult pageRel(GltUserTicketParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(GltUserTicketParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public GltUserTicket getByIdRel(Integer id) { - GltUserTicketParam param = new GltUserTicketParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public Integer sumAvailableQtyByUserId(Integer userId, Integer tenantId) { - Integer availableQty = baseMapper.sumAvailableQtyByUserId(userId, tenantId); - return availableQty == null ? 0 : availableQty; - } - -} diff --git a/src/main/java/com/gxwebsoft/glt/task/DealerCommissionUnfreeze10584Task.java b/src/main/java/com/gxwebsoft/glt/task/DealerCommissionUnfreeze10584Task.java deleted file mode 100644 index 1791b86..0000000 --- a/src/main/java/com/gxwebsoft/glt/task/DealerCommissionUnfreeze10584Task.java +++ /dev/null @@ -1,646 +0,0 @@ -package com.gxwebsoft.glt.task; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.gxwebsoft.common.core.annotation.IgnoreTenant; -import com.gxwebsoft.glt.entity.GltTicketOrder; -import com.gxwebsoft.glt.entity.GltTicketTemplate; -import com.gxwebsoft.glt.entity.GltUserTicket; -import com.gxwebsoft.glt.service.GltTicketOrderService; -import com.gxwebsoft.glt.service.GltTicketTemplateService; -import com.gxwebsoft.glt.service.GltUserTicketService; -import com.gxwebsoft.shop.entity.ShopDealerCapital; -import com.gxwebsoft.shop.entity.ShopDealerOrder; -import com.gxwebsoft.shop.entity.ShopDealerUser; -import com.gxwebsoft.shop.entity.ShopGoods; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.shop.service.ShopDealerCapitalService; -import com.gxwebsoft.shop.service.ShopDealerOrderService; -import com.gxwebsoft.shop.service.ShopDealerUserService; -import com.gxwebsoft.shop.service.ShopGoodsService; -import com.gxwebsoft.shop.service.ShopOrderGoodsService; -import com.gxwebsoft.shop.service.ShopOrderService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; -import org.springframework.transaction.support.TransactionTemplate; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * 租户10584:分销佣金解冻任务 - * - *

规则:

- *

1) 送水套餐(formId in 水票模板 goodsId):订单号关联的水票产生了第一次送水订单,且该第一次送水订单状态=已完成(40) -> 解冻。

- *

2) 非送水套餐(formId not in 水票模板 goodsId):订单已确认收货(orderStatus=1) -> 解冻。

- * - *

实现策略:以 ShopDealerCapital(flowType=10) 的“佣金明细”为解冻粒度, - * 每条佣金明细对应生成一条 ShopDealerCapital(flowType=50) 作为幂等标记,并执行 - * ShopDealerUser.freezeMoney -> ShopDealerUser.money 的转移。

- */ -@Slf4j -@Component -@ConditionalOnProperty(prefix = "dealer.commission.unfreeze10584", name = "enabled", havingValue = "true", matchIfMissing = true) -public class DealerCommissionUnfreeze10584Task { - - private static final int TENANT_ID = 10584; - - private static final int ORDER_STATUS_CONFIRMED_RECEIVE = 1; - - private static final int MAX_ELIGIBLE_ORDER_NOS_PER_RUN = 200; - private static final int MAX_ELIGIBLE_TICKET_ORDERS_PER_RUN = 200; - private static final int MAX_CAPITALS_PER_RUN = 500; - - private static final int FLOW_TYPE_DELIVERY_REWARD = 60; // 配送奖励(直接入可提现金额) - - /** - * 兼容两种录入方式: - * - 0.05 表示 5%(比例) - * - 5 表示 5%(百分比) - */ - private static BigDecimal normalizeDeliveryRate(BigDecimal rawRate) { - if (rawRate == null || rawRate.signum() <= 0) { - return null; - } - // 如果录入 >= 1,按“百分比”处理(1 => 1%) - if (rawRate.compareTo(BigDecimal.ONE) >= 0) { - return rawRate.movePointLeft(2); - } - return rawRate; - } - - @Resource - private TransactionTemplate transactionTemplate; - - @Resource - private ShopOrderService shopOrderService; - - @Resource - private ShopOrderGoodsService shopOrderGoodsService; - - @Resource - private ShopGoodsService shopGoodsService; - - @Resource - private ShopDealerCapitalService shopDealerCapitalService; - - @Resource - private ShopDealerOrderService shopDealerOrderService; - - @Resource - private ShopDealerUserService shopDealerUserService; - - @Resource - private GltUserTicketService gltUserTicketService; - - @Resource - private GltTicketOrderService gltTicketOrderService; - - @Resource - private GltTicketTemplateService gltTicketTemplateService; - - private final AtomicBoolean running = new AtomicBoolean(false); - - @Scheduled(cron = "${dealer.commission.unfreeze10584.cron:0/20 * * * * ?}") - @IgnoreTenant("定时任务无登录态,需忽略租户隔离;内部使用 tenantId=10584 精确过滤") - public void run() { - if (!running.compareAndSet(false, true)) { - log.warn("分销佣金解冻任务仍在执行中,本轮跳过 - tenantId={}", TENANT_ID); - return; - } - - try { - Set waterFormIds = loadWaterFormIds(); - if (waterFormIds.isEmpty()) { - // 送水/非送水的判断依赖模板 goodsId;拿不到会导致误判,宁可跳过本轮。 - log.warn("分销佣金解冻任务跳过:未找到水票模板 goodsId - tenantId={}", TENANT_ID); - return; - } - - // 先按“最近确认收货”的订单扫描,避免总是卡在很早的历史订单上。 - Set eligibleOrderNos = new HashSet<>(); - eligibleOrderNos.addAll(findEligibleNonWaterOrderNos(waterFormIds, true)); - eligibleOrderNos.addAll(findEligibleWaterOrderNosByFirstFinishedTicketOrder(waterFormIds)); - - if (eligibleOrderNos.isEmpty()) { - return; - } - - // 配送奖励(与佣金解冻独立):按订单发放,幂等保证不会重复入账 - int rewarded = 0; - for (String orderNo : eligibleOrderNos) { - try { - if (settleDeliveryRewardIfNeeded(orderNo)) { - rewarded++; - } - } catch (Exception e) { - log.error("发放配送奖励失败,将在下次任务重试 - tenantId={}, orderNo={}", TENANT_ID, orderNo, e); - } - } - - List capitals = findCapitalsByEligibleOrderNos(eligibleOrderNos); - if (capitals.isEmpty()) { - // 若本轮没有取到佣金明细,回退再按“最早确认收货”的订单扫一轮,尽量覆盖历史遗留未解冻。 - eligibleOrderNos.clear(); - eligibleOrderNos.addAll(findEligibleNonWaterOrderNos(waterFormIds, false)); - eligibleOrderNos.addAll(findEligibleWaterOrderNosByFirstFinishedTicketOrder(waterFormIds)); - - // 兜底扫描出来的订单也补发配送奖励(幂等) - for (String orderNo : eligibleOrderNos) { - try { - if (settleDeliveryRewardIfNeeded(orderNo)) { - rewarded++; - } - } catch (Exception e) { - log.error("发放配送奖励失败,将在下次任务重试 - tenantId={}, orderNo={}", TENANT_ID, orderNo, e); - } - } - - capitals = findCapitalsByEligibleOrderNos(eligibleOrderNos); - } - - if (capitals.isEmpty()) { - return; - } - - int unfrozen = 0; - for (ShopDealerCapital cap : capitals) { - try { - boolean ok = unfreezeOneCapitalIfNeeded(cap); - if (ok) { - unfrozen++; - } - } catch (Exception e) { - log.error("解冻佣金失败,将在下次任务重试 - tenantId={}, capitalId={}, orderNo={}, userId={}", - TENANT_ID, cap != null ? cap.getId() : null, cap != null ? cap.getOrderNo() : null, cap != null ? cap.getUserId() : null, e); - } - } - - if (unfrozen > 0) { - log.info("分销佣金解冻完成 - tenantId={}, eligibleOrderNos={}, scannedCapitals={}, unfrozen={}", - TENANT_ID, eligibleOrderNos.size(), capitals.size(), unfrozen); - } - if (rewarded > 0) { - log.info("配送奖励发放完成 - tenantId={}, eligibleOrderNos={}, rewarded={}", TENANT_ID, eligibleOrderNos.size(), rewarded); - } - } finally { - running.set(false); - } - } - - private boolean settleDeliveryRewardIfNeeded(String orderNo) { - if (orderNo == null || orderNo.isBlank()) { - return false; - } - - ShopOrder order = shopOrderService.getOne( - new LambdaQueryWrapper() - .eq(ShopOrder::getTenantId, TENANT_ID) - .eq(ShopOrder::getDeleted, 0) - .eq(ShopOrder::getOrderNo, orderNo) - .last("limit 1") - ); - if (order == null) { - return false; - } - - Integer riderId = order.getRiderId(); - if (riderId == null || riderId <= 0) { - return false; - } - - // 快速幂等检查:已发放则跳过(事务内仍会二次校验避免并发重复) - boolean already = shopDealerCapitalService.count( - new LambdaQueryWrapper() - .eq(ShopDealerCapital::getTenantId, TENANT_ID) - .eq(ShopDealerCapital::getFlowType, FLOW_TYPE_DELIVERY_REWARD) - .eq(ShopDealerCapital::getOrderNo, orderNo) - ) > 0; - if (already) { - return false; - } - - return Boolean.TRUE.equals(transactionTemplate.execute(status -> { - LocalDateTime now = LocalDateTime.now(); - - // 锁定配送员资金明细 marker,确保并发幂等 - ShopDealerCapital existedMarker = shopDealerCapitalService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerCapital::getTenantId, TENANT_ID) - .eq(ShopDealerCapital::getFlowType, FLOW_TYPE_DELIVERY_REWARD) - .eq(ShopDealerCapital::getOrderNo, orderNo) - .last("limit 1 for update") - ); - if (existedMarker != null) { - return false; - } - - Integer orderId = order.getOrderId(); - if (orderId == null) { - return false; - } - - List orderGoodsList = shopOrderGoodsService.list( - new LambdaQueryWrapper() - .eq(ShopOrderGoods::getTenantId, TENANT_ID) - .eq(ShopOrderGoods::getOrderId, orderId) - ); - if (orderGoodsList == null || orderGoodsList.isEmpty()) { - return false; - } - - List goodsIds = orderGoodsList.stream() - .map(ShopOrderGoods::getGoodsId) - .filter(Objects::nonNull) - .distinct() - .toList(); - if (goodsIds.isEmpty()) { - return false; - } - - Map goodsDeliveryMoneyMap = shopGoodsService.list( - new LambdaQueryWrapper() - .eq(ShopGoods::getTenantId, TENANT_ID) - .in(ShopGoods::getGoodsId, goodsIds) - ).stream().collect(java.util.stream.Collectors.toMap( - ShopGoods::getGoodsId, - g -> g.getDeliveryMoney() != null ? g.getDeliveryMoney() : BigDecimal.ZERO, - (a, b) -> a - )); - - BigDecimal reward = BigDecimal.ZERO; - for (ShopOrderGoods og : orderGoodsList) { - Integer goodsId = og.getGoodsId(); - if (goodsId == null) { - continue; - } - int qty = og.getTotalNum() == null ? 0 : og.getTotalNum(); - if (qty <= 0) { - continue; - } - BigDecimal rawRate = goodsDeliveryMoneyMap.getOrDefault(goodsId, BigDecimal.ZERO); - BigDecimal rate = normalizeDeliveryRate(rawRate); - if (rate == null || rate.signum() <= 0) { - continue; - } - BigDecimal unitPrice = og.getPrice() != null ? og.getPrice() : BigDecimal.ZERO; - if (unitPrice.signum() <= 0) { - continue; - } - BigDecimal lineAmount = unitPrice.multiply(BigDecimal.valueOf(qty)); - reward = reward.add(lineAmount.multiply(rate)); - } - - reward = reward.setScale(2, RoundingMode.HALF_UP); - if (reward.signum() <= 0) { - return false; - } - - // 锁定/创建配送员分销账户 - ShopDealerUser dealerUser = shopDealerUserService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerUser::getTenantId, TENANT_ID) - .eq(ShopDealerUser::getUserId, riderId) - .last("limit 1 for update") - ); - if (dealerUser == null) { - ShopDealerUser newDealerUser = new ShopDealerUser(); - newDealerUser.setTenantId(TENANT_ID); - newDealerUser.setUserId(riderId); - newDealerUser.setType(0); - newDealerUser.setIsDelete(0); - newDealerUser.setSortNumber(0); - newDealerUser.setFirstNum(0); - newDealerUser.setSecondNum(0); - newDealerUser.setThirdNum(0); - newDealerUser.setMoney(BigDecimal.ZERO); - newDealerUser.setFreezeMoney(BigDecimal.ZERO); - newDealerUser.setTotalMoney(BigDecimal.ZERO); - newDealerUser.setCreateTime(now); - newDealerUser.setUpdateTime(now); - shopDealerUserService.save(newDealerUser); - - dealerUser = shopDealerUserService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerUser::getTenantId, TENANT_ID) - .eq(ShopDealerUser::getUserId, riderId) - .last("limit 1 for update") - ); - if (dealerUser == null) { - log.warn("配送奖励入账失败:未找到/创建分销账户 - tenantId={}, orderNo={}, riderId={}", TENANT_ID, orderNo, riderId); - return false; - } - } - - BigDecimal moneyVal = dealerUser.getMoney() != null ? dealerUser.getMoney() : BigDecimal.ZERO; - BigDecimal totalMoneyVal = dealerUser.getTotalMoney() != null ? dealerUser.getTotalMoney() : BigDecimal.ZERO; - dealerUser.setMoney(moneyVal.add(reward)); - dealerUser.setTotalMoney(totalMoneyVal.add(reward)); - dealerUser.setUpdateTime(now); - if (!shopDealerUserService.updateById(dealerUser)) { - log.warn("配送奖励入账失败:更新分销账户失败 - tenantId={}, orderNo={}, riderId={}, reward={}", TENANT_ID, orderNo, riderId, reward); - return false; - } - - ShopDealerCapital cap = new ShopDealerCapital(); - cap.setUserId(riderId); - cap.setOrderNo(orderNo); - cap.setFlowType(FLOW_TYPE_DELIVERY_REWARD); - cap.setMoney(reward); - cap.setComments("配送奖励"); - cap.setToUserId(order.getUserId()); - cap.setMonth(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"))); - cap.setTenantId(TENANT_ID); - cap.setCreateTime(now); - cap.setUpdateTime(now); - shopDealerCapitalService.save(cap); - - log.info("配送奖励发放成功 - tenantId={}, orderNo={}, riderId={}, reward={}", TENANT_ID, orderNo, riderId, reward); - return true; - })); - } - - private Set loadWaterFormIds() { - return gltTicketTemplateService.list( - new LambdaQueryWrapper() - .eq(GltTicketTemplate::getTenantId, TENANT_ID) - .eq(GltTicketTemplate::getDeleted, 0) - .isNotNull(GltTicketTemplate::getGoodsId) - ).stream() - .map(GltTicketTemplate::getGoodsId) - .collect(java.util.stream.Collectors.toSet()); - } - - private List findEligibleNonWaterOrderNos(Set waterFormIds, boolean newestFirst) { - LambdaQueryWrapper qw = new LambdaQueryWrapper() - .eq(ShopOrder::getTenantId, TENANT_ID) - .eq(ShopOrder::getDeleted, 0) - .eq(ShopOrder::getPayStatus, true) - .eq(ShopOrder::getOrderStatus, ORDER_STATUS_CONFIRMED_RECEIVE) - .and(w -> w.notIn(ShopOrder::getFormId, waterFormIds).or().isNull(ShopOrder::getFormId)) - .isNotNull(ShopOrder::getOrderNo); - - if (newestFirst) { - qw.orderByDesc(ShopOrder::getUpdateTime).orderByDesc(ShopOrder::getOrderId); - } else { - qw.orderByAsc(ShopOrder::getUpdateTime).orderByAsc(ShopOrder::getOrderId); - } - qw.last("limit " + MAX_ELIGIBLE_ORDER_NOS_PER_RUN); - - return shopOrderService.list(qw).stream() - .map(ShopOrder::getOrderNo) - .filter(s -> s != null && !s.isBlank()) - .toList(); - } - - private Set findEligibleWaterOrderNosByFirstFinishedTicketOrder(Set waterFormIds) { - // 缓存减少 DB 往返:userTicketId -> 是否“第一次送水单已完成” - Map firstFinishedCache = new HashMap<>(); - Map userTicketOrderNoCache = new HashMap<>(); - - List finishedTicketOrders = gltTicketOrderService.list( - new LambdaQueryWrapper() - .eq(GltTicketOrder::getTenantId, TENANT_ID) - .eq(GltTicketOrder::getDeleted, 0) - .eq(GltTicketOrder::getDeliveryStatus, GltTicketOrderService.DELIVERY_STATUS_FINISHED) - .isNotNull(GltTicketOrder::getUserTicketId) - .orderByDesc(GltTicketOrder::getId) - .last("limit " + MAX_ELIGIBLE_TICKET_ORDERS_PER_RUN) - ); - - Set orderNos = new HashSet<>(); - for (GltTicketOrder ticketOrder : finishedTicketOrders) { - Integer userTicketId = ticketOrder.getUserTicketId(); - if (userTicketId == null) { - continue; - } - - boolean firstFinished = firstFinishedCache.computeIfAbsent(userTicketId, id -> isFirstTicketOrderFinished(id)); - if (!firstFinished) { - continue; - } - - String orderNo = userTicketOrderNoCache.computeIfAbsent(userTicketId, id -> findOrderNoByUserTicketId(id)); - if (orderNo == null || orderNo.isBlank()) { - continue; - } - - // 再校验一次确实是送水套餐订单,避免误关联 - ShopOrder shopOrder = shopOrderService.getOne( - new LambdaQueryWrapper() - .eq(ShopOrder::getTenantId, TENANT_ID) - .eq(ShopOrder::getDeleted, 0) - .eq(ShopOrder::getPayStatus, true) - .eq(ShopOrder::getOrderNo, orderNo) - .last("limit 1") - ); - if (shopOrder == null || shopOrder.getFormId() == null || !waterFormIds.contains(shopOrder.getFormId())) { - continue; - } - - orderNos.add(orderNo); - if (orderNos.size() >= MAX_ELIGIBLE_ORDER_NOS_PER_RUN) { - break; - } - } - return orderNos; - } - - private boolean isFirstTicketOrderFinished(Integer userTicketId) { - if (userTicketId == null) { - return false; - } - GltTicketOrder first = gltTicketOrderService.getOne( - new LambdaQueryWrapper() - .eq(GltTicketOrder::getTenantId, TENANT_ID) - .eq(GltTicketOrder::getDeleted, 0) - .eq(GltTicketOrder::getUserTicketId, userTicketId) - .orderByAsc(GltTicketOrder::getId) - .last("limit 1") - ); - return first != null && first.getDeliveryStatus() != null && first.getDeliveryStatus() == GltTicketOrderService.DELIVERY_STATUS_FINISHED; - } - - private String findOrderNoByUserTicketId(Integer userTicketId) { - if (userTicketId == null) { - return null; - } - GltUserTicket userTicket = gltUserTicketService.getOne( - new LambdaQueryWrapper() - .eq(GltUserTicket::getTenantId, TENANT_ID) - .eq(GltUserTicket::getDeleted, 0) - .eq(GltUserTicket::getId, userTicketId) - .last("limit 1") - ); - return userTicket != null ? userTicket.getOrderNo() : null; - } - - private List findCapitalsByEligibleOrderNos(Set eligibleOrderNos) { - if (eligibleOrderNos == null || eligibleOrderNos.isEmpty()) { - return List.of(); - } - return shopDealerCapitalService.list( - new LambdaQueryWrapper() - .eq(ShopDealerCapital::getTenantId, TENANT_ID) - .eq(ShopDealerCapital::getFlowType, 10) - .in(ShopDealerCapital::getOrderNo, eligibleOrderNos) - .isNotNull(ShopDealerCapital::getOrderNo) - .orderByAsc(ShopDealerCapital::getId) - .last("limit " + MAX_CAPITALS_PER_RUN) - ); - } - - private boolean unfreezeOneCapitalIfNeeded(ShopDealerCapital cap) { - if (cap == null) { - return false; - } - Integer capitalId = cap.getId(); - Integer dealerUserId = cap.getUserId(); - String orderNo = cap.getOrderNo(); - BigDecimal amount = cap.getMoney(); - if (capitalId == null || dealerUserId == null || orderNo == null || orderNo.isBlank() || amount == null || amount.signum() <= 0) { - return false; - } - - String markerComment = buildUnfreezeMarkerComment(capitalId); - - // 快速幂等检查(避免每条都进事务) - boolean already = shopDealerCapitalService.count( - new LambdaQueryWrapper() - .eq(ShopDealerCapital::getTenantId, TENANT_ID) - .eq(ShopDealerCapital::getFlowType, 50) - .eq(ShopDealerCapital::getUserId, dealerUserId) - .eq(ShopDealerCapital::getOrderNo, orderNo) - .eq(ShopDealerCapital::getComments, markerComment) - ) > 0; - if (already) { - return false; - } - - return Boolean.TRUE.equals(transactionTemplate.execute(status -> { - LocalDateTime now = LocalDateTime.now(); - // 锁定分销商账户行,避免多实例并发导致同一条佣金重复解冻。 - ShopDealerUser dealerUser = shopDealerUserService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerUser::getTenantId, TENANT_ID) - .eq(ShopDealerUser::getUserId, dealerUserId) - .last("limit 1 for update") - ); - if (dealerUser == null) { - log.warn("解冻失败:未找到分销账户 - tenantId={}, orderNo={}, dealerUserId={}, amount={}", - TENANT_ID, orderNo, dealerUserId, amount); - return false; - } - - // RR 隔离级别下,先锁 user 行,再用锁定读检查 marker,避免“读到旧快照”导致重复解冻。 - ShopDealerCapital existedMarker = shopDealerCapitalService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerCapital::getTenantId, TENANT_ID) - .eq(ShopDealerCapital::getFlowType, 50) - .eq(ShopDealerCapital::getUserId, dealerUserId) - .eq(ShopDealerCapital::getOrderNo, orderNo) - .eq(ShopDealerCapital::getComments, markerComment) - .last("limit 1 for update") - ); - if (existedMarker != null) { - return false; - } - - BigDecimal freezeMoney = dealerUser.getFreezeMoney() != null ? dealerUser.getFreezeMoney() : BigDecimal.ZERO; - if (freezeMoney.compareTo(amount) < 0) { - log.warn("解冻失败:冻结金额不足 - tenantId={}, orderNo={}, dealerUserId={}, freezeMoney={}, amount={}", - TENANT_ID, orderNo, dealerUserId, freezeMoney, amount); - return false; - } - - BigDecimal moneyVal = dealerUser.getMoney() != null ? dealerUser.getMoney() : BigDecimal.ZERO; - dealerUser.setFreezeMoney(freezeMoney.subtract(amount)); - dealerUser.setMoney(moneyVal.add(amount)); - dealerUser.setUpdateTime(now); - if (!shopDealerUserService.updateById(dealerUser)) { - log.warn("解冻失败:更新分销账户失败 - tenantId={}, orderNo={}, dealerUserId={}, amount={}", - TENANT_ID, orderNo, dealerUserId, amount); - return false; - } - - ShopDealerCapital marker = new ShopDealerCapital(); - marker.setUserId(dealerUserId); - marker.setOrderNo(orderNo); - marker.setFlowType(50); - marker.setMoney(amount); - marker.setComments(markerComment); - marker.setToUserId(cap.getToUserId()); - marker.setMonth(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"))); - marker.setTenantId(TENANT_ID); - marker.setCreateTime(now); - marker.setUpdateTime(now); - shopDealerCapitalService.save(marker); - - // 佣金全部解冻完成后,将分销订单状态置为“已解冻”(0)。 - // 以当前任务生成的 flowType=50 marker 数量作为完成度判断,避免提前将订单置为已解冻。 - setDealerOrderUnfrozenIfCompleted(orderNo, now); - - log.info("佣金解冻成功 - tenantId={}, orderNo={}, dealerUserId={}, amount={}, capitalId={}", - TENANT_ID, orderNo, dealerUserId, amount, capitalId); - return true; - })); - } - - private void setDealerOrderUnfrozenIfCompleted(String orderNo, LocalDateTime now) { - if (orderNo == null || orderNo.isBlank()) { - return; - } - - long totalCommissions = shopDealerCapitalService.count( - new LambdaQueryWrapper() - .eq(ShopDealerCapital::getTenantId, TENANT_ID) - .eq(ShopDealerCapital::getFlowType, 10) - .eq(ShopDealerCapital::getOrderNo, orderNo) - ); - if (totalCommissions <= 0) { - return; - } - - long unfrozenMarkers = shopDealerCapitalService.count( - new LambdaQueryWrapper() - .eq(ShopDealerCapital::getTenantId, TENANT_ID) - .eq(ShopDealerCapital::getFlowType, 50) - .eq(ShopDealerCapital::getOrderNo, orderNo) - .like(ShopDealerCapital::getComments, "佣金解冻(capitalId=") - ); - - if (unfrozenMarkers < totalCommissions) { - return; - } - - boolean updated = shopDealerOrderService.update( - new LambdaUpdateWrapper() - .eq(ShopDealerOrder::getTenantId, TENANT_ID) - .eq(ShopDealerOrder::getOrderNo, orderNo) - .set(ShopDealerOrder::getIsUnfreeze, 1) - .set(ShopDealerOrder::getUnfreezeTime, now) - .set(ShopDealerOrder::getUpdateTime, now) - ); - if (!updated) { - log.warn("已完成佣金解冻,但更新分销订单isUnfreeze失败/无记录 - tenantId={}, orderNo={}", TENANT_ID, orderNo); - } - } - - private String buildUnfreezeMarkerComment(Integer capitalId) { - return "佣金解冻(capitalId=" + capitalId + ")"; - } -} diff --git a/src/main/java/com/gxwebsoft/glt/task/DealerOrderSettlement10584Task.java b/src/main/java/com/gxwebsoft/glt/task/DealerOrderSettlement10584Task.java deleted file mode 100644 index 25b2b37..0000000 --- a/src/main/java/com/gxwebsoft/glt/task/DealerOrderSettlement10584Task.java +++ /dev/null @@ -1,995 +0,0 @@ -package com.gxwebsoft.glt.task; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.gxwebsoft.common.core.annotation.IgnoreTenant; -import com.gxwebsoft.glt.entity.GltTicketTemplate; -import com.gxwebsoft.glt.service.GltTicketTemplateService; -import com.gxwebsoft.shop.entity.ShopDealerCapital; -import com.gxwebsoft.shop.entity.ShopDealerOrder; -import com.gxwebsoft.shop.entity.ShopDealerReferee; -import com.gxwebsoft.shop.entity.ShopDealerSetting; -import com.gxwebsoft.shop.entity.ShopDealerUser; -import com.gxwebsoft.shop.entity.ShopGoods; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.common.system.mapper.UserMapper; -import com.gxwebsoft.shop.service.ShopDealerCapitalService; -import com.gxwebsoft.shop.service.ShopDealerOrderService; -import com.gxwebsoft.shop.service.ShopDealerRefereeService; -import com.gxwebsoft.shop.service.ShopDealerSettingService; -import com.gxwebsoft.shop.service.ShopDealerUserService; -import com.gxwebsoft.shop.service.ShopGoodsService; -import com.gxwebsoft.shop.service.ShopOrderService; -import com.gxwebsoft.shop.service.ShopOrderGoodsService; -import com.gxwebsoft.shop.util.UpstreamUserFinder; -import com.alibaba.fastjson.JSONObject; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; -import org.springframework.transaction.support.TransactionTemplate; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; -import java.util.*; - -/** - * 租户10584:分销订单结算任务 - *

- * 每10秒执行一次,查询“已付款且未结算”的订单,按指定规则计算佣金并先计入分销商冻结金额(freezeMoney),并将订单置为已结算。 - */ -@Slf4j -@Component -public class DealerOrderSettlement10584Task { - - private static final Integer TENANT_ID = 10584; - - private static final BigDecimal RATE_0_10 = new BigDecimal("0.10"); - private static final BigDecimal RATE_0_05 = new BigDecimal("0.05"); - private static final BigDecimal RATE_0_03 = new BigDecimal("0.03"); - private static final BigDecimal RATE_0_02 = new BigDecimal("0.02"); - private static final BigDecimal RATE_0_01 = new BigDecimal("0.01"); - private static final BigDecimal TOTAL_DEALER_DIVIDEND_RATE = RATE_0_01; - - private static final int MAX_ORDERS_PER_RUN = 50; - private static final int MAX_REFEREE_CHAIN_DEPTH = 20; - private static final int DIVIDEND_SCALE = 3; - - @Resource - private TransactionTemplate transactionTemplate; - - @Resource - private ShopOrderService shopOrderService; - - @Resource - private ShopDealerRefereeService shopDealerRefereeService; - - @Resource - private ShopDealerUserService shopDealerUserService; - - @Resource - private ShopDealerCapitalService shopDealerCapitalService; - - @Resource - private ShopDealerOrderService shopDealerOrderService; - - @Resource - private ShopDealerSettingService shopDealerSettingService; - - @Resource - private ShopGoodsService shopGoodsService; - - @Resource - private ShopOrderGoodsService shopOrderGoodsService; - - @Resource - private UserMapper userMapper; - - @Resource - private GltTicketTemplateService gltTicketTemplateService; - - /** - * 每10秒执行一次。 - */ - @Scheduled(cron = "0/10 * * * * ?") - @IgnoreTenant("该定时任务仅处理租户10584,但需要显式按tenantId过滤,避免定时任务线程无租户上下文导致查询异常") - public void settleTenant10584Orders() { - try { - Set waterFormIds = loadWaterFormIds(); - List orders = findUnsettledPaidOrders(waterFormIds); - if (orders.isEmpty()) { - return; - } - - // Per-run caches to reduce DB chatter across orders. - Map level1ParentCache = new HashMap<>(); - Map shopRoleCache = new HashMap<>(); - DealerBasicSetting dealerBasicSetting = findDealerBasicSetting(); - ShopDealerUser totalDealerUser = findTotalDealerUser(); - if (totalDealerUser == null || totalDealerUser.getUserId() == null) { - log.warn("未找到分红账号,订单仍可结算但不会发放分红 - tenantId={}", TENANT_ID); - } - log.debug("租户{}分销设置 - level={}", TENANT_ID, dealerBasicSetting.level); - - log.info("租户{}待结算订单数: {}, orderNos(sample)={}", - TENANT_ID, - orders.size(), - orders.stream().limit(10).map(ShopOrder::getOrderNo).toList()); - - for (ShopOrder order : orders) { - try { - transactionTemplate.executeWithoutResult(status -> { - // 先“认领”订单:并发/多实例下避免重复结算(update=0 表示被其他线程/实例处理) - if (!claimOrderToSettle(order.getOrderId(), waterFormIds)) { - return; - } - settleOneOrder(order, level1ParentCache, shopRoleCache, totalDealerUser, dealerBasicSetting.level); - }); - } catch (Exception e) { - log.error("订单结算失败,将回滚本订单并在下次任务重试 - orderId={}, orderNo={}", order.getOrderId(), order.getOrderNo(), e); - } - } - } catch (Exception e) { - log.error("租户{}分销订单结算任务执行失败", TENANT_ID, e); - } - } - - private List findUnsettledPaidOrders(Set waterFormIds) { - // 租户10584约定: - // - 普通订单:以发货为准(deliveryStatus=20)才结算; - // - 绑定水票模板的订单:支付成功即可体现分润(无需等发货状态变更)。 - LambdaQueryWrapper qw = new LambdaQueryWrapper() - .eq(ShopOrder::getTenantId, TENANT_ID) - .eq(ShopOrder::getDeleted, 0) - .eq(ShopOrder::getPayStatus, true) - .eq(ShopOrder::getIsSettled, 0) - // 退款/取消订单不结算,避免“退款后仍发放分红/分润/佣金” - .and(w -> w.notIn(ShopOrder::getOrderStatus, 2, 4, 5, 6, 7).or().isNull(ShopOrder::getOrderStatus)); - - if (waterFormIds != null && !waterFormIds.isEmpty()) { - qw.and(w -> w.eq(ShopOrder::getDeliveryStatus, 20).or().in(ShopOrder::getFormId, waterFormIds)); - } else { - qw.eq(ShopOrder::getDeliveryStatus, 20); - } - - qw.orderByAsc(ShopOrder::getOrderId).last("limit " + MAX_ORDERS_PER_RUN); - return shopOrderService.list(qw); - } - - private boolean claimOrderToSettle(Integer orderId, Set waterFormIds) { - LambdaUpdateWrapper uw = new LambdaUpdateWrapper() - .eq(ShopOrder::getOrderId, orderId) - .eq(ShopOrder::getTenantId, TENANT_ID) - .eq(ShopOrder::getIsSettled, 0) - // 二次防御:退款/取消订单不允许被“认领结算” - .and(w -> w.notIn(ShopOrder::getOrderStatus, 2, 4, 5, 6, 7).or().isNull(ShopOrder::getOrderStatus)); - - if (waterFormIds != null && !waterFormIds.isEmpty()) { - uw.and(w -> w.eq(ShopOrder::getDeliveryStatus, 20).or().in(ShopOrder::getFormId, waterFormIds)); - } else { - uw.eq(ShopOrder::getDeliveryStatus, 20); - } - - uw.set(ShopOrder::getIsSettled, 1); - return shopOrderService.update(uw); - } - - private Set loadWaterFormIds() { - try { - return gltTicketTemplateService.list( - new LambdaQueryWrapper() - .eq(GltTicketTemplate::getTenantId, TENANT_ID) - .eq(GltTicketTemplate::getDeleted, 0) - .isNotNull(GltTicketTemplate::getGoodsId) - ).stream() - .map(GltTicketTemplate::getGoodsId) - .filter(Objects::nonNull) - .collect(java.util.stream.Collectors.toSet()); - } catch (Exception e) { - log.warn("读取水票模板goodsId失败,将按普通订单规则结算 - tenantId={}", TENANT_ID, e); - return Collections.emptySet(); - } - } - - private void settleOneOrder( - ShopOrder order, - Map level1ParentCache, - Map shopRoleCache, - ShopDealerUser totalDealerUser, - int dealerLevel - ) { - if (order.getUserId() == null || order.getOrderNo() == null) { - throw new IllegalStateException("订单关键信息缺失,无法结算 - orderId=" + order.getOrderId()); - } - - BigDecimal baseAmount = getOrderBaseAmount(order); - if (baseAmount == null || baseAmount.signum() <= 0) { - throw new IllegalStateException("订单金额为空或<=0,无法结算 - orderId=" + order.getOrderId() + ", orderNo=" + order.getOrderNo()); - } - - OrderGoodsInfo goodsInfo = findOrderSingleGoodsInfo(order); - ShopGoods goods = goodsInfo.goods; - int goodsQty = goodsInfo.quantity; - - if (goods != null && goods.getIsOpenCommission() != null && goods.getIsOpenCommission() != 1) { - log.info("商品未开启分销,跳过订单结算 - orderId={}, orderNo={}, buyerUserId={}, goodsId={}, isOpenCommission={}", - order.getOrderId(), order.getOrderNo(), order.getUserId(), goods.getGoodsId(), goods.getIsOpenCommission()); - return; - } - - CommissionConfig commissionConfig = resolveCommissionConfig(goods); - - log.info("开始结算订单 - orderId={}, orderNo={}, buyerUserId={}, payPrice={}, goodsId={}, goodsQty={}, commissionType={}, cfg[dealer1={}, dealer2={}, dealer3={}, div1={}, div2={}]", - order.getOrderId(), - order.getOrderNo(), - order.getUserId(), - baseAmount, - goods != null ? goods.getGoodsId() : null, - goodsQty, - commissionConfig.commissionType, - commissionConfig.dealerDirectValue, - commissionConfig.dealerSimpleValue, - commissionConfig.dealerThirdValue, - commissionConfig.storeDirectValue, - commissionConfig.storeSimpleValue); - - // 1) 直推/间推(shop_dealer_referee) - DealerRefereeCommission dealerRefereeCommission = settleDealerRefereeCommission(order, baseAmount, goodsQty, commissionConfig, dealerLevel); - - // 2) 门店分润上级:从下单用户开始逐级向上找,命中 ShopDealerUser.type=1 的最近两级(直推门店/间推门店)。 - ShopRoleCommission shopRoleCommission = settleShopRoleRefereeCommission(order, baseAmount, goodsQty, commissionConfig, level1ParentCache, shopRoleCache); - - // 3) 分红:固定比率,每个订单都分。 - TotalDealerCommission totalDealerCommission = settleTotalDealerCommission(order, baseAmount, goodsQty, totalDealerUser); - - // 4) 写入分销订单记录(用于排查/统计;详细分佣以 ShopDealerCapital 为准) - createDealerOrderRecord(order, baseAmount, dealerRefereeCommission, shopRoleCommission, totalDealerCommission); - - log.info("订单结算完成 - orderId={}, orderNo={}, baseAmount={}", order.getOrderId(), order.getOrderNo(), baseAmount); - } - - private DealerRefereeCommission settleDealerRefereeCommission( - ShopOrder order, - BigDecimal baseAmount, - int goodsQty, - CommissionConfig commissionConfig, - int dealerLevel - ) { - // 兼容两种数据形态: - // 1) 同一 userId 下有 level=1/2/3 的多级关系(直接按 level 取); - // 2) 仅维护 level=1(用“查两次”回退获取上级)。 - // - // 严格按“分销设置 level”决定发放到第几级,避免 level=2 时仍触发第3级发放逻辑。 - int normalizedLevel = normalizeDealerLevel(dealerLevel); - - Integer directDealerId = null; - Integer simpleDealerId = null; - Integer thirdDealerId = null; - - if (normalizedLevel >= 1) { - directDealerId = getDealerRefereeId(order.getUserId(), 1); - } - if (normalizedLevel >= 2) { - simpleDealerId = getDealerRefereeId(order.getUserId(), 2); - if (simpleDealerId == null && directDealerId != null) { - simpleDealerId = getDealerRefereeId(directDealerId, 1); - } - } - if (normalizedLevel >= 3) { - thirdDealerId = getDealerRefereeId(order.getUserId(), 3); - if (thirdDealerId == null && simpleDealerId != null) { - thirdDealerId = getDealerRefereeId(simpleDealerId, 1); - } - } - - BigDecimal directMoney = - directDealerId != null ? calcMoneyByCommissionType(baseAmount, commissionConfig.dealerDirectValue, goodsQty, 2, commissionConfig.commissionType) : BigDecimal.ZERO; - // 允许同一条线内同一个人同时拿到“直推 + 间推”(即使 directDealerId == simpleDealerId 也照常发放两笔) - BigDecimal simpleMoney = - simpleDealerId != null ? calcMoneyByCommissionType(baseAmount, commissionConfig.dealerSimpleValue, goodsQty, 2, commissionConfig.commissionType) : BigDecimal.ZERO; - BigDecimal thirdMoney = - thirdDealerId != null ? calcMoneyByCommissionType(baseAmount, commissionConfig.dealerThirdValue, goodsQty, 2, commissionConfig.commissionType) : BigDecimal.ZERO; - - log.info("分销直推/间推/第3级查询结果 - orderNo={}, buyerUserId={}, directDealerId={}, directMoney={}, simpleDealerId={}, simpleMoney={}, thirdDealerId={}, thirdMoney={}", - order.getOrderNo(), order.getUserId(), directDealerId, directMoney, simpleDealerId, simpleMoney, thirdDealerId, thirdMoney); - - // 直推:对方=买家;推荐奖(5%):对方=直推分销商(便于在资金明细中看出“来自哪个下级分销商/团队订单”) - if (normalizedLevel >= 1) { - creditDealerCommission( - directDealerId, - directMoney, - order, - order.getUserId(), - buildCommissionComment("分佣", commissionConfig.commissionType, commissionConfig.dealerDirectValue, goodsQty) - ); - } - if (normalizedLevel >= 2) { - creditDealerCommission( - simpleDealerId, - simpleMoney, - order, - directDealerId, - buildCommissionComment("推荐奖", commissionConfig.commissionType, commissionConfig.dealerSimpleValue, goodsQty) - ); - } - if (normalizedLevel >= 3) { - creditDealerCommission( - thirdDealerId, - thirdMoney, - order, - simpleDealerId, - buildCommissionComment("分润收入", commissionConfig.commissionType, commissionConfig.dealerThirdValue, goodsQty) - ); - } - - return new DealerRefereeCommission(directDealerId, directMoney, simpleDealerId, simpleMoney, thirdDealerId, thirdMoney); - } - - private Integer getDealerRefereeId(Integer userId) { - return getDealerRefereeId(userId, 1); - } - - private Integer getDealerRefereeId(Integer userId, int level) { - if (userId == null) { - return null; - } - ShopDealerReferee rel = shopDealerRefereeService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerReferee::getTenantId, TENANT_ID) - .eq(ShopDealerReferee::getUserId, userId) - .eq(ShopDealerReferee::getLevel, level) - .orderByDesc(ShopDealerReferee::getId) - .last("limit 1") - ); - log.debug("shop_dealer_referee(level={}) 查询 - tenantId={}, userId={}, dealerId={}", - level, TENANT_ID, userId, rel != null ? rel.getDealerId() : null); - return rel != null ? rel.getDealerId() : null; - } - - private ShopRoleCommission settleShopRoleRefereeCommission( - ShopOrder order, - BigDecimal baseAmount, - int goodsQty, - CommissionConfig commissionConfig, - Map level1ParentCache, - Map shopRoleCache - ) { - List shopRoleReferees = findFirstTwoShopRoleReferees(order.getUserId(), level1ParentCache, shopRoleCache); - log.info("门店分润命中结果(type=1门店角色取前两级) - orderNo={}, buyerUserId={}, shopRoleReferees={}", - order.getOrderNo(), order.getUserId(), shopRoleReferees); - if (shopRoleReferees.isEmpty()) { - return ShopRoleCommission.empty(); - } - - if (shopRoleReferees.size() == 1) { - // 仅找到一个门店:按(直推+间推)汇总发放 - BigDecimal singleStoreValue = safeValue(commissionConfig.storeDirectValue).add(safeValue(commissionConfig.storeSimpleValue)); - BigDecimal money = calcMoneyByCommissionType(baseAmount, singleStoreValue, goodsQty, DIVIDEND_SCALE, commissionConfig.commissionType); - log.info("分润发放(仅1门店) - orderNo={}, firstDividendUserId={}, commissionType={}, value={}, money={}", - order.getOrderNo(), shopRoleReferees.get(0), commissionConfig.commissionType, singleStoreValue, money); - creditDealerCommission( - shopRoleReferees.get(0), - money, - order, - order.getUserId(), - buildCommissionComment("门店直推分润(仅1门店)", commissionConfig.commissionType, singleStoreValue, goodsQty) - ); - return new ShopRoleCommission(shopRoleReferees.get(0), money, null, BigDecimal.ZERO); - } - - // 两个或以上:按配置分别发放 - BigDecimal storeDirectMoney = - calcMoneyByCommissionType(baseAmount, commissionConfig.storeDirectValue, goodsQty, DIVIDEND_SCALE, commissionConfig.commissionType); - BigDecimal storeSimpleMoney = - calcMoneyByCommissionType(baseAmount, commissionConfig.storeSimpleValue, goodsQty, DIVIDEND_SCALE, commissionConfig.commissionType); - log.info("分润发放(2人) - orderNo={}, firstDividendUserId={}, commissionType={}, firstValue={}, firstMoney={}, secondDividendUserId={}, secondValue={}, secondMoney={}", - order.getOrderNo(), - shopRoleReferees.get(0), - commissionConfig.commissionType, - commissionConfig.storeDirectValue, - storeDirectMoney, - shopRoleReferees.get(1), - commissionConfig.storeSimpleValue, - storeSimpleMoney); - creditDealerCommission( - shopRoleReferees.get(0), - storeDirectMoney, - order, - order.getUserId(), - buildCommissionComment("门店直推分润", commissionConfig.commissionType, commissionConfig.storeDirectValue, goodsQty) - ); - creditDealerCommission( - shopRoleReferees.get(1), - storeSimpleMoney, - order, - order.getUserId(), - buildCommissionComment("门店间推分润", commissionConfig.commissionType, commissionConfig.storeSimpleValue, goodsQty) - ); - return new ShopRoleCommission(shopRoleReferees.get(0), storeDirectMoney, shopRoleReferees.get(1), storeSimpleMoney); - } - - private TotalDealerCommission settleTotalDealerCommission( - ShopOrder order, - BigDecimal baseAmount, - int goodsQty, - ShopDealerUser totalDealerUser - ) { - if (totalDealerUser == null || totalDealerUser.getUserId() == null) { - return TotalDealerCommission.empty(); - } - BigDecimal rate = safePositive(totalDealerUser.getRate()); - if (rate.signum() <= 0) { - rate = TOTAL_DEALER_DIVIDEND_RATE; - } - BigDecimal money = calcMoneyByCommissionType(baseAmount, rate, goodsQty, DIVIDEND_SCALE, 20); - log.info("分红发放 - orderNo={}, totalDealerUserId={}, rate={}, money={}", - order.getOrderNo(), totalDealerUser.getUserId(), rate, money); - creditDealerCommission( - totalDealerUser.getUserId(), - money, - order, - order.getUserId(), - buildCommissionComment("分红", 20, rate, goodsQty) - ); - return new TotalDealerCommission(totalDealerUser.getUserId(), money); - } - - private ShopDealerUser findTotalDealerUser() { - return shopDealerUserService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerUser::getTenantId, TENANT_ID) - .eq(ShopDealerUser::getType, 2) - .and(w -> w.eq(ShopDealerUser::getIsDelete, 0).or().isNull(ShopDealerUser::getIsDelete)) - .orderByAsc(ShopDealerUser::getId) - .last("limit 1") - ); - } - - private DealerBasicSetting findDealerBasicSetting() { - int level = 2; - ShopDealerSetting setting = shopDealerSettingService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerSetting::getTenantId, TENANT_ID) - .eq(ShopDealerSetting::getKey, "basic") - .last("limit 1") - ); - if (setting != null && setting.getValues() != null && !setting.getValues().isBlank()) { - try { - JSONObject json = JSONObject.parseObject(setting.getValues()); - Integer levelVal = json.getInteger("level"); - if (levelVal != null && levelVal > 0) { - level = Math.min(levelVal, 3); - } - } catch (Exception e) { - log.warn("解析分销设置失败,将使用默认等级 - tenantId={}, values={}", TENANT_ID, setting.getValues(), e); - } - } - return new DealerBasicSetting(level); - } - - private int normalizeDealerLevel(int dealerLevel) { - if (dealerLevel <= 0) { - return 2; - } - return Math.min(dealerLevel, 3); - } - - /** - * shop_dealer_setting(key=basic) 的关键配置(仅取结算任务需要的字段)。 - */ - private static class DealerBasicSetting { - private final int level; - - private DealerBasicSetting(int level) { - this.level = level; - } - } - - /** - * 门店分润规则: - * - 门店角色为 ShopDealerUser.type=1; - * - 从下单用户开始,沿 shop_dealer_referee(level=1) 链路逐级向上找; - * - 遇到第一个 type=1 用户命中为“直推门店用户”,继续向上找到第二个 type=1 用户命中为“间推门店用户”。 - */ - private List findFirstTwoShopRoleReferees( - Integer buyerUserId, - Map level1ParentCache, - Map shopRoleCache - ) { - if (buyerUserId == null) { - return Collections.emptyList(); - } - - return UpstreamUserFinder.findFirstNMatchingUpstreamUsers( - buyerUserId, - 2, - MAX_REFEREE_CHAIN_DEPTH, - childId -> getLevel1ParentCached(childId, level1ParentCache), - userId -> isShopRoleUserCached(userId, shopRoleCache) - ); - } - - private Integer getLevel1ParentCached(Integer userId, Map cache) { - if (userId == null) { - return null; - } - if (cache != null) { - if (cache.containsKey(userId)) { - return cache.get(userId); - } - Integer parent = getDealerRefereeId(userId, 1); - cache.put(userId, parent); - return parent; - } - return getDealerRefereeId(userId, 1); - } - - private boolean isShopRoleUserCached(Integer userId, Map cache) { - if (userId == null) { - return false; - } - if (cache != null) { - Boolean cached = cache.get(userId); - if (cached != null) { - return cached; - } - if (cache.containsKey(userId)) { - return false; - } - boolean val = isShopRoleUser(userId); - cache.put(userId, val); - return val; - } - return isShopRoleUser(userId); - } - - private boolean isShopRoleUser(Integer userId) { - return shopDealerUserService.count( - new LambdaQueryWrapper() - .eq(ShopDealerUser::getTenantId, TENANT_ID) - .eq(ShopDealerUser::getUserId, userId) - .eq(ShopDealerUser::getType, 1) - .and(w -> w.eq(ShopDealerUser::getIsDelete, 0).or().isNull(ShopDealerUser::getIsDelete)) - ) > 0; - } - - private void creditDealerCommission(Integer dealerUserId, BigDecimal money, ShopOrder order, Integer toUserId, String comments) { - if (dealerUserId == null || money == null || money.signum() <= 0) { - return; - } - - // 幂等:同一订单同一类型佣金,避免重复发放(用于任务重跑/补发场景) - LambdaQueryWrapper idempotentQw = new LambdaQueryWrapper() - .eq(ShopDealerCapital::getTenantId, TENANT_ID) - .eq(ShopDealerCapital::getOrderNo, order.getOrderNo()) - .eq(ShopDealerCapital::getUserId, dealerUserId); - if (comments != null) { - // 以“佣金类型前缀”做幂等键,避免 comments 细节文案调整导致重复发放。 - String commentPrefix = comments; - int idx = comments.indexOf('('); - if (idx > 0) { - commentPrefix = comments.substring(0, idx) + "("; - } - idempotentQw.likeRight(ShopDealerCapital::getComments, commentPrefix); - } else { - idempotentQw.isNull(ShopDealerCapital::getComments); - } - boolean alreadyCredited = shopDealerCapitalService.count(idempotentQw) > 0; - if (alreadyCredited) { - log.info("佣金已处理(已入冻结/已落明细),跳过 - orderNo={}, toDealerUserId={}, money={}, comments={}", order.getOrderNo(), dealerUserId, money, comments); - return; - } - - log.info("佣金入冻结 - orderNo={}, toDealerUserId={}, money={}, comments={}", order.getOrderNo(), dealerUserId, money, comments); - - // 订单付款成功:佣金先进入冻结金额(freeze_money),避免后续退款/撤销时已可提现导致对账困难。 - // 并发下避免丢失更新,用SQL自增。 - boolean updated = shopDealerUserService.update( - new LambdaUpdateWrapper() - .eq(ShopDealerUser::getTenantId, TENANT_ID) - .eq(ShopDealerUser::getUserId, dealerUserId) - .setSql("freeze_money = IFNULL(freeze_money,0) + " + money.toPlainString()) - .setSql("total_money = IFNULL(total_money,0) + " + money.toPlainString()) - ); - - if (!updated) { - // 门店角色用户可能未开通分销账户:此时门店直推/间推会“找到了人但入不了账”,收益与明细都不会写入。 - // 这里补偿创建账户后再尝试入账一次。 - ShopDealerUser existed = shopDealerUserService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerUser::getTenantId, TENANT_ID) - .eq(ShopDealerUser::getUserId, dealerUserId) - .last("limit 1") - ); - if (existed == null) { - ShopDealerUser newDealerUser = new ShopDealerUser(); - newDealerUser.setTenantId(TENANT_ID); - newDealerUser.setUserId(dealerUserId); - newDealerUser.setType(0); - newDealerUser.setIsDelete(0); - newDealerUser.setSortNumber(0); - newDealerUser.setFirstNum(0); - newDealerUser.setSecondNum(0); - newDealerUser.setThirdNum(0); - newDealerUser.setMoney(BigDecimal.ZERO); - newDealerUser.setFreezeMoney(BigDecimal.ZERO); - newDealerUser.setTotalMoney(BigDecimal.ZERO); - // 尽量补齐基础信息,避免表字段 NOT NULL 导致插入失败(插入失败会让门店分佣“找到了人但入不了账”)。 - try { - User sysUser = userMapper.selectByIdIgnoreTenant(dealerUserId); - if (sysUser != null) { - newDealerUser.setRealName(sysUser.getRealName() != null ? sysUser.getRealName() : sysUser.getNickname()); - newDealerUser.setMobile(sysUser.getPhone()); - } - } catch (Exception e) { - // 拉取基础信息失败不应阻断结算;后续 update 若失败会有 warn 日志。 - log.warn("创建分销商账户时读取sys_user失败 - tenantId={}, dealerUserId={}", TENANT_ID, dealerUserId, e); - } - newDealerUser.setCreateTime(java.time.LocalDateTime.now()); - newDealerUser.setUpdateTime(java.time.LocalDateTime.now()); - try { - shopDealerUserService.save(newDealerUser); - } catch (Exception e) { - // 并发下可能已被其他线程/实例创建;也可能是字段约束导致插入失败。 - // 继续重试 update,若仍失败会输出 warn,便于定位原因。 - log.warn("创建分销商账户失败 - tenantId={}, dealerUserId={}, orderNo={}", TENANT_ID, dealerUserId, order.getOrderNo(), e); - } - } - - updated = shopDealerUserService.update( - new LambdaUpdateWrapper() - .eq(ShopDealerUser::getTenantId, TENANT_ID) - .eq(ShopDealerUser::getUserId, dealerUserId) - .setSql("freeze_money = IFNULL(freeze_money,0) + " + money.toPlainString()) - .setSql("total_money = IFNULL(total_money,0) + " + money.toPlainString()) - ); - if (!updated) { - log.warn("发放佣金失败:未找到/创建分销商账户 - tenantId={}, dealerUserId={}, orderNo={}", TENANT_ID, dealerUserId, order.getOrderNo()); - return; - } - } - - ShopDealerCapital cap = new ShopDealerCapital(); - cap.setUserId(dealerUserId); - cap.setOrderNo(order.getOrderNo()); - cap.setFlowType(10); - cap.setMoney(money); - cap.setComments(comments); - cap.setToUserId(toUserId); - cap.setMonth(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"))); - cap.setTenantId(TENANT_ID); - shopDealerCapitalService.save(cap); - } - - private void createDealerOrderRecord( - ShopOrder order, - BigDecimal baseAmount, - DealerRefereeCommission dealerRefereeCommission, - ShopRoleCommission shopRoleCommission, - TotalDealerCommission totalDealerCommission - ) { - // 幂等:同一订单只写一条(依赖 order_no + tenant_id 作为业务唯一) - ShopDealerOrder existed = shopDealerOrderService.getOne( - new LambdaQueryWrapper() - .eq(ShopDealerOrder::getTenantId, TENANT_ID) - .eq(ShopDealerOrder::getOrderNo, order.getOrderNo()) - .last("limit 1") - ); - if (existed != null) { - // 允许“补发”门店分润时回填分润字段,避免订单已结算但分润字段一直为空,影响排查/对账。 - LambdaUpdateWrapper uw = new LambdaUpdateWrapper() - .eq(ShopDealerOrder::getTenantId, TENANT_ID) - .eq(ShopDealerOrder::getOrderNo, order.getOrderNo()); - boolean needUpdate = false; - if (shopRoleCommission.storeDirectUserId != null) { - Integer existedUser = existed.getFirstDividendUser(); - boolean needSetUser = existedUser == null; - boolean needSetMoney = existed.getFirstDividend() == null || existed.getFirstDividend().signum() == 0; - if (needSetUser) { - uw.set(ShopDealerOrder::getFirstDividendUser, shopRoleCommission.storeDirectUserId); - needUpdate = true; - } - boolean sameUser = existedUser == null || Objects.equals(existedUser, shopRoleCommission.storeDirectUserId); - if (sameUser && needSetMoney && shopRoleCommission.storeDirectMoney != null && shopRoleCommission.storeDirectMoney.signum() > 0) { - uw.set(ShopDealerOrder::getFirstDividend, shopRoleCommission.storeDirectMoney); - needUpdate = true; - } - } - if (shopRoleCommission.storeSimpleUserId != null) { - Integer existedUser = existed.getSecondDividendUser(); - boolean needSetUser = existedUser == null; - boolean needSetMoney = existed.getSecondDividend() == null || existed.getSecondDividend().signum() == 0; - if (needSetUser) { - uw.set(ShopDealerOrder::getSecondDividendUser, shopRoleCommission.storeSimpleUserId); - needUpdate = true; - } - boolean sameUser = existedUser == null || Objects.equals(existedUser, shopRoleCommission.storeSimpleUserId); - if (sameUser && needSetMoney && shopRoleCommission.storeSimpleMoney != null && shopRoleCommission.storeSimpleMoney.signum() > 0) { - uw.set(ShopDealerOrder::getSecondDividend, shopRoleCommission.storeSimpleMoney); - needUpdate = true; - } - } - if (needUpdate) { - shopDealerOrderService.update(uw); - log.info("ShopDealerOrder已存在,回填门店分润字段 - orderNo={}, firstDividendUser={}, secondDividendUser={}", - order.getOrderNo(), shopRoleCommission.storeDirectUserId, shopRoleCommission.storeSimpleUserId); - } else { - log.info("ShopDealerOrder已存在,跳过写入 - orderNo={}", order.getOrderNo()); - } - return; - } - - ShopDealerOrder dealerOrder = new ShopDealerOrder(); - dealerOrder.setUserId(order.getUserId()); // 买家用户ID - dealerOrder.setOrderNo(order.getOrderNo()); - dealerOrder.setOrderPrice(baseAmount); - dealerOrder.setPayPrice(baseAmount); - - dealerOrder.setFirstUserId(dealerRefereeCommission.directDealerId); - dealerOrder.setFirstMoney(dealerRefereeCommission.directMoney); - dealerOrder.setSecondUserId(dealerRefereeCommission.simpleDealerId); - dealerOrder.setSecondMoney(dealerRefereeCommission.simpleMoney); - dealerOrder.setThirdUserId(dealerRefereeCommission.thirdDealerId); - dealerOrder.setThirdMoney(dealerRefereeCommission.thirdMoney); - - // 门店(角色shop)两级分润单独落字段(详细以 ShopDealerCapital 为准) - dealerOrder.setFirstDividendUser(shopRoleCommission.storeDirectUserId); - dealerOrder.setFirstDividend(shopRoleCommission.storeDirectMoney); - dealerOrder.setSecondDividendUser(shopRoleCommission.storeSimpleUserId); - dealerOrder.setSecondDividend(shopRoleCommission.storeSimpleMoney); - - dealerOrder.setIsSettled(1); - dealerOrder.setSettleTime(java.time.LocalDateTime.now()); - // ShopDealerCapital 关联查询会拿 shop_dealer_order.month(覆盖 a.month),这里需要同步填充。 - dealerOrder.setMonth(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"))); - dealerOrder.setTenantId(TENANT_ID); - - dealerOrder.setComments(buildCommissionTraceComment(dealerRefereeCommission, shopRoleCommission, totalDealerCommission)); - - shopDealerOrderService.save(dealerOrder); - log.info("写入ShopDealerOrder完成 - orderNo={}, firstUserId={}, secondUserId={}, firstDividendUser={}, secondDividendUser={}", - order.getOrderNo(), dealerOrder.getFirstUserId(), dealerOrder.getSecondUserId(), dealerOrder.getFirstDividendUser(), dealerOrder.getSecondDividendUser()); - } - - private String buildCommissionTraceComment( - DealerRefereeCommission dealerRefereeCommission, - ShopRoleCommission shopRoleCommission, - TotalDealerCommission totalDealerCommission - ) { - // 轻量“过程”留痕,方便排查;详细分佣以 ShopDealerCapital 为准。 - return "direct=" + dealerRefereeCommission.directDealerId + ":" + dealerRefereeCommission.directMoney - + ",simple=" + dealerRefereeCommission.simpleDealerId + ":" + dealerRefereeCommission.simpleMoney - + ",third=" + dealerRefereeCommission.thirdDealerId + ":" + dealerRefereeCommission.thirdMoney - + ",dividend1=" + shopRoleCommission.storeDirectUserId + ":" + shopRoleCommission.storeDirectMoney - + ",dividend2=" + shopRoleCommission.storeSimpleUserId + ":" + shopRoleCommission.storeSimpleMoney - + ",totalDealer=" + totalDealerCommission.userId + ":" + totalDealerCommission.money; - } - - private BigDecimal getOrderBaseAmount(ShopOrder order) { - if (order == null) { - return null; - } - return order.getPayPrice(); - } - - private BigDecimal calcMoneyByCommissionType(BigDecimal baseAmount, BigDecimal value, int goodsQty, int scale, Integer commissionType) { - if (value == null || value.signum() <= 0) { - return BigDecimal.ZERO; - } - int qty = Math.max(1, goodsQty); - - // 10: 固定金额(按件);20: 百分比(按订单金额) - if (commissionType != null && commissionType == 10) { - return value.multiply(BigDecimal.valueOf(qty)).setScale(scale, RoundingMode.HALF_UP); - } - return baseAmount != null ? baseAmount.multiply(value).setScale(scale, RoundingMode.HALF_UP) : BigDecimal.ZERO; - } - - private String buildCommissionComment(String label, Integer commissionType, BigDecimal value, int goodsQty) { - if (commissionType != null && commissionType == 10) { - return label + "(type=amount,amount=" + value + ",qty=" + Math.max(1, goodsQty) + ")"; - } - return label + "(type=rate,rate=" + value + ")"; - } - - private OrderGoodsInfo findOrderSingleGoodsInfo(ShopOrder order) { - if (order == null) { - return new OrderGoodsInfo(null, 1); - } - - Integer goodsId = order.getFormId(); - Integer totalNum = order.getTotalNum(); - - if (goodsId == null) { - ShopOrderGoods orderGoods = shopOrderGoodsService.getOne( - new LambdaQueryWrapper() - .eq(ShopOrderGoods::getTenantId, TENANT_ID) - .eq(ShopOrderGoods::getOrderId, order.getOrderId()) - .orderByDesc(ShopOrderGoods::getId) - .last("limit 1") - ); - goodsId = orderGoods != null ? orderGoods.getGoodsId() : null; - if (totalNum == null && orderGoods != null) { - totalNum = orderGoods.getTotalNum(); - } - } - - int qty = totalNum != null && totalNum > 0 ? totalNum : 1; - if (goodsId == null) { - return new OrderGoodsInfo(null, qty); - } - - ShopGoods goods = shopGoodsService.getOne( - new LambdaQueryWrapper() - .eq(ShopGoods::getTenantId, TENANT_ID) - .eq(ShopGoods::getGoodsId, goodsId) - .last("limit 1") - ); - return new OrderGoodsInfo(goods, qty); - } - - private CommissionConfig resolveCommissionConfig(ShopGoods goods) { - // commissionType:10固定金额;20百分比(默认/兼容历史) - Integer commissionType = goods != null && goods.getCommissionType() != null ? goods.getCommissionType() : 20; - if (commissionType != 10 && commissionType != 20) { - commissionType = 20; - } - - if (goods == null) { - // 无商品信息:回退旧逻辑(按比率) - return CommissionConfig.defaultRate(); - } - - if (commissionType == 10) { - // 固定金额模式:字段值>0按金额结算(按件),未配置则视为0。 - return new CommissionConfig( - commissionType, - safePositive(goods.getFirstMoney()), - safePositive(goods.getSecondMoney()), - safePositive(goods.getThirdMoney()), - safePositive(goods.getFirstDividend()), - safePositive(goods.getSecondDividend()) - ); - } - - // 比率模式:默认用旧规则;商品字段值>0则覆盖默认比率。 - BigDecimal dealerDirectValue = RATE_0_10; - BigDecimal dealerSimpleValue = RATE_0_05; - BigDecimal dealerThirdValue = BigDecimal.ZERO; - BigDecimal storeDirectValue = RATE_0_02; - BigDecimal storeSimpleValue = RATE_0_01; - - if (safePositive(goods.getFirstMoney()).signum() > 0) { - dealerDirectValue = goods.getFirstMoney(); - } - if (safePositive(goods.getSecondMoney()).signum() > 0) { - dealerSimpleValue = goods.getSecondMoney(); - } - if (safePositive(goods.getThirdMoney()).signum() > 0) { - dealerThirdValue = goods.getThirdMoney(); - } - if (safePositive(goods.getFirstDividend()).signum() > 0) { - storeDirectValue = goods.getFirstDividend(); - } - if (safePositive(goods.getSecondDividend()).signum() > 0) { - storeSimpleValue = goods.getSecondDividend(); - } - - return new CommissionConfig( - commissionType, - dealerDirectValue, - dealerSimpleValue, - dealerThirdValue, - storeDirectValue, - storeSimpleValue - ); - } - - private BigDecimal safeValue(BigDecimal v) { - return v != null ? v : BigDecimal.ZERO; - } - - private BigDecimal safePositive(BigDecimal v) { - return v != null && v.signum() > 0 ? v : BigDecimal.ZERO; - } - - private static class OrderGoodsInfo { - private final ShopGoods goods; - private final int quantity; - - private OrderGoodsInfo(ShopGoods goods, int quantity) { - this.goods = goods; - this.quantity = Math.max(1, quantity); - } - } - - private static class CommissionConfig { - private final Integer commissionType; - private final BigDecimal dealerDirectValue; - private final BigDecimal dealerSimpleValue; - private final BigDecimal dealerThirdValue; - private final BigDecimal storeDirectValue; - private final BigDecimal storeSimpleValue; - - private static CommissionConfig defaultRate() { - return new CommissionConfig(20, RATE_0_10, RATE_0_05, BigDecimal.ZERO, RATE_0_02, RATE_0_01); - } - - private CommissionConfig( - Integer commissionType, - BigDecimal dealerDirectValue, - BigDecimal dealerSimpleValue, - BigDecimal dealerThirdValue, - BigDecimal storeDirectValue, - BigDecimal storeSimpleValue - ) { - this.commissionType = commissionType != null ? commissionType : 20; - this.dealerDirectValue = dealerDirectValue != null ? dealerDirectValue : BigDecimal.ZERO; - this.dealerSimpleValue = dealerSimpleValue != null ? dealerSimpleValue : BigDecimal.ZERO; - this.dealerThirdValue = dealerThirdValue != null ? dealerThirdValue : BigDecimal.ZERO; - this.storeDirectValue = storeDirectValue != null ? storeDirectValue : BigDecimal.ZERO; - this.storeSimpleValue = storeSimpleValue != null ? storeSimpleValue : BigDecimal.ZERO; - } - } - - private static class DealerRefereeCommission { - private final Integer directDealerId; - private final BigDecimal directMoney; - private final Integer simpleDealerId; - private final BigDecimal simpleMoney; - private final Integer thirdDealerId; - private final BigDecimal thirdMoney; - - private DealerRefereeCommission( - Integer directDealerId, - BigDecimal directMoney, - Integer simpleDealerId, - BigDecimal simpleMoney, - Integer thirdDealerId, - BigDecimal thirdMoney - ) { - this.directDealerId = directDealerId; - this.directMoney = directMoney != null ? directMoney : BigDecimal.ZERO; - this.simpleDealerId = simpleDealerId; - this.simpleMoney = simpleMoney != null ? simpleMoney : BigDecimal.ZERO; - this.thirdDealerId = thirdDealerId; - this.thirdMoney = thirdMoney != null ? thirdMoney : BigDecimal.ZERO; - } - } - - private static class ShopRoleCommission { - private final Integer storeDirectUserId; - private final BigDecimal storeDirectMoney; - private final Integer storeSimpleUserId; - private final BigDecimal storeSimpleMoney; - - private static ShopRoleCommission empty() { - return new ShopRoleCommission(null, BigDecimal.ZERO, null, BigDecimal.ZERO); - } - - private ShopRoleCommission(Integer storeDirectUserId, BigDecimal storeDirectMoney, Integer storeSimpleUserId, BigDecimal storeSimpleMoney) { - this.storeDirectUserId = storeDirectUserId; - this.storeDirectMoney = storeDirectMoney != null ? storeDirectMoney : BigDecimal.ZERO; - this.storeSimpleUserId = storeSimpleUserId; - this.storeSimpleMoney = storeSimpleMoney != null ? storeSimpleMoney : BigDecimal.ZERO; - } - } - - private static class TotalDealerCommission { - private final Integer userId; - private final BigDecimal money; - - private static TotalDealerCommission empty() { - return new TotalDealerCommission(null, BigDecimal.ZERO); - } - - private TotalDealerCommission(Integer userId, BigDecimal money) { - this.userId = userId; - this.money = money != null ? money : BigDecimal.ZERO; - } - } -} diff --git a/src/main/java/com/gxwebsoft/glt/task/GltTicketIssue10584Task.java b/src/main/java/com/gxwebsoft/glt/task/GltTicketIssue10584Task.java deleted file mode 100644 index 8d0d103..0000000 --- a/src/main/java/com/gxwebsoft/glt/task/GltTicketIssue10584Task.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.gxwebsoft.glt.task; - -import com.gxwebsoft.common.core.annotation.IgnoreTenant; -import com.gxwebsoft.glt.entity.GltTicketTemplate; -import com.gxwebsoft.glt.service.GltTicketIssueService; -import com.gxwebsoft.glt.service.GltTicketTemplateService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * GLT 套票发放任务: - * - 每30秒扫描一次今日订单(tenantId=10584, formId in 套票模板 goodsId, payStatus=1, orderStatus=0) - * - 为订单生成用户套票账户 + 释放计划(幂等) - * - 按整改需求:发放阶段不再自动核销/自动下单;“送水下单核销”由用户在履约时主动触发 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@ConditionalOnProperty(prefix = "glt.ticket.issue10584", name = "enabled", havingValue = "true", matchIfMissing = true) -public class GltTicketIssue10584Task { - - private static final int TENANT_ID = 10584; - - private final GltTicketIssueService gltTicketIssueService; - private final GltTicketTemplateService gltTicketTemplateService; - - private final AtomicBoolean running = new AtomicBoolean(false); - - @Scheduled(cron = "${glt.ticket.issue10584.cron:0/15 * * * * ?}") - @IgnoreTenant("定时任务无登录态,需忽略租户隔离;内部使用 tenantId=10584 精确过滤") - public void run() { - if (!running.compareAndSet(false, true)) { - log.warn("套票发放任务仍在执行中,本轮跳过 - tenantId={}", TENANT_ID); - return; - } - - try { - List goodsIds = gltTicketTemplateService.list( - new LambdaQueryWrapper() - .eq(GltTicketTemplate::getTenantId, TENANT_ID) - .eq(GltTicketTemplate::getDeleted, 0) - .eq(GltTicketTemplate::getEnabled, true) - .isNotNull(GltTicketTemplate::getGoodsId) - ).stream() - .map(GltTicketTemplate::getGoodsId) - .distinct() - .toList(); - - if (goodsIds.isEmpty()) { - log.warn("套票发放任务跳过:未配置/未启用套票模板 - tenantId={}", TENANT_ID); - return; - } - - gltTicketIssueService.issueTodayOrders(TENANT_ID, goodsIds); - } finally { - running.set(false); - } - } -} diff --git a/src/main/java/com/gxwebsoft/glt/task/GltTicketOrderAutoConfirm10584Task.java b/src/main/java/com/gxwebsoft/glt/task/GltTicketOrderAutoConfirm10584Task.java deleted file mode 100644 index 4866fce..0000000 --- a/src/main/java/com/gxwebsoft/glt/task/GltTicketOrderAutoConfirm10584Task.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.gxwebsoft.glt.task; - -import com.gxwebsoft.common.core.annotation.IgnoreTenant; -import com.gxwebsoft.glt.service.GltTicketOrderService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * 租户10584:送水订单超时自动确认收货任务 - * - *

扫描已送达待确认(30)且送达时间超过24小时的订单,自动置为已完成(40)。

- *

自动确认后会触发配送员提成结算(幂等)。

- */ -@Slf4j -@Component -@RequiredArgsConstructor -@ConditionalOnProperty(prefix = "glt.ticket-order.auto-confirm10584", name = "enabled", havingValue = "true", matchIfMissing = true) -public class GltTicketOrderAutoConfirm10584Task { - - private static final int TENANT_ID = 10584; - private static final int TIMEOUT_HOURS = 24; - - private final GltTicketOrderService gltTicketOrderService; - - @Value("${glt.ticket-order.auto-confirm10584.batch-size:200}") - private int batchSize; - - private final AtomicBoolean running = new AtomicBoolean(false); - - @Scheduled(cron = "${glt.ticket-order.auto-confirm10584.cron:0/33 * * * * ?}") - @IgnoreTenant("定时任务无登录态,需忽略租户隔离;内部使用 tenantId=10584 精确过滤") - public void run() { - if (!running.compareAndSet(false, true)) { - log.warn("送水订单超时自动确认任务仍在执行中,本轮跳过 - tenantId={}", TENANT_ID); - return; - } - - try { - LocalDateTime now = LocalDateTime.now(); - int confirmed = gltTicketOrderService.autoConfirmTimeout(TENANT_ID, now, TIMEOUT_HOURS, Math.max(batchSize, 1)); - if (confirmed > 0) { - log.info("送水订单超时自动确认完成 - tenantId={}, confirmed={}, now={}", TENANT_ID, confirmed, now); - } - } finally { - running.set(false); - } - } -} diff --git a/src/main/java/com/gxwebsoft/glt/task/GltTicketOrderAutoDispatch10584Task.java b/src/main/java/com/gxwebsoft/glt/task/GltTicketOrderAutoDispatch10584Task.java deleted file mode 100644 index 3a1ef96..0000000 --- a/src/main/java/com/gxwebsoft/glt/task/GltTicketOrderAutoDispatch10584Task.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.gxwebsoft.glt.task; - -import com.gxwebsoft.common.core.annotation.IgnoreTenant; -import com.gxwebsoft.glt.service.GltTicketOrderAutoDispatchService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * GLT 送水订单自动派单任务(tenantId=10584): - * - 扫描未指派配送员的待配送订单(glt_ticket_order.delivery_status=10 且 rider_id 为空/0) - * - 依据收货坐标(优先 ShopOrder.addressLat/addressLng 订单快照;兜底地址表 lat/lng)与 配送员坐标(shop_store_rider.longitude/latitude) 计算距离,派给最近的配送员 - * - 写入 rider_id(配送员 userId),并同步关联商城订单的 riderId/deliveryStatus(复用 accept 逻辑) - * - * 默认不启用;需要在配置中显式打开: - * - glt.ticket.dispatch10584.enabled=true - */ -@Slf4j -@Component -@RequiredArgsConstructor -@ConditionalOnProperty(prefix = "glt.ticket.dispatch10584", name = "enabled", havingValue = "true", matchIfMissing = false) -public class GltTicketOrderAutoDispatch10584Task { - - private static final int TENANT_ID = 10584; - - private final GltTicketOrderAutoDispatchService gltTicketOrderAutoDispatchService; - - private final AtomicBoolean running = new AtomicBoolean(false); - - @Value("${glt.ticket.dispatch10584.batchSize:50}") - private int batchSize; - - @Scheduled(cron = "${glt.ticket.dispatch10584.cron:0/20 * * * * ?}") - @IgnoreTenant("定时任务无登录态,需忽略租户隔离;内部使用 tenantId=10584 精确过滤") - public void run() { - if (!running.compareAndSet(false, true)) { - log.warn("送水订单自动派单任务仍在执行中,本轮跳过 - tenantId={}", TENANT_ID); - return; - } - try { - int n = gltTicketOrderAutoDispatchService.autoDispatchWaitingOrders(TENANT_ID, batchSize); - if (n > 0) { - log.info("送水订单自动派单完成 - tenantId={}, dispatched={}", TENANT_ID, n); - } - } finally { - running.set(false); - } - } -} diff --git a/src/main/java/com/gxwebsoft/glt/task/GltUserTicketAutoReleaseTask.java b/src/main/java/com/gxwebsoft/glt/task/GltUserTicketAutoReleaseTask.java deleted file mode 100644 index 91855db..0000000 --- a/src/main/java/com/gxwebsoft/glt/task/GltUserTicketAutoReleaseTask.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.gxwebsoft.glt.task; - -import com.gxwebsoft.common.core.annotation.IgnoreTenant; -import com.gxwebsoft.glt.service.GltUserTicketAutoReleaseService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * 冻结水票自动释放任务: - * - 扫描 glt_user_ticket_release 中到期且待释放(status=0)的记录 - * - 释放成功:frozen -> available,并将 release.status 置为 1 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@ConditionalOnProperty(prefix = "glt.ticket.auto-release", name = "enabled", havingValue = "true", matchIfMissing = true) -public class GltUserTicketAutoReleaseTask { - - private final GltUserTicketAutoReleaseService autoReleaseService; - - @Value("${glt.ticket.auto-release.batch-size:200}") - private int batchSize; - - private final AtomicBoolean running = new AtomicBoolean(false); - - @Scheduled(cron = "${glt.ticket.auto-release.cron:0 */10 * * * ?}") - @IgnoreTenant("定时任务无登录态,需忽略租户隔离;释放记录自带 tenantId,更新时会校验 tenantId") - public void run() { - if (!running.compareAndSet(false, true)) { - log.warn("冻结水票自动释放任务仍在执行中,本轮跳过"); - return; - } - - try { - LocalDateTime now = LocalDateTime.now(); - int released = autoReleaseService.releaseDue(now, Math.max(batchSize, 1)); - if (released > 0) { - log.info("冻结水票自动释放完成 - released={}, now={}", released, now); - } - } finally { - running.set(false); - } - } -} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmCarController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmCarController.java index eb9838a..c25428e 100644 --- a/src/main/java/com/gxwebsoft/hjm/controller/HjmCarController.java +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmCarController.java @@ -336,7 +336,7 @@ public class HjmCarController extends BaseController { if (param.getLatitude() == null || param.getLatitude().isEmpty() || param.getLongitude() == null || param.getLongitude().isEmpty()) { // 如果坐标为空,直接返回分页结果 - param.setLimit(100L); + param.setLimit(2000L); return success(hjmCarService.pageRel(param)); } diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java index ae553dc..c5c3afd 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java @@ -16,7 +16,6 @@ import com.gxwebsoft.common.system.entity.Payment; import com.gxwebsoft.shop.entity.ShopOrderDelivery; import com.gxwebsoft.shop.entity.ShopUserAddress; import com.gxwebsoft.shop.service.*; -import com.gxwebsoft.glt.service.GltTicketRevokeService; import com.gxwebsoft.shop.service.impl.KuaiDi100Impl; import com.gxwebsoft.shop.task.OrderAutoCancelTask; import com.gxwebsoft.shop.entity.ShopOrder; @@ -104,8 +103,6 @@ public class ShopOrderController extends BaseController { @Resource private ShopStoreFenceService shopStoreFenceService; @Resource - private GltTicketRevokeService gltTicketRevokeService; - @Resource private ShopDealerCommissionRollbackService shopDealerCommissionRollbackService; @Operation(summary = "分页查询订单") @@ -378,20 +375,6 @@ public class ShopOrderController extends BaseController { } if (shopOrderService.updateById(shopOrder)) { - // 后台手工将订单改为“已取消”(2)时,需同步撤销可能已发放的水票/释放计划/送水订单 - try { - if (Objects.equals(shopOrder.getOrderStatus(), 2) && !Objects.equals(shopOrderNow.getOrderStatus(), 2)) { - gltTicketRevokeService.revokeByShopOrder( - ObjectUtil.defaultIfNull(shopOrder.getTenantId(), shopOrderNow.getTenantId()), - shopOrderNow.getOrderId(), - shopOrderNow.getOrderNo(), - "订单取消撤销水票" - ); - } - } catch (Exception e) { - logger.error("订单更新为取消后撤销水票失败 - orderId={}, orderNo={}", - shopOrderNow.getOrderId(), shopOrderNow.getOrderNo(), e); - } // 如果订单上带了快递单号(常见于后台手工修正/补录),同步到发货单表,避免发货单还是旧单号 if (StrUtil.isNotBlank(shopOrder.getExpressNo()) && shopOrder.getOrderId() != null) { @@ -547,20 +530,6 @@ public class ShopOrderController extends BaseController { return fail("退款成功,但订单状态更新失败,请联系管理员"); } - // 退款成功后撤销水票相关数据(幂等;无水票则无副作用) - try { - gltTicketRevokeService.revokeByShopOrder( - current.getTenantId(), - current.getOrderId(), - current.getOrderNo(), - "订单退款成功撤销水票" - ); - } catch (Exception e) { - // 退款已完成,不能因为撤销失败而回滚;记录日志以便人工补偿 - logger.error("退款成功但撤销水票失败 - tenantId={}, orderId={}, orderNo={}", - current.getTenantId(), current.getOrderId(), current.getOrderNo(), e); - } - // 退款成功后回退分红/分润/佣金(从 ShopDealerUser 中扣回;以 ShopDealerCapital 明细为准) try { Integer tenantId = ObjectUtil.defaultIfNull(current.getTenantId(), getTenantId()); @@ -622,40 +591,6 @@ public class ShopOrderController extends BaseController { } boolean ok = batchParam.update(shopOrderService, "order_id"); if (ok) { - // 兼容后台直接将订单改为“已取消”(2)的场景:同步撤销可能已发放的水票/释放计划/送水订单 - try { - if (batchParam != null && batchParam.getData() != null - && Objects.equals(batchParam.getData().getOrderStatus(), 2) - && batchParam.getIds() != null && !batchParam.getIds().isEmpty()) { - for (Object rawId : batchParam.getIds()) { - Integer orderId = null; - if (rawId instanceof Integer) { - orderId = (Integer) rawId; - } else if (rawId != null) { - try { - orderId = Integer.valueOf(rawId.toString()); - } catch (Exception ignore) { - // ignore malformed id - } - } - if (orderId == null) { - continue; - } - ShopOrder order = shopOrderService.getById(orderId); - if (order == null) { - continue; - } - gltTicketRevokeService.revokeByShopOrder( - order.getTenantId(), - order.getOrderId(), - order.getOrderNo(), - "订单取消撤销水票" - ); - } - } - } catch (Exception e) { - logger.error("批量取消订单后撤销水票失败", e); - } return success("修改成功"); } return fail("修改失败");