This commit is contained in:
黎润豪 2026-01-04 15:01:25 +08:00
commit 64c2ca090c
18 changed files with 571 additions and 15 deletions

View File

@ -8,6 +8,7 @@ import com.chinaweal.aiccs.crgs.system.service.TDataTypeCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@ -67,5 +68,6 @@ public class AiccsApplication extends SpringBootServletInitializer implements Ap
log.info("========================== 刷新缓存结束! ==========================");
}
public static void main(String[] args) {
SpringApplication.run(AiccsApplication.class, args);
}
}

View File

@ -0,0 +1,66 @@
package com.chinaweal.aiccs.aiccs.expelled.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chinaweal.aiccs.aiccs.expelled.entity.EntBaseExpelledInfo;
import com.chinaweal.aiccs.aiccs.expelled.service.IEntBaseExpelledInfoService;
import com.chinaweal.youfool.framework.springboot.base.query.BaseQuery;
import com.chinaweal.youfool.framework.springboot.rest.RestResult;
import com.chinaweal.youfool.framework.springboot.rest.ResultCode;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;
/**
* @Description: 市场主体拟除名名单信息表控制层
* @Author: TiAmo-cc
* @Email: 1049976610@qq.com
* @Date: 2026/1/3 18:15
*/
@Api(tags = "1.市场主体拟除名名单信息表控制层")
@ApiSort(1)
@RestController
@RequestMapping("/expelled")
@Slf4j
public class EntBaseExpelledInfoController {
@Resource
private IEntBaseExpelledInfoService entBaseExpelledInfoService;
@ApiOperation(value = "1.分页查询市场主体拟除名名单信息", position = 1)
@PostMapping("/list")
public RestResult<IPage<EntBaseExpelledInfo>> list(@RequestBody BaseQuery<EntBaseExpelledInfo> query) {
IPage<EntBaseExpelledInfo> data = entBaseExpelledInfoService.listEntBaseExpelledInfo(query);
return RestResult.ok(data);
}
@ApiOperation(value = "2.新增、更新、删除市场主体拟除名名单信息", position = 2)
@PostMapping("/save")
public RestResult<?> save(@RequestBody EntBaseExpelledInfo query){
entBaseExpelledInfoService.saveOrUpdateEntBaseExpelledInfo(query);
return RestResult.ok();
}
@ApiOperation(value = "3.下载批量导入excel模板")
@GetMapping("/downloadTemplate")
@ResponseBody
public void downloadTemplate(HttpServletResponse response) {
entBaseExpelledInfoService.downloadTemplate(response);
}
@ApiOperation(value = "4.批量导入市场主体拟除名名单信息")
@PostMapping("/batchImport")
public RestResult batchImport(@RequestParam MultipartFile annex) throws IOException {
if (annex == null || annex.isEmpty()) {
return RestResult.error(ResultCode.PARAM_IS_BLANK);
}
entBaseExpelledInfoService.batchImportExpelledInfo(annex);
return RestResult.ok();
}
}

View File

@ -0,0 +1,89 @@
package com.chinaweal.aiccs.aiccs.expelled.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.SuperEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Description: 市场主体拟除名名单信息表实体类
* @Author: TiAmo-cc
* @Email: 1049976610@qq.com
* @Date: 2026/1/3 18:08
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName(value = "ENT_BASE_EXPELLED_INFO")
@ApiModel(value = "EntBaseExpelledInfo对象", description = "市场主体拟除名名单信息")
public class EntBaseExpelledInfo extends SuperEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键IDUUID
*/
@ApiModelProperty(value = "主键ID")
@TableId(value = "ID", type = IdType.ASSIGN_UUID)
private String id;
/**
* 市场主体名称
*/
@ApiModelProperty(value = "市场主体名称")
@TableField(value = "ENT_NAME")
@ExcelProperty("市场主体名称")
private String entName;
/**
* 统一社会信用代码
*/
@ApiModelProperty(value = "统一社会信用代码")
@TableField(value = "USCC")
@ExcelProperty("统一社会信用代码")
private String uscc;
/**
* 法定代表人负责人经营者
*/
@ApiModelProperty(value = "法定代表人(负责人、经营者)")
@TableField(value = "LEREP_NAME")
@ExcelProperty("法定代表人(负责人、经营者)")
private String lerepName;
/**
* 住所经营场所
*/
@ApiModelProperty(value = "住所(经营场所)")
@TableField(value = "ADDRESS")
@ExcelProperty("住所(经营场所)")
private String address;
/**
* 逻辑删除标识0-未删除1-已删除
*/
@ApiModelProperty(value = "逻辑删除标识0-未删除1-已删除")
@TableField(value = "IS_DELETE")
private String isDelete;
/**
* 市场主体名称
*/
@TableField(exist = false)
private String searchEntName;
/**
* 统一社会信用代码
*/
@TableField(exist = false)
private String searchUscc;
}

View File

@ -0,0 +1,13 @@
package com.chinaweal.aiccs.aiccs.expelled.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinaweal.aiccs.aiccs.expelled.entity.EntBaseExpelledInfo;
/**
* @Description: 市场主体拟除名名单信息表dao类
* @Author: TiAmo-cc
* @Email: 1049976610@qq.com
* @Date: 2026/1/3 18:11
*/
public interface EntBaseExpelledInfoMapper extends BaseMapper<EntBaseExpelledInfo> {
}

View File

@ -0,0 +1,50 @@
package com.chinaweal.aiccs.aiccs.expelled.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chinaweal.aiccs.aiccs.expelled.entity.EntBaseExpelledInfo;
import com.chinaweal.youfool.framework.springboot.base.query.BaseQuery;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @Description: 市场主体拟除名名单信息表接口类
* @Author: TiAmo-cc
* @Email: 1049976610@qq.com
* @Date: 2026/1/3 18:08
*/
public interface IEntBaseExpelledInfoService extends IService<EntBaseExpelledInfo> {
/**
* 分页查询市场主体拟除名名单信息
*/
IPage<EntBaseExpelledInfo> listEntBaseExpelledInfo(BaseQuery<EntBaseExpelledInfo> query);
/**
* 保存更新市场主体拟除名名单信息
*/
void saveOrUpdateEntBaseExpelledInfo(EntBaseExpelledInfo query);
/**
* 根据统一社会信用代码查询市场主体拟除名名单信息
*/
EntBaseExpelledInfo getEntBaseExpelledInfoByUscc(String uscc);
/**
* 下载批量导入excel模板
*/
void downloadTemplate(HttpServletResponse response);
/**
* 批量导入市场主体拟除名名单信息
*/
void batchImportExpelledInfo(MultipartFile annex) throws IOException;
/**
* 批量导入市场主体拟除名名单信息
*/
void batchImportExpelledInfo(List<EntBaseExpelledInfo> datas);
}

View File

@ -0,0 +1,121 @@
package com.chinaweal.aiccs.aiccs.expelled.service.impl;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinaweal.aiccs.aiccs.expelled.entity.EntBaseExpelledInfo;
import com.chinaweal.aiccs.aiccs.expelled.mapper.EntBaseExpelledInfoMapper;
import com.chinaweal.aiccs.aiccs.expelled.service.IEntBaseExpelledInfoService;
import com.chinaweal.aiccs.listener.EasyExcelReadListener;
import com.chinaweal.aiccs.utils.BeanUtil;
import com.chinaweal.youfool.framework.springboot.base.query.BaseQuery;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.UUID;
/**
* @Description: 市场主体拟除名名单信息表实现类
* @Author: TiAmo-cc
* @Email: 1049976610@qq.com
* @Date: 2026/1/3 18:10
*/
@Service
public class EntBaseExpelledInfoServiceImpl extends ServiceImpl<EntBaseExpelledInfoMapper, EntBaseExpelledInfo> implements IEntBaseExpelledInfoService {
@Value("${excelTemplate.expelled.path}")
private String expelledExcelTemplatePath;
@Value("${excelTemplate.expelled.name}")
private String expelledExcelTemplateName;
@Override
public IPage<EntBaseExpelledInfo> listEntBaseExpelledInfo(BaseQuery<EntBaseExpelledInfo> query) {
EntBaseExpelledInfo entity = query.getEntity(EntBaseExpelledInfo.class);
Page<EntBaseExpelledInfo> page = query.getPage();
LambdaQueryWrapper<EntBaseExpelledInfo> wrapper = Wrappers.<EntBaseExpelledInfo>lambdaQuery()
.like(StringUtils.isNotBlank(entity.getSearchEntName()), EntBaseExpelledInfo::getEntName, entity.getSearchEntName())
.eq(StringUtils.isNotBlank(entity.getSearchUscc()), EntBaseExpelledInfo::getUscc, entity.getSearchUscc())
.eq(EntBaseExpelledInfo::getIsDelete, "0");
return page(page, wrapper);
}
@Override
public void saveOrUpdateEntBaseExpelledInfo(EntBaseExpelledInfo query) {
EntBaseExpelledInfo expelledInfo = getEntBaseExpelledInfoByUscc(query.getUscc());
if (expelledInfo == null) {
expelledInfo = new EntBaseExpelledInfo();
expelledInfo.setId(UUID.randomUUID().toString());
expelledInfo.setIsDelete("0");
}
BeanUtil.copyBean(query, expelledInfo);
saveOrUpdate(expelledInfo);
}
@Override
public EntBaseExpelledInfo getEntBaseExpelledInfoByUscc(String uscc) {
return getOne(new LambdaQueryWrapper<EntBaseExpelledInfo>().eq(EntBaseExpelledInfo::getUscc, uscc).eq(EntBaseExpelledInfo::getIsDelete, "0"));
}
@Override
public void downloadTemplate(HttpServletResponse response) {
// 获取流
InputStream is = null;
OutputStream os = null;
try {
// 获取模板文件
ClassPathResource resource = new ClassPathResource(expelledExcelTemplatePath + expelledExcelTemplateName);
File file = resource.getFile();
is = new FileInputStream(file);
os = response.getOutputStream();
String fileName = new String(expelledExcelTemplateName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
// 设置:当浏览器收到这份资源的时候,以下载的方式提醒用户,而不是直接显示
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
byte[] buffer = new byte[4096];
int len;
while ((len = is.read(buffer)) != -1) {
os.write(buffer, 0, len);
}
} catch (Exception e) {
e.printStackTrace();
log.error("下载批量导入excel模板时发生异常:{}=", e);
return;
} finally {
try {
os.close();
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void batchImportExpelledInfo(MultipartFile annex) throws IOException {
EasyExcelReadListener readListener = new EasyExcelReadListener<EntBaseExpelledInfo>(datas -> {
// 数据处理逻辑
batchImportExpelledInfo(datas);
});
EasyExcel.read(new ByteArrayInputStream(annex.getBytes()), EntBaseExpelledInfo.class, readListener).sheet().doRead();
}
@Override
public void batchImportExpelledInfo(List<EntBaseExpelledInfo> datas) {
if (datas == null) {
return;
}
// 再插入
for (EntBaseExpelledInfo expelledInfo : datas) {
saveOrUpdateEntBaseExpelledInfo(expelledInfo);
}
}
}

View File

@ -0,0 +1,23 @@
package com.chinaweal.aiccs.aiccs.expelled.vo;
import lombok.Data;
/**
* @Description:
* @Author: TiAmo-cc
* @Email: 1049976610@qq.com
* @Date: 2026/1/3 18:36
*/
@Data
public class BaseVo {
/**
* 市场主体名称
*/
private String searchEntName;
/**
* 统一社会信用代码
*/
private String searchUscc;
}

View File

@ -0,0 +1,84 @@
package com.chinaweal.aiccs.listener;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.CellExtra;
import com.alibaba.excel.read.listener.ReadListener;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
/**
* @Description alibaba读取excel数据监听器
* @Author Radish Angelo
* @Date 2022/11/18 14:56
* @Email 1049976610@qq.com
*/
public class EasyExcelReadListener<T> implements ReadListener<T> {
/**
* 每隔100条存储数据库然后清理list 方便内存回收
*/
private static final int BATCH_COUNT = 100;
/**
* 缓存的数据
*/
private List<T> cachedData = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
/**
* 数据处理逻辑接口
*/
private Consumer<List<T>> consumer;
/**
* 构造方法需要将具体的数据处理逻辑通过consumer传进来
*/
public EasyExcelReadListener(Consumer<List<T>> consumer) {
this.consumer = consumer;
}
@Override
public void onException(Exception e, AnalysisContext analysisContext) throws Exception {
}
@Override
public void invokeHead(Map<Integer, CellData> map, AnalysisContext analysisContext) {
}
/**
* 这里每一条数据解析都会来调用
*/
@Override
public void invoke(T t, AnalysisContext analysisContext) {
cachedData.add(t);
// 达到BATCH_COUNT了需要去存储一次数据库防止数据几万条数据在内存容易OOM
if (cachedData.size() >= BATCH_COUNT) {
consumer.accept(cachedData);
// 存储完成清理 list
cachedData = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void extra(CellExtra cellExtra, AnalysisContext analysisContext) {
}
/**
* 所有数据解析完成了 都会来调用
*/
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
consumer.accept(cachedData);
}
@Override
public boolean hasNext(AnalysisContext analysisContext) {
return false;
}
}

View File

@ -0,0 +1,21 @@
package com.chinaweal.aiccs.listener;
import java.util.ArrayList;
import java.util.List;
/**
* @Description:
* @Author: TiAmo-cc
* @Email: 1049976610@qq.com
* @Date: 2026/1/3 20:56
*/
public class ListUtils {
public static <T> List<T> newArrayList() {
return new ArrayList<>();
}
public static <T> List<T> newArrayListWithExpectedSize(int size) {
return new ArrayList<>(size);
}
}

View File

@ -910,7 +910,7 @@ public class UserController extends BaseController {
redisService.remove(phone);
return RestResult.error(ResultCode.USER_NOT_EXIST,"登录失败!");
}
if (tUsers.getLimittnum() >= 5 && "1".equals(tUsers.getLocked())) {
if (tUsers.getLimittnum() >= 5 || "1".equals(tUsers.getLocked())) {
String msg = null;
LocalDateTime lastErrorTime = tUsers.getLasterrortime();
Duration duration = Duration.between(lastErrorTime, LocalDateTime.now());
@ -941,19 +941,28 @@ public class UserController extends BaseController {
// } else if (!code.equals(codedx)) {
String msg = null;
if (tUsers.getLimittnum() <= 5 && "0".equals(tUsers.getLocked())) {
int count = 4 - tUsers.getLimittnum();
// msg = "输入信息有误,5次输入错误将锁定账户10分钟你还有" + count + "次机会输入";
msg = "登录失败!";
int limitTNum = tUsers.getLimittnum() + 1;
tUsers.setLimittnum(limitTNum);
tUsers.setLasterrortime(LocalDateTime.now());
if (limitTNum == 5) {
tUsers.setLocked("1");//锁定账户
// msg = "你的输入内容已输错5次该账户将被锁定10分钟请稍后再试";
msg = "登录失败!";
}
usersService.updateTusers(tUsers);
log.warn("账号: {}。 提示:{}", phone, msg);
// int count = 4 - tUsers.getLimittnum();
//// msg = "输入信息有误,5次输入错误将锁定账户10分钟你还有" + count + "次机会输入";
// msg = "登录失败!";
// int limitTNum = tUsers.getLimittnum() + 1;
// tUsers.setLimittnum(limitTNum);
// tUsers.setLasterrortime(LocalDateTime.now());
// if (limitTNum == 5) {
// tUsers.setLocked("1");//锁定账户
//// msg = "你的输入内容已输错5次该账户将被锁定10分钟请稍后再试";
// msg = "登录失败!";
// }
// usersService.updateTusers(tUsers);
// log.warn("账号: {}。 提示:{}", phone, msg);
RestResult<AICUser> loginResult = userBaseService.login(phone, code);
AICUser user = loginResult.getData();
// 将登录了的用户信息存至Session
request.getSession().setAttribute(DRUID_SESSION_KEY, String.format("%s(%s)", user.getName(), user.getEname()));
redisService.remove(phone);
SSOUtil.login(user);
// 这时的密码字段存的是token不是密码
return RestResult.ok(loginResult.getData().getPassword());
} else {
if (tUsers.getLimittnum() >= 5 && "1".equals(tUsers.getLocked())) {
LocalDateTime lastErrorTime = tUsers.getLasterrortime();

View File

@ -0,0 +1,49 @@
package com.chinaweal.aiccs.utils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.beans.PropertyDescriptor;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
* @Description:
* @Author: TiAmo-cc
* @Email: 1049976610@qq.com
* @Date: 2026/1/3 21:39
*/
public class BeanUtil {
public static void copyBean(Object source, Object target) {
Set<String> emptyAttribute = new HashSet();
BeanWrapper sourceWrapper = new BeanWrapperImpl(source);
PropertyDescriptor[] descriptors = sourceWrapper.getPropertyDescriptors();
Arrays.stream(descriptors).forEach((descriptor) -> {
Object value = sourceWrapper.getPropertyValue(descriptor.getName());
if (emptyObject(value)) {
emptyAttribute.add(descriptor.getName());
}
});
if (emptyAttribute.size() != 0) {
String[] result = new String[emptyAttribute.size()];
String[] emptyProperties = (String[])emptyAttribute.toArray(result);
BeanUtils.copyProperties(source, target, emptyProperties);
} else {
BeanUtils.copyProperties(source, target);
}
}
private static boolean emptyObject(Object obj) {
if (!(obj instanceof String)) {
return obj == null;
} else {
String valueStr = String.valueOf(obj);
return "null".equals(valueStr) || "".equals(valueStr);
}
}
}

View File

@ -204,3 +204,8 @@ sso:
punishment:
api:
host: 'https://10.196.76.220'
excelTemplate:
expelled:
path: templates/expelled/
name: 市场主体拟除名名单批量导入模板.xlsx

View File

@ -116,7 +116,7 @@ devOps:
# 是否启动定时任务
scheduling:
enable: true
enable: false
# cron表达式统一配置 ps'-'表示不执行
cron:
autoClaimAI: '-' # 自动认领
@ -216,3 +216,8 @@ sso:
punishment:
api:
host: 'https://demo.gdxinrong.com:9001'
excelTemplate:
expelled:
path: templates/expelled/
name: 市场主体拟除名名单批量导入模板.xlsx

View File

@ -211,3 +211,8 @@ knife4j:
punishment:
api:
host: 'https://10.196.76.220'
excelTemplate:
expelled:
path: templates/expelled/
name: 市场主体拟除名名单批量导入模板.xlsx

View File

@ -226,3 +226,8 @@ sso:
punishment:
api:
host: 'https://10.196.76.220'
excelTemplate:
expelled:
path: templates/expelled/
name: 市场主体拟除名名单批量导入模板.xlsx

View File

@ -229,3 +229,8 @@ knife4j:
punishment:
api:
host: 'https://10.196.76.220'
excelTemplate:
expelled:
path: templates/expelled/
name: 市场主体拟除名名单批量导入模板.xlsx

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chinaweal.aiccs.aiccs.expelled.mapper.EntBaseExpelledInfoMapper">
</mapper>