Commit 63de3ec6 authored by 万成波's avatar 万成波

企微门户部门、用户同步

parent cd3c81fd
......@@ -13,13 +13,6 @@ spring:
url: jdbc:mysql://47.110.32.247:3306/safe_campus_bbs?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&tinyInt1isBit=false&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowMultiQueries=true
username: mysql
password: passWd2025@tangguo.ren
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url: jdbc:mysql://47.110.32.247:3306/qyweixin-campus-dev?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&tinyInt1isBit=false&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowMultiQueries=true
username: mysql
password: passWd2025@tangguo.ren
# 初始连接数
initialSize: 5
# 最小连接池数量
......@@ -104,5 +97,5 @@ wx:
cp:
corp-id: ww63ca87d5f8647514
app-config:
agent-id: 1000044
secret: GqApjJ2aDuntiU5iQ9yqx8JKQwYDMrg1tTHdeeF0BWA
agent-id: 1000072
secret: O2KXf2b9oGG2GBrpzDgf4EFdhGwl2KaS9BWtJQT1I64
......@@ -51,7 +51,7 @@ public class BbsMomentController extends BaseController {
@PreAuthorize("@ss.hasPermi('bbs:moment:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
BbsMomentListVO dbMoment = this.bbsMomentService.getMomentDetail(id);
BbsMomentListVO dbMoment = this.bbsMomentService.selectBbsMoment(id);
return success(dbMoment);
}
......
......@@ -25,6 +25,15 @@ public interface IBbsMomentService extends IService<BbsMoment> {
List<BbsMoment> selectBbsMomentList(BbsMoment bbsMoment);
/**
* 查询动态详情
*
* @param momentId 动态Id
* @return 动态列表
*/
BbsMomentListVO selectBbsMoment(Long momentId);
/**
* 删除动态
*
......
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tangguo.common.enums.*;
import com.tangguo.common.exception.ServiceException;
import com.tangguo.common.mauth.MobileTokenHelper;
import com.tangguo.common.utils.SecurityUtils;
import com.tangguo.common.utils.SensitiveWordUtils;
import com.tangguo.domain.BbsMoment;
import com.tangguo.domain.BbsMomentAttachment;
......@@ -68,6 +69,22 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
}
/**
* 查询动态详情
*
* @param momentId 动态Id
* @return 动态列表
*/
@Override
public BbsMomentListVO selectBbsMoment(Long momentId) {
String userName = SecurityUtils.getUsername();
BbsMomentListVO dbMoment = this.baseMapper.selectMomentDetail(momentId, userName);
this.fillMoment(Collections.singletonList(dbMoment), userName);
dbMoment.setComments(null);
return dbMoment;
}
/**
* 删除动态
*
......@@ -302,7 +319,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
newComment.setNikeName(MobileTokenHelper.getNikeName());
newComment.setContent(bo.getContent());
newComment.setStatus(CommentStatus.ZC.getStatus());
newComment.setIsFeatured(1);
newComment.setIsFeatured(0);
this.commentService.save(newComment);
// 更新动态评论
......
......@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserMomentCount" resultType="com.tangguo.domain.vo.BbsUserMomentCountVO">
SELECT
(SELECT COUNT(*) FROM bbs_moment WHERE user_name = #{userName}) AS monent_count,
(SELECT COUNT(*) FROM bbs_moment WHERE user_name = #{userName}) AS moment_count,
(SELECT COUNT(*) FROM bbs_moment_comment WHERE user_name = #{userName}) AS comment_count,
(SELECT COUNT(*) FROM bbs_moment_like WHERE user_name = #{userName}) AS like_count
</select>
......
......@@ -28,10 +28,9 @@
</exclusions>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.tangguo</groupId>
<artifactId>safe-campus-common</artifactId>
<artifactId>safe-campus-system</artifactId>
</dependency>
</dependencies>
......
package com.tangguo.quartz.task;
import com.tangguo.system.mapper.SysDeptMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 增量同步企微门户部门到本地
*
* @author 谈笑
* @createTime 2025-09-08 14:54:30 星期一
*/
@Slf4j
@Component
public class SyncQwmhSysDeptToLocalTask {
@Autowired
private SysDeptMapper sysDeptMapper;
public void run() {
log.info("=> 开始增量同步企微门户部门到本地");
int records = this.sysDeptMapper.syncQwmhSysDeptToLocal();
log.info("=> 增量同步企微门户部门到本地完毕,同步记录条数:{}", records);
}
}
package com.tangguo.quartz.task;
import com.tangguo.system.mapper.SysUserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 增量同步企微门户用户到本地
*
* @author 谈笑
* @createTime 2025-09-08 14:54:30 星期一
*/
@Slf4j
@Component
public class SyncQwmhSysUserToLocalTask {
@Autowired
private SysUserMapper sysDeptMapper;
public void run() {
log.info("=> 开始增量同步企微门户用户到本地");
int records = this.sysDeptMapper.syncQwmhSysUserToLocal();
log.info("=> 增量同步企微门户用户到本地完毕,同步记录条数:{}", records);
}
}
......@@ -115,4 +115,11 @@ public interface SysDeptMapper {
* @return 结果
*/
public int deleteDeptById(Long deptId);
/**
* 增量同步企微门户部门到本地
*/
int syncQwmhSysDeptToLocal();
}
......@@ -124,4 +124,11 @@ public interface SysUserMapper {
* @return 结果
*/
public SysUser checkEmailUnique(String email);
/**
* 增量同步企微门户用户到本地
*/
int syncQwmhSysUserToLocal();
}
......@@ -188,5 +188,20 @@
set del_flag = '2'
where dept_id = #{deptId}
</delete>
<update id="syncQwmhSysDeptToLocal">
INSERT INTO sys_dept(dept_id, parent_id, ancestors, dept_name, order_num, create_time)
(
SELECT
q.id, q.parent_id, q.ancestors, q.dept_name, q.order_num, q.create_time
FROM
qwmh_sys_dept q
LEFT JOIN
sys_dept d ON d.dept_id = q.id
WHERE
d.dept_name IS NULL
)
</update>
</mapper>
......@@ -264,5 +264,20 @@
#{userId}
</foreach>
</delete>
<update id="syncQwmhSysUserToLocal">
INSERT INTO sys_user(dept_id, user_name, nick_name, phonenumber, email, avatar, create_time)
(
SELECT
q.dept_id, q.user_name, q.real_name, q.phonenumber, q.email, q.avatar, q.create_time
FROM
qwmh_sys_user q
LEFT JOIN
sys_user u ON u.user_name = q.user_name
WHERE
u.user_name IS NULL AND q.user_name != 'admin'
)
</update>
</mapper>
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