This commit is contained in:
parent
5559f732c6
commit
c10942f0ce
|
|
@ -122,10 +122,10 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!--代码生成-->
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-generator</artifactId>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
<!-- lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ public class RobotController extends BaseController {
|
|||
|
||||
@PostMapping("sedXml")
|
||||
public AjaxResult getDetails(@RequestBody RobotVo robotVo) {
|
||||
log.info("机器人puid:{}",robotVo.getPuId());
|
||||
return service.getDetails(robotVo);
|
||||
}
|
||||
|
||||
|
|
@ -179,6 +180,7 @@ public class RobotController extends BaseController {
|
|||
*/
|
||||
@PostMapping("delVideo")
|
||||
public AjaxResult delVideo(@RequestBody RobotVideoVo vo) {
|
||||
log.info("删除录音文件:{}",vo);
|
||||
return service.delVideo(vo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,4 +89,13 @@ public interface SbdUserMapper {
|
|||
void addSbdStatus(@Param("id") String uuid);
|
||||
|
||||
|
||||
/**
|
||||
* 查询库里已存在的数据
|
||||
* @return List<SbdUserVo>
|
||||
* @author cwchen
|
||||
* @date 2025/7/25 17:55
|
||||
*/
|
||||
List<SbdUserVo> getExistGdWorker();
|
||||
|
||||
void addOrUpdateSbdUserInfo(@Param("list") List<SbdUserVo> missDataList, @Param("type") int type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ public class UserConfigSchedule {
|
|||
@Autowired
|
||||
ISbdUserService service;
|
||||
|
||||
@Scheduled(cron = "0 0/10 * * * ?")
|
||||
@Scheduled(cron = "0 0/30 * * * ?")
|
||||
// @Scheduled(cron = "0 0/2 * * * ?")
|
||||
@PostConstruct
|
||||
public void initUserInfo(){
|
||||
service.initUserInfo();
|
||||
|
|
|
|||
|
|
@ -624,7 +624,9 @@ public class RobotServiceImpl implements IRobotService {
|
|||
String delXml= QxUtils.getAddVideo(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_DEL_VIDEO,vo.getId(),null,null);
|
||||
String delRes=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,vo.getPuid(),delXml);
|
||||
Map<String,String> map= XmlUtils.getSuccess(delRes);
|
||||
if("200".equals(map.get("code"))){
|
||||
log.info("删除结果:{}",map);
|
||||
if("200".equals(map.get("code")) || 200 ==Integer.parseInt(map.get("code"))){
|
||||
log.info("删除成功");
|
||||
mapper.delVideo(vo);
|
||||
}
|
||||
return AjaxResult.success(map);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.bonus.common.core.domain.AjaxResult;
|
|||
import com.bonus.common.utils.DateUtils;
|
||||
import com.bonus.common.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -24,6 +25,8 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
|
|
@ -185,11 +188,25 @@ public class SbdUserServiceImpl implements ISbdUserService {
|
|||
@Override
|
||||
public void initUserInfo() {
|
||||
try{
|
||||
//查询每日作业人员数据
|
||||
// 1.查询每日作业人员数据
|
||||
List<SbdUserVo> list=mapper.getGdWorker();
|
||||
if(list!=null && !list.isEmpty()){
|
||||
mapper.replaceSbdUserInfo(list);
|
||||
// 2.查询库里已存在的施工人员数据
|
||||
List<SbdUserVo> existList=mapper.getExistGdWorker();
|
||||
// 3.新增人员
|
||||
List<SbdUserVo> missDataList = findMissingInB(existList, list);
|
||||
// 4.已存在人员-更新即可
|
||||
List<SbdUserVo> updateDataList = findExitInB(existList, list);
|
||||
if(CollectionUtils.isNotEmpty(missDataList)){
|
||||
log.info("新增施工人员数据:{}",missDataList.size());
|
||||
mapper.addOrUpdateSbdUserInfo(missDataList,1);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(updateDataList)){
|
||||
log.info("更新施工人员数据:{}",updateDataList.size());
|
||||
mapper.addOrUpdateSbdUserInfo(updateDataList,2);
|
||||
}
|
||||
/*if(list!=null && !list.isEmpty()){
|
||||
mapper.replaceSbdUserInfo(list);
|
||||
}*/
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
|
|
@ -197,6 +214,41 @@ public class SbdUserServiceImpl implements ISbdUserService {
|
|||
}
|
||||
}
|
||||
|
||||
public static List<SbdUserVo> findMissingInB(List<SbdUserVo> listA, List<SbdUserVo> listB) {
|
||||
if(CollectionUtils.isEmpty(listB)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if(CollectionUtils.isEmpty(listA) && CollectionUtils.isNotEmpty(listB)){
|
||||
return listB;
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(listA)&& listA.size() == listB.size()){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 收集 listA 中的所有 id 到 Set 中
|
||||
Set<String> aIdCards = listA.stream()
|
||||
.map(SbdUserVo::getId)
|
||||
.collect(Collectors.toSet());
|
||||
// 筛选出 listB 中 idCard 不在 listA 中的元素
|
||||
return listB.stream()
|
||||
.filter(b -> !aIdCards.contains(b.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<SbdUserVo> findExitInB(List<SbdUserVo> listA, List<SbdUserVo> listB) {
|
||||
if(CollectionUtils.isEmpty(listB)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 提取listA中的所有id
|
||||
List<String> idCardsInA = listA.stream()
|
||||
.map(SbdUserVo::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 过滤listB,只保留id在listA中存在的元素
|
||||
return listB.stream()
|
||||
.filter(fcFaceContrastBean -> idCardsInA.contains(fcFaceContrastBean.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 下方人员人脸数据
|
||||
* @param vo
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.business.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,6 +20,8 @@ public class RobotVo {
|
|||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
@JsonProperty("puId")
|
||||
@JsonAlias({"puid", "puId"})
|
||||
private String puId;
|
||||
/**
|
||||
* 设备名称
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ public class SbdUserVo {
|
|||
*/
|
||||
private String bast64;
|
||||
|
||||
private String birthDate;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ spring:
|
|||
# username: root
|
||||
# password: Bonus@admin123!
|
||||
# master:
|
||||
# url: jdbc:mysql://127.0.0.1:3306/sbd_robot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: mroot
|
||||
# password: bonus@admin123
|
||||
# url: jdbc:mysql://127.0.0.1:3306/wunan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
# username: root
|
||||
# password: ccw1998@yyt1999
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:23306/wunan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://127.0.0.1:23306/wunan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
username: root
|
||||
password: youotech123#
|
||||
# 从库数据源
|
||||
|
|
@ -77,7 +77,7 @@ spring:
|
|||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
multi-statement-allow: false
|
||||
|
||||
#minio:
|
||||
# endpoint: http://127.0.0.1:9001
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ server:
|
|||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.bonus: debug
|
||||
com.bonus: info
|
||||
org.springframework: warn
|
||||
|
||||
# 用户配置
|
||||
|
|
@ -47,6 +47,8 @@ user:
|
|||
|
||||
# Spring配置
|
||||
spring:
|
||||
jpa:
|
||||
show-sql: false
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
|
|
@ -74,6 +76,7 @@ spring:
|
|||
# 数据库索引
|
||||
database: 7
|
||||
password: youotech123#
|
||||
# password:
|
||||
# 密码
|
||||
# password: Xbzbns@Redis123!
|
||||
# 连接超时时间
|
||||
|
|
|
|||
|
|
@ -70,12 +70,19 @@
|
|||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.bonus" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<!-- 关闭MyBatis SQL日志 -->
|
||||
<logger name="org.mybatis" level="ERROR"/>
|
||||
<logger name="java.sql" level="ERROR"/>
|
||||
<logger name="java.sql.Connection" level="ERROR"/>
|
||||
<logger name="java.sql.Statement" level="ERROR"/>
|
||||
<logger name="java.sql.PreparedStatement" level="ERROR"/>
|
||||
<logger name="java.sql.ResultSet" level="ERROR"/>
|
||||
<logger name="org.springframework.jdbc" level="ERROR"/>
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
<!--删除录音文件-->
|
||||
<delete id="delVideo">
|
||||
delete from robot_location_point where id=#{id}
|
||||
delete from robot_video_file where id=#{id}
|
||||
</delete>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="addOrUpdateSbdUserInfo">
|
||||
<if test="type == 1">
|
||||
insert into robot_sbd_user(
|
||||
id, data_source, user_name, sex, image, post,
|
||||
work_type, mobile, create_time, update_time, del_flag,age,id_card,birth_date
|
||||
)values
|
||||
<foreach collection="list" item="item" separator=",">(
|
||||
#{item.id}, #{item.dataSource},#{item.userName},#{item.sex},
|
||||
#{item.idCard},#{item.post},#{item.workType},#{item.mobile},now(),now(),0,#{item.age},#{item.idCard},#{item.birthDate}
|
||||
)
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
<foreach collection="list" item="item" index="index" separator=";">
|
||||
UPDATE robot_sbd_user
|
||||
<set>
|
||||
data_source=#{item.dataSource},
|
||||
user_name=#{item.userName},
|
||||
sex=#{item.sex},
|
||||
image=#{item.idCard},
|
||||
post=#{item.post},
|
||||
work_type=#{item.workType},
|
||||
mobile=#{item.mobile},
|
||||
update_time=now(),
|
||||
age = #{item.age},
|
||||
id_card = #{item.idCard},
|
||||
birth_date = #{item.birthDate}
|
||||
</set>
|
||||
WHERE id = #{item.id}
|
||||
</foreach>
|
||||
</if>
|
||||
</insert>
|
||||
<delete id="delUser">
|
||||
update robot_sbd_user set del_flag=1 where id=#{id}
|
||||
</delete>
|
||||
|
|
@ -105,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
limit 12
|
||||
</select>
|
||||
<select id="getGdWorker" resultType="com.bonus.business.vo.SbdUserVo">
|
||||
select id,name userName,bak_ic idCard,birth_date,sex,age,mobile_phone mobile,'1' dataSource,
|
||||
select id,name userName,bak_ic idCard,birth_date AS birthDate,sex,age,mobile_phone mobile,'1' dataSource,
|
||||
CASE sta_type
|
||||
WHEN 1 THEN '特种人员'
|
||||
WHEN 2 THEN '其它技能人员'
|
||||
|
|
@ -127,7 +159,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
'其他人员'
|
||||
END AS 'post'
|
||||
from gd_worker
|
||||
WHERE DATE(create_time)=CURRENT_DATE or DATE(update_time)=CURRENT_DATE
|
||||
|
||||
</select>
|
||||
<select id="getSbdUserList" resultType="com.bonus.business.vo.PersonVo">
|
||||
|
|
@ -151,4 +182,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND sus.send_status=0
|
||||
</if>
|
||||
</select>
|
||||
<!--查询库里已存在的数据-->
|
||||
<select id="getExistGdWorker" resultType="com.bonus.business.vo.SbdUserVo">
|
||||
SELECT id,id_card FROM robot_sbd_user
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -58,7 +58,11 @@
|
|||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
package com.bonus.framework.security.filter;
|
||||
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.exceptions.JWTDecodeException;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
|
|
@ -154,4 +157,13 @@ public class JwtUtils
|
|||
{
|
||||
return Convert.toStr(claims.get(key), "");
|
||||
}
|
||||
|
||||
public static String getSessionKey(String token) {
|
||||
try {
|
||||
DecodedJWT jwt = JWT.decode(token);
|
||||
return jwt.getClaim("sessionKey").asString();
|
||||
} catch (JWTDecodeException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class SbdUserJwtTokenFilter implements HandlerInterceptor {
|
|||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
String uri=request.getRequestURI();
|
||||
System.err.println(uri);
|
||||
// System.err.println(uri);
|
||||
if (StringUtils.matches(uri, AuthWriteUtils.getWriteUrl())) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -58,7 +58,9 @@ public class SbdUserJwtTokenFilter implements HandlerInterceptor {
|
|||
}
|
||||
}
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
String sessionKey = JwtUtils.getValue(token,"seesion");
|
||||
// String sessionKey = JwtUtils.getValue(token,"session");
|
||||
String sessionKey = JwtUtils.getSessionKey(token);
|
||||
// System.err.println("sessionKey:" + sessionKey);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);
|
||||
ResponseEntity<JSONObject> responseEntity = restTemplate.exchange("http://10.138.55.105:8097/cas/api/validate/sk?sessionKey=" + sessionKey, HttpMethod.GET, formEntity, JSONObject.class);
|
||||
|
|
|
|||
Loading…
Reference in New Issue