Commit 8d52008d by wuchengwu

根据人员编号获取人员所有信息

parent 46af64d5
......@@ -70,7 +70,18 @@
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
</properties>
<dependencies>
<!-- 日志 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.18</version>
</dependency>
<!-- 日志 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
......
package com.founder.common;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @Projectname: hnxtbabootHaiNan
* @Filename: AuthConfigurer
* @Author: wcw
* @Description: TODO
* @since 2023/3/3 10:33
*/
@Configuration
public class AuthConfigurer implements WebMvcConfigurer {
@Autowired
RequestLimitInterceptor requestLimitInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(requestLimitInterceptor);
}
}
\ No newline at end of file
package com.founder.common;
import java.util.Map;
import java.util.concurrent.*;
/**
* @Projectname: hnxtbabootHaiNan
* @Filename: CacheUtils
* @Author: wcw
* @Description: TODO
* @since 2023/3/3 10:34
*/
public class CacheUtils {
// 键值对集合
private final static Map<String, Entity> map = new ConcurrentHashMap<>();
// 定时器线程池, 用于清除过期缓存
private final static ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
/**
* 添加缓存
*/
public synchronized static void put(String key, Object data) {
CacheUtils.put(key, data, 0);
}
/**
* 添加缓存
* 过期时间: 单位毫秒, 0表示无限长
*/
public synchronized static void put(String key, Object data, long expire) {
// 清除原键值对
CacheUtils.remove(key);
// 设置过期时间
if (expire > 0) {
Future future = executor.schedule(() -> {
// 过期后清除该键值对
synchronized (CacheUtils.class) {
map.remove(key);
}
}, expire, TimeUnit.MILLISECONDS);
map.put(key, new Entity(data, future));
} else {
// 不设置过期时间
map.put(key, new Entity(data, null));
}
}
/**
* 读取缓存
*/
public synchronized static Object get(String key) {
Entity entity = map.get(key);
return entity == null ? null : entity.getValue();
}
/**
* 读取缓存
* clazz 值类型
*/
public synchronized static <T> T get(String key, Class<T> clazz) {
return clazz.cast(CacheUtils.get(key));
}
/**
* 清除指定缓存
* 返回值为指定key的value
*/
public synchronized static Object remove(String key) {
// 清除指定缓存数据
Entity entity = map.remove(key);
if (entity == null)
return null;
// 清除指定键值对定时器
Future future = entity.getFuture();
if (future != null)
future.cancel(true);
return entity.getValue();
}
/**
* 清除所有缓存
*/
public synchronized static void removeAll() {
map.clear();
}
/**
* 查询当前缓存的键值对数量
*/
public synchronized static int size() {
return map.size();
}
/**
* 缓存实体类
*/
private static class Entity {
// 键值对的value
private Object value;
// 定时器的future
private Future future;
/**
* 创建实体类
*/
public Entity(Object value, Future future) {
this.value = value;
this.future = future;
}
/**
* 获取value值
*/
public Object getValue() {
return value;
}
/**
* 获取future对象
*/
public Future getFuture() {
return future;
}
}
}
\ No newline at end of file
package com.founder.common;
/**
* @Projectname: hnxtbabootHaiNan
* @Filename: RequestLimitException
* @Author: wcw
* @Description: TODO
* @since 2023/3/3 10:36
*/
public class RequestLimitException extends Exception {
private static final long serialVersionUID = 1364225358754654702L;
/**
* Instantiates a new Request limit exception.
*/
public RequestLimitException() {
super("HTTP请求超出设定的限制");
}
/**
* Instantiates a new Request limit exception.
*
* @param message the message
*/
public RequestLimitException(String message) {
super(message);
}
}
\ No newline at end of file
package com.founder.common;
import com.founder.utils.SysUitl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Slf4j
@Component
public class RequestLimitInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object object) throws RequestLimitException {
try {
Integer limit_count = 25;
Integer limit_time = 1000 *60;
String ip = SysUitl.getIp(httpServletRequest);
String url = httpServletRequest.getRequestURL().toString();
String key = "req_limit_".concat(url).concat(ip);
String cache = (String)CacheUtils.get(key);
if (null == cache) {
String value = "1_" + System.currentTimeMillis();
CacheUtils.put(key,value,limit_time);
} else {
String value = (String) cache;
String[] s = value.split("_");
int count = Integer.parseInt(s[0]);
if (count > limit_count) {
log.info("用户IP[{}], 访问地址[{}], 超过了限定的次数[{}]", ip, url, limit_count);
throw new RequestLimitException();
}
value = (count + 1) + "_" + s[1];
long last = limit_time - (System.currentTimeMillis() - Long.parseLong(s[1]));
if (last > 0) {
CacheUtils.put(key,value,limit_time);
}
}
} catch (RequestLimitException e) {
throw e;
} catch (Exception e) {
log.error("发生异常", e);
}
return true;
}
}
......@@ -20,8 +20,8 @@ public class FilterConfig extends WebMvcConfigurerAdapter {
excludePathPatterns("/","/toLogin","/hncsLogin","/hnzzLogin","/hnxtLogin","/hnhyLogin","/hnsyLogin","/hnyueyLogin","/hnzjjLogin","/hncdLogin","/hnyiyLogin","/hnczLogin","/hnyzLogin","/hnhhLogin","/hnldLogin","/hnxxLogin","/hainanLogin","/neimengLogin","/getSjcntDetail","/noLogin","/saveSwSjXx",
"/saveHmSjXx","/getSwSjXx","/getYthcjryxxByZjhm","/getYthcjUser","/getZfbaUser","/getZwbzJbxxCnt","/getCcbzJbxxCnt","/toswcj","/getJasypt",
"/doLogin","/toHome","/static*//**","/refreshCodeCache","/qxdoLogin","/queryNameByCode","/queryTypeCode","/toFjxz","/toCzsmxz","/download/**","/toObjectKJ","/catchimg","/iframe1","/iframe2","/xj","/report","/SavePersonInfo4Nmtc","/singleLoginAct","/getZjxxbdjg","/toShowScan","/ajaxGettoAfisStr","/getTime","/savePersonScanBackInfo",
"/getYhkDetail","/getSwDetail","/getRyzjzpimages","/getRyzpimages","/getPmimages","/getGdimages","/zipurlzw","/dataAssess","/sendMessage","/toSavaRybdxx","/queryZwbzds","/getYthcjryxxByRybh","/checkClientVp","/insertZwbhAndZwfkxxByRybh","/getXsjsbdxq"
,"/getRyxx"
"/getYhkDetail","/getSwDetail","/getRyzjzpimages","/getRyzpimages","/getPmimages","/getGdimages","/zipurlzw","/dataAssess","/sendMessage","/toSavaRybdxx","/queryZwbzds","/getYthcjryxxByRybh","/checkClientVp","/insertZwbhAndZwfkxxByRybh","/getXsjsbdxq",
"/getRyxx"
);
......
......@@ -58,14 +58,15 @@ public class TbStRyController {
*/
@PostMapping("/getRyxx")
public XzResult ryxxsb(@RequestBody Jsythcjsj jsythcjsj) {
if (StringUtils.isEmpty(jsythcjsj.getRycjbh())) {
return XzResult.error("查询失败").data("code", JZWFW_CODE_FAIL).data("info", "人员编号不能为空!");
if (StringUtils.isEmpty(jsythcjsj.getSfhm())) {
return XzResult.error("查询失败").data("code", JZWFW_CODE_FAIL).data("info", "身份号码不能为空!");
}
Ryjbxx ryjbxx = mapper.queryRycj(jsythcjsj.getRycjbh());
Ryjbxx ryjbxx = mapper.queryRycj(jsythcjsj.getSfhm());
if (ryjbxx == null) {
return XzResult.error("查询失败").data("code", JZWFW_CODE_FAIL).data("info", "没有查到此人员编号基本信息");
return XzResult.error("查询失败").data("code", JZWFW_CODE_FAIL).data("info", "没有查到此身份号码基本信息");
}
jsythcjsj.setRycjbh(ryjbxx.getRYCJBH());
return tbStRyService.jsythcjsj(jsythcjsj);
}
......
......@@ -64,7 +64,7 @@ public interface TbXwRycjDao {
* @param rybh
* @return
*/
public Ryjbxx queryRycj(@Param("rybh") String rybh);
public Ryjbxx queryRycj(@Param("sfhm") String sfhm);
public List<ShangbaoRxzp> queryShangbaoRyzpList(@Param("rybh") String rybh);
public ShangbaoSwxx queryShangbaoRycjSw(@Param("rybh") String rybh);
public List<ShangbaoHmxx> queryShangbaoRycjHmList(@Param("rybh") String rybh);
......
......@@ -25,6 +25,7 @@ public class Jsythcjsj {
* 人员采集编号
*/
private String rycjbh;
private String sfhm;
private String starttime;
}
......@@ -915,7 +915,7 @@
cj.LRDWDM AS CJDW_GAJGJGDM,
cj.LRDWMC AS CJDW_DWMC,
to_char( cj.lrsj,'yyyy-mm-dd hh24:mi:ss') AS CJSJ,
cj.LRRSFZH AS CJR_SFHM,
(SELECT uu.identitycard FROM sys_user uu WHERE uu.username = cj.LRR and rownum =1 ) as CJR_SFHM,
cj.LRR AS CJR_XM,
cj.SGSX as SG,
cj.TZSX as TZ,
......@@ -923,7 +923,7 @@
FROM
TB_RY_RYCJ cj
WHERE
cj.rybh = #{rybh , jdbcType=VARCHAR }
cj.gmsfhm = #{sfhm , jdbcType=VARCHAR }
and ( cj.SCBZ = '0' OR cj.SCBZ IS NULL )
ORDER BY
cj.gxsj DESC
......@@ -932,17 +932,16 @@
<select id="queryShangbaoRyzpList" parameterType="java.lang.String" resultType="com.founder.model.xz.ShangbaoRxzp">
select
rybh as RYCJBH,
rybh as RYBH,
dzwjnr as RXZP,
zpbw as RYZPLXDM,
LRDWDM as CJDW_GAJGJGDM,
LRDWMC as CJDW_DWMC,
LRR as CJR_XM,
to_char( lrsj,'yyyy-mm-dd hh24:mi:ss') as CJSJ
from TB_RY_RYZP
where rybh = #{rybh} and SCBZ ='0'and length(dzwjnr)>0
ASJXGRYBH as RYCJBH,
ASJXGRYBH as RYBH,
RYZP_DZWJNR as RXZP,
ZPBW as RYZPLXDM,
XXDJDW_GAJGJGDM as CJDW_GAJGJGDM,
XXDJDW_GAJGMC as CJDW_DWMC,
XXDJRY_XM as CJR_XM,
to_char( DJSJ,'yyyy-mm-dd hh24:mi:ss') as CJSJ
from tb_rycj_zp
where ASJXGRYBH = #{rybh} and xxsc_pdbz ='0'
order by zpbw desc
</select>
......@@ -1024,6 +1023,7 @@
LRR as CJR_XM,
to_char( CJSJ,'yyyy-mm-dd hh24:mi:ss') as CJSJ
from TB_XW_YTHCJ_SSXDWP where RYBH = #{rybh , jdbcType=VARCHAR } and (XXSC_PDBZ='0' or XXSC_PDBZ is null)
</select>
<select id="queryShangbaoRycjTstzList" parameterType="java.lang.String" resultType="com.founder.model.xz.ShangbaoTstzxx">
......
......@@ -204,7 +204,7 @@
t.true_name trueName,(select name from sys_dictitem s where s.groupid='CODE_UNIT' and s.code = t.unitcode) as unitname from SYS_USER t where 1=1
and scbz='0'
and username=#{userName}
and password=#{password}
and password_yrhcj=#{password}
</select>
<update id="updateUser" parameterType="com.founder.model.User">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment