Browse Source

消息通知

master
wxc 2 years ago
parent
commit
3807d81935
  1. 5
      mailbox-common/src/main/java/com/biutag/entity/system/PoliceUser.java
  2. 6
      mailbox-lan/pom.xml
  3. 33
      mailbox-lan/src/main/java/com/biutag/lan/cache/UserCatch.java
  4. 79
      mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java
  5. 6
      mailbox-lan/src/main/java/com/biutag/lan/config/WebSocketConfig.java
  6. 6
      mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java
  7. 29
      mailbox-lan/src/main/java/com/biutag/lan/controller/NoticeController.java
  8. 2
      mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java
  9. 44
      mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLogsController.java
  10. 37
      mailbox-lan/src/main/java/com/biutag/lan/crontab/LogJob.java
  11. 5
      mailbox-lan/src/main/java/com/biutag/lan/domain/Notice.java
  12. 5
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java
  13. 17
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/NoticeTotalVo.java
  14. 9
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java
  15. 4
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java
  16. 54
      mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java
  17. 19
      mailbox-lan/src/main/java/com/biutag/lan/service/SmsService.java
  18. 46
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java
  19. 34
      mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java
  20. 43
      mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLoginServiceImpl.java
  21. 26
      mailbox-lan/src/main/java/com/biutag/lan/util/LoginUserHelper.java
  22. 5
      mailbox-lan/src/main/java/com/biutag/lan/util/SmsLan.java
  23. 57
      mailbox-lan/src/main/java/com/biutag/lan/vo/system/LoginUser.java
  24. 59
      mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserInformVo.java
  25. 12
      mailbox-lan/src/main/java/com/biutag/lan/ws/WsController.java
  26. 29
      mailbox-lan/src/main/java/com/biutag/lan/ws/message/WorkMessage.java
  27. 2
      mailbox-lan/src/main/resources/application.yml
  28. 2
      mailbox-outer/src/main/java/com/biutag/outer/controller/AuthController.java
  29. 9
      mailbox-outer/src/main/java/com/biutag/outer/controller/FileController.java
  30. 6
      mailbox-outer/src/main/java/com/biutag/outer/controller/SmsController.java
  31. 2
      mailbox-outer/src/main/java/com/biutag/outer/domain/bo/MailBo.java
  32. 3
      mailbox-outer/src/main/java/com/biutag/outer/job/Job.java
  33. 4
      mailbox-outer/src/main/java/com/biutag/outer/mapper/MailMapper.java
  34. 11
      mailbox-outer/src/main/java/com/biutag/outer/util/SmsSend.java
  35. 2
      mailbox-outer/src/main/java/com/biutag/outer/util/Weixin2.java
  36. 9
      sql/0306.sql
  37. 17
      sql/0307.sql

5
mailbox-common/src/main/java/com/biutag/entity/system/PoliceUser.java

@ -117,4 +117,9 @@ public class PoliceUser implements Serializable {
@ApiModelProperty("删除时间")
private Long deleteTime;
/**
* 数据部门ID
*/
private Integer dataDeptId;
}

6
mailbox-lan/pom.xml

@ -140,6 +140,12 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>3.1.8</version>
</dependency>
</dependencies>
<build>

33
mailbox-lan/src/main/java/com/biutag/lan/cache/UserCatch.java vendored

@ -0,0 +1,33 @@
package com.biutag.lan.cache;
import com.biutag.lan.vo.system.LoginUser;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import java.util.concurrent.TimeUnit;
public class UserCatch {
private static final Cache<Integer, LoginUser> cache = Caffeine.newBuilder()
// 8 * 60分钟
.expireAfterWrite(480, TimeUnit.MINUTES) // 设置写入后过期时间
.maximumSize(1000) // 最多1000人
.build();
public static Integer set(Integer key, LoginUser user) {
cache.put(key, user);
return key;
}
public static LoginUser update(Integer key, LoginUser user) {
cache.put(key, user);
return user;
}
public static LoginUser get(Integer key) {
return cache.getIfPresent(key);
}
public static void remove(Integer key) {
cache.invalidate(key);
}
}

79
mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java

@ -1,23 +1,16 @@
package com.biutag.lan.config;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.biutag.aop.NotLogin;
import com.biutag.aop.NotPower;
import com.biutag.core.AjaxResult;
import com.biutag.entity.system.PoliceUser;
import com.biutag.enums.ErrorEnum;
import com.biutag.exception.BusinessException;
import com.biutag.exception.LoginException;
import com.biutag.lan.service.IDeptService;
import com.biutag.lan.service.IRoleService;
import com.biutag.lan.mapper.PoliceUserMapper;
import com.biutag.lan.vo.system.DeptVo;
import com.biutag.lan.util.LoginUserHelper;
import com.biutag.lan.vo.system.LoginUser;
import com.biutag.util.StringUtils;
import com.biutag.util.YmlUtils;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.jetbrains.annotations.NotNull;
@ -25,8 +18,6 @@ import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
@ -37,15 +28,6 @@ import java.util.List;
@Component
public class AdminInterceptor implements HandlerInterceptor {
@Resource
PoliceUserMapper policeUserMapper;
@Resource
IRoleService roleService;
@Resource
IDeptService deptService;
/**
* 前置处理器
*
@ -62,13 +44,9 @@ public class AdminInterceptor implements HandlerInterceptor {
// 请求方法类型
String reqUri = request.getRequestURI();
if (reqUri.startsWith("/api/file/download/template/")) {
return true;
}
if (!(handler instanceof HandlerMethod) || !reqUri.startsWith("/api")) {
return HandlerInterceptor.super.preHandle(request, response, handler);
}
// 登录权限校验
try {
response.setContentType("application/json;charset=utf-8");
@ -151,57 +129,16 @@ public class AdminInterceptor implements HandlerInterceptor {
if (StringUtils.isNotNull(method) && method.isAnnotationPresent(NotLogin.class)) {
break;
}
// 令牌校验
String token = StpUtil.getTokenValue();
if (StringUtils.isNull(token) || StringUtils.isBlank(token)) {
Integer errCode = ErrorEnum.TOKEN_EMPTY.getCode();
String errMsg = ErrorEnum.TOKEN_EMPTY.getMsg();
throw new LoginException(errCode, errMsg);
}
// 登录校验
Object id = StpUtil.getLoginId();
if (StringUtils.isNull(id)) {
Integer errCode = ErrorEnum.TOKEN_INVALID.getCode();
String errMsg = ErrorEnum.TOKEN_INVALID.getMsg();
throw new LoginException(errCode, errMsg);
}
// 用户校验
PoliceUser adminUser = policeUserMapper.selectOne(
new QueryWrapper<PoliceUser>()
.select("id,username,name,emp_no,role_ids,dept_ids,post_ids,is_disable, dept_name")
.eq("id", Integer.parseInt(id.toString()))
.eq("is_delete", 0)
.last("limit 1"));
// 删除校验
if (StringUtils.isNull(adminUser)) {
Integer errCode = ErrorEnum.TOKEN_INVALID.getCode();
String errMsg = ErrorEnum.TOKEN_INVALID.getMsg();
throw new LoginException(errCode, errMsg);
}
// 禁用校验
if (adminUser.getIsDisable().equals(1)) {
Integer errCode = ErrorEnum.LOGIN_DISABLE_ERROR.getCode();
String errMsg = ErrorEnum.LOGIN_DISABLE_ERROR.getMsg();
throw new LoginException(errCode, errMsg);
}
if (StrUtil.isBlank(adminUser.getRoleIds())) {
throw new BusinessException("用户角色为空");
}
DeptVo deptVo = deptService.detail(Integer.parseInt(adminUser.getDeptIds()));
LoginUser adminUser = LoginUserHelper.getCurrentUser();
// 写入线程
AdminThreadLocal.put("adminId", id);
//AdminThreadLocal.put("username", adminUser.getUsername());
AdminThreadLocal.put("adminId", adminUser.getId());
AdminThreadLocal.put("empNo", adminUser.getEmpNo());
AdminThreadLocal.put("name", deptVo.getName());
AdminThreadLocal.put("roleIds", adminUser.getRoleIds());
AdminThreadLocal.put("deptIds", adminUser.getDeptIds());
AdminThreadLocal.put("name", adminUser.getDeptName());
AdminThreadLocal.put("roleIds", adminUser.getRoleId());
AdminThreadLocal.put("deptIds", adminUser.getDeptId());
AdminThreadLocal.put("deptName", adminUser.getDeptName());
// AdminThreadLocal.put("postIds", adminUser.getPostIds());
AdminThreadLocal.put("roleName", roleService.detail(Integer.parseInt(adminUser.getRoleIds())).getName());
AdminThreadLocal.put("roleName", adminUser.getRoleName());
// 权限校验
if (!adminUser.getId().equals(1)) {
this.checkAuth(method, reqUri);

6
mailbox-lan/src/main/java/com/biutag/lan/config/WebSocketConfig.java

@ -12,13 +12,13 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setApplicationDestinationPrefixes("/app");
registry.enableSimpleBroker("/topic","/queue");
registry.setApplicationDestinationPrefixes("/xterm");
registry.enableSimpleBroker("/topic");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/port").setAllowedOriginPatterns("*").withSockJS();
registry.addEndpoint("web-terminal").setAllowedOriginPatterns("*").withSockJS();
}
}

6
mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java

@ -1,6 +1,8 @@
package com.biutag.lan.controller;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.aop.NotLogin;
import com.biutag.aop.NotPower;
import com.biutag.config.Minio;
import com.biutag.core.AjaxResult;
@ -38,8 +40,8 @@ public class FileController {
@ResponseBody
@PostMapping("upload/base64")
public AjaxResult<JSONObject> upload(@RequestBody JSONObject file) {
log.info("文件上传 base64: {}", file.toJSONString());
String base64 = file.getString("base64");
log.info("文件上传 base64: {}", StrUtil.isNotBlank(base64) ? base64.substring(0, Math.min(20, base64.length())) : "");
if (base64.startsWith("data:image")) {
base64 = base64.substring(base64.indexOf(",") + 1);
}
@ -47,7 +49,7 @@ public class FileController {
return AjaxResult.success(JSONObject.of("filepath", filepath));
}
@NotPower
@NotLogin
@GetMapping("stream/**")
public void download(HttpServletRequest request, HttpServletResponse response) throws IOException {
String requestURI = request.getRequestURI();

29
mailbox-lan/src/main/java/com/biutag/lan/controller/NoticeController.java

@ -0,0 +1,29 @@
package com.biutag.lan.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.aop.NotPower;
import com.biutag.core.AjaxResult;
import com.biutag.lan.domain.Notice;
import com.biutag.lan.domain.vo.NoticeTotalVo;
import com.biutag.lan.service.NoticeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RequiredArgsConstructor
@RequestMapping("/api/notice")
@RestController
public class NoticeController {
private final NoticeService noticeService;
@NotPower
@GetMapping("total")
public AjaxResult<NoticeTotalVo> total() {
IPage<Notice> noticeIPage = noticeService.pageByCurrentUser(new Page<>(1, 1));
return AjaxResult.success(new NoticeTotalVo().setTotal(noticeIPage.getTotal()).setNotice(noticeIPage.getRecords().stream().findFirst().orElse(null)));
}
}

2
mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java

@ -63,7 +63,7 @@ public class PoliceUserController {
@GetMapping("/self")
@ApiOperation(value="管理员信息")
public AjaxResult<PoliceUserSelvesVo> self() {
Integer adminId =AdminThreadLocal.getAdminId();
Integer adminId = AdminThreadLocal.getAdminId();
PoliceUserSelvesVo vo = iPoliceUserService.self(adminId);
return AjaxResult.success(vo);
}

44
mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLogsController.java

@ -1,44 +0,0 @@
package com.biutag.lan.controller.system;
import com.biutag.lan.service.ISystemLogsServer;
import com.biutag.lan.validate.commons.PageValidate;
import com.biutag.lan.validate.system.SystemSearchLoginsValidate;
import com.biutag.lan.validate.system.SystemSearchOperateValidate;
import com.biutag.lan.vo.system.SystemLogLoginVo;
import com.biutag.lan.vo.system.SystemLogOperateVo;
import com.biutag.core.AjaxResult;
import com.biutag.core.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
@RestController
@RequestMapping("api/system/log")
@Api(tags = "系统日志管理")
public class SystemLogsController {
@Resource
ISystemLogsServer iSystemLogsServer;
@GetMapping("/operate")
@ApiOperation(value="系统操作日志")
public AjaxResult<PageResult<SystemLogOperateVo>> operate(@Validated PageValidate pageValidate,
@Validated SystemSearchOperateValidate searchValidate) {
PageResult<SystemLogOperateVo> list = iSystemLogsServer.operate(pageValidate, searchValidate);
return AjaxResult.success(list);
}
@GetMapping("/login")
@ApiOperation(value="系统登录日志")
public AjaxResult<PageResult<SystemLogLoginVo>> login(@Validated PageValidate pageValidate,
@Validated SystemSearchLoginsValidate searchValidate) {
PageResult<SystemLogLoginVo> list = iSystemLogsServer.login(pageValidate, searchValidate);
return AjaxResult.success(list);
}
}

37
mailbox-lan/src/main/java/com/biutag/lan/crontab/LogJob.java

@ -1,37 +0,0 @@
package com.biutag.lan.crontab;
import com.biutag.mapper.system.SystemLogLoginMapper;
import com.biutag.mapper.system.SystemLogOperateMapper;
import com.tongweb.commons.utils.DateUtils;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
/**
* 具体的定时任务
*/
@Component("logJob")
public class LogJob {
@Resource
SystemLogOperateMapper logOperateMapper;
@Resource
SystemLogLoginMapper logLoginMapper;
/*
month 保留最近月份
*/
public void deleteLog(Integer month) {
System.out.println("保留最近月份 : " + month);
LocalDate currentDate = LocalDate.now();
LocalDate monthsAgo = currentDate.minusMonths(month);
logOperateMapper.deleteLogOperateByMonths(monthsAgo.toString());
logLoginMapper.deleteLogLoginByMonths(monthsAgo.toString());
}
}

5
mailbox-lan/src/main/java/com/biutag/lan/domain/Notice.java

@ -23,6 +23,9 @@ public class Notice {
*
*/
private Integer roleId;
private Integer deptId;
/**
* 标题
*/
@ -52,4 +55,6 @@ public class Notice {
*/
private LocalDateTime createTime;
private Integer workId;
}

5
mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java

@ -353,6 +353,11 @@ public class MailVo {
*/
private String invalidationReason;
/**
* 满意读(群众)
*/
private String satisfaction;
/**
* 部门会签
*/

17
mailbox-lan/src/main/java/com/biutag/lan/domain/vo/NoticeTotalVo.java

@ -0,0 +1,17 @@
package com.biutag.lan.domain.vo;
import com.biutag.lan.domain.Notice;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@Setter
@Getter
public class NoticeTotalVo {
private long total;
private Notice notice;
}

9
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java

@ -20,6 +20,7 @@ import com.biutag.lan.flow.Flow;
import com.biutag.lan.flow.FlowNameEnum;
import com.biutag.lan.service.IPoliceUserService;
import com.biutag.lan.service.MailService;
import com.biutag.lan.service.SmsService;
import com.biutag.lan.service.WorkService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
@ -37,6 +38,7 @@ public class ThreeVerifyFlow extends Flow {
private final WorkService workService;
private final ThreeSignFlow threeSignFlow;
private final IPoliceUserService policeUserService;
private final SmsService smsService;
@Override
public Flow next(String nextActionKey, String mailId, JSONObject data) {
@ -72,8 +74,8 @@ public class ThreeVerifyFlow extends Flow {
workService.updateById(myWork);
// 给二级机构增加待办
Work work = workService.getOne(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId());
work.setWorkState(Work.State.todo.name()).setWorkType(WorkType.extension_approval.name()).setFlowName(FlowNameEnum.PENDING_APPROVAL.getName()).setUpdateTime(now);
workService.updateById(work);
work.setWorkType(WorkType.extension_approval.name()).setFlowName(FlowNameEnum.PENDING_APPROVAL.getName()).setUpdateTime(now);
workService.updateTodoById(work);
mail.setUpdateTime(now)
.setExtensionDays(extensionDays)
@ -204,6 +206,8 @@ public class ThreeVerifyFlow extends Flow {
applicationCompleted(nextActionKey, mail, data, now);
// 给二级机构专班增加待办
workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.PENDING_APPROVAL.getName());
// 发送通知短信
smsService.sendNotification(mail.getContactPhone());
return null;
}
@ -216,6 +220,7 @@ public class ThreeVerifyFlow extends Flow {
applicationCompleted(nextActionKey, mail, data, now);
// 给三级部门领导增加待办
workService.saveOrUpdate(mail, leaderEmpNo, now, FlowNameEnum.PENDING_APPROVAL.getName());
smsService.sendNotification(mail.getContactPhone());
return null;
}

4
mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java

@ -327,8 +327,8 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
if (!returnFlag) {
// 给市局机构增加待办
Work municipalWork = workService.getByMunicipal(mailId);
municipalWork.setWorkState(Work.State.todo.name()).setWorkType(WorkType.extension_approval.name()).setUpdateTime(now).setFlowName(FlowNameEnum.PENDING_APPROVAL.getName());
return workService.updateById(municipalWork);
municipalWork.setWorkType(WorkType.extension_approval.name()).setUpdateTime(now).setFlowName(FlowNameEnum.PENDING_APPROVAL.getName());
return workService.updateTodoById(municipalWork);
}
} else {
// 市局

54
mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java

@ -1,10 +1,64 @@
package com.biutag.lan.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.constants.AppConstants;
import com.biutag.enums.RoleEnum;
import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.Notice;
import com.biutag.lan.domain.Work;
import com.biutag.lan.mapper.NoticeMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.Objects;
@Slf4j
@RequiredArgsConstructor
@Service
public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {
private final SimpMessagingTemplate messagingTemplate;
@Async
public void save(Integer roleId, Integer deptId, String content, Integer workId) {
Notice notice = new Notice().setRoleId(roleId).setDeptId(deptId).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.NO).setWorkId(workId);
save(notice);
messagingTemplate.convertAndSend(String.format("/topic/role/%s/%s", roleId, deptId), "");
log.info("发送通知:{}", String.format("/topic/role/%s/%s", roleId, deptId));
}
@Async
public void save(String empNo, String content, Integer workId) {
Notice notice = new Notice().setEmpNo(empNo).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.NO).setWorkId(workId);
save(notice);
messagingTemplate.convertAndSend(String.format("/topic/user/%s", empNo), "");
log.info("发送通知:{}", String.format("/topic/user/%s", empNo));
}
public void save(Work work, String content) {
if (Objects.nonNull(work.getSignRoleId())) {
save(work.getSignRoleId(), work.getSignDeptId(), content, work.getId());
} else {
save(work.getPoliceEmpNo(), content, work.getId());
}
}
public IPage<Notice> pageByCurrentUser(IPage<Notice> page) {
LambdaQueryWrapper<Notice> queryWrapper = new LambdaQueryWrapper<Notice>().eq(Notice::getReadFlag, AppConstants.NO);
Integer roleId = AdminThreadLocal.getRoleId();
if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) || roleId.equals(RoleEnum.SECOND_DEPT_CLASSES.getRoleId()) || roleId.equals(RoleEnum.THREE_DEPT_CLASSES.getRoleId())) {
queryWrapper.eq(Notice::getRoleId, roleId).eq(Notice::getDeptId, AdminThreadLocal.getDeptId());
} else {
queryWrapper.eq(Notice::getEmpNo, AdminThreadLocal.getEmpNo());
}
queryWrapper.orderByDesc(Notice::getCreateTime);
return page(page, queryWrapper);
}
}

19
mailbox-lan/src/main/java/com/biutag/lan/service/SmsService.java

@ -0,0 +1,19 @@
package com.biutag.lan.service;
import cn.hutool.core.util.PhoneUtil;
import com.biutag.lan.util.SmsLan;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@Component
public class SmsService {
@Async
public void sendNotification(String phone) {
if (!PhoneUtil.isPhone(phone)) {
return;
}
SmsLan.send(phone, "请您及时登录局长信箱即接即办,并对您写的信件进行满意度评价,谢谢您的支持!");
}
}

46
mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java

@ -64,6 +64,8 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
private final IHolidayService holidayService;
public final NoticeService noticeService;
public boolean saveBatch(List<MailSource> mailSources) {
LocalDateTime now = LocalDateTime.now();
List<Work> list = mailSources.stream().map(mail -> {
@ -74,13 +76,19 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
.setMailId(mail.getId())
// 签收角色ID
.setSignRoleId(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId())
.setSignDeptId(1)
.setMainDeptFlag(true)
.setCreateTime(now)
.setUpdateTime(now)
.setFlowName(FlowNameEnum.PENDING_SIGN.getName());
return work;
}).collect(Collectors.toList());
return saveBatch(list);
boolean b = saveBatch(list);
list.forEach(item -> {
noticeService.save(item.getSignRoleId(), item.getSignDeptId(), String.format("%s 的来信未签收,请尽快签收!", item.getContactName()), item.getId());
});
return b;
}
@Transactional(rollbackFor = Exception.class)
@ -112,7 +120,10 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
.setUpdateTime(time)
.setMainDeptFlag(mainDeptFlag)
.setFlowName(flowName).setFlowKey(flowKey);
return saveOrUpdate(work);
boolean flag = saveOrUpdate(work);
noticeService.save(work.getSignRoleId(), work.getSignDeptId(), String.format("%s 的来信未签收,请尽快签收!", work.getContactName()), work.getId());
return flag;
}
public boolean saveOrUpdate(Mail mail, String empNo, LocalDateTime time, String flowName) {
@ -125,7 +136,9 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
.setCreateTime(time);
}
work.setWorkState(Work.State.todo.name()).setUpdateTime(time).setFlowName(flowName);
return saveOrUpdate(work);
boolean flag = saveOrUpdate(work);
noticeService.save(work.getPoliceEmpNo(), String.format("%s 的来信未处理,请尽快处理!", work.getContactName()), work.getId());
return flag;
}
public boolean saveByCountersign(Mail mail, List<Integer> countersignDeptIds, LocalDateTime time) {
@ -148,6 +161,7 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
.setFlowName(FlowNameEnum.PENDING_COUNTERSIGN.getName())
.setWorkState(Work.State.todo.name());
saveOrUpdate(work);
noticeService.save(work.getSignRoleId(), work.getSignDeptId(), String.format("%s 的来信待会签,请尽快提交会签意见!", work.getContactName()), work.getId());
});
return true;
}
@ -165,26 +179,38 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
return updateById(work);
}
public boolean updateTodo(String mailId, String empNo, String flowName) {
Work work = getOne(mailId, empNo);
work.setUpdateTime(LocalDateTime.now()).setWorkState(Work.State.todo.name()).setFlowName(flowName);
return updateById(work);
}
public boolean updateTodo(String mailId, Integer roleId, Integer deptId, String flowName) {
Work work = getOne(mailId, roleId, deptId);
work.setUpdateTime(LocalDateTime.now()).setWorkState(Work.State.todo.name()).setFlowName(flowName);
noticeService.save(work.getSignRoleId(), work.getSignDeptId(), String.format("%s 的来信未处理,请尽快处理!", work.getContactName()), work.getId());
return updateById(work);
}
public boolean updateByMunicipal(String mailId, String workState, String flowName) {
Work work = getByMunicipal(mailId);
work.setUpdateTime(LocalDateTime.now())
work.setUpdateTime(LocalDateTime.now()).setSignDeptId(1)
.setWorkState(workState)
.setFlowName(flowName);
boolean flag = updateById(work);
if (work.getWorkState().equals(Work.State.todo.name())) {
noticeService.save(work, String.format("%s 的来信未处理,请尽快处理!", work.getContactName()));
}
return flag;
}
public boolean updateTodoById(Work work) {
work.setWorkState(Work.State.todo.name());
noticeService.save(work, String.format("%s 的来信未处理,请尽快处理!", work.getContactName()));
return updateById(work);
}
public boolean saveTodo(Work work) {
work.setWorkState(Work.State.todo.name());
boolean save = save(work);
noticeService.save(work, String.format("%s 的来信未处理,请尽快处理!", work.getContactName()));
return save;
}
public Page<WorkVo> page(String workState, Page<Work> page, MailQuery todoQuery) {
QueryWrapper<Work> queryWrapper = new QueryWrapper<Work>()
.eq("w.work_state", workState)

34
mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java

@ -17,6 +17,7 @@ import com.biutag.lan.service.IDeptService;
import com.biutag.lan.service.IPermService;
import com.biutag.lan.service.IPoliceUserService;
import com.biutag.lan.service.IPostService;
import com.biutag.lan.util.LoginUserHelper;
import com.biutag.lan.validate.commons.PageValidate;
import com.biutag.lan.validate.system.PoliceUserCreateValidate;
import com.biutag.lan.validate.system.PoliceUserSearchValidate;
@ -150,37 +151,11 @@ public class PoliceUserServiceImpl implements IPoliceUserService {
*/
@Override
public PoliceUserSelvesVo self(Integer adminId) {
// 管理员信息
PoliceUser sysAdmin = policeUserMapper.selectOne(new QueryWrapper<PoliceUser>()
.select(PoliceUser.class, info->
!info.getColumn().equals("salt") &&
!info.getColumn().equals("password") &&
!info.getColumn().equals("is_delete") &&
!info.getColumn().equals("delete_time"))
.eq("is_delete", 0)
.eq("id", adminId)
.last("limit 1"));
PoliceUserInformVo informVo = new PoliceUserInformVo();
BeanUtils.copyProperties(sysAdmin, informVo);
informVo.setAvatar(UrlUtils.toAbsoluteUrl(sysAdmin.getAvatar()));
informVo.setUpdateTime(TimeUtils.timestampToDate(sysAdmin.getUpdateTime()));
informVo.setCreateTime(TimeUtils.timestampToDate(sysAdmin.getCreateTime()));
informVo.setLastLoginTime(TimeUtils.timestampToDate(sysAdmin.getLastLoginTime()));
informVo.setRoleName(AdminThreadLocal.getRoleName());
Integer roleId = AdminThreadLocal.getRoleId();
if (RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId)) {
informVo.setFullName(String.format("市局专班 %s", informVo.getName()));
} else if(RoleEnum.SECOND_DEPT_CLASSES.getRoleId().equals(roleId) ||
RoleEnum.THREE_DEPT_CLASSES.getRoleId().equals(roleId)) {
informVo.setFullName(String.format("%s专班 %s", informVo.getDeptName(), informVo.getName()));
} else {
informVo.setFullName(String.format("%s %s", informVo.getDeptName(), informVo.getName()));
}
LoginUser user = LoginUserHelper.getCurrentUser();
// 角色权限
List<String> auths = new LinkedList<>();
if (adminId > 1) {
List<Integer> roleIds = Collections.singletonList(Integer.parseInt(sysAdmin.getRoleIds()));
List<Integer> roleIds = Collections.singletonList(user.getRoleId());
List<Integer> menuIds = iPermService.selectMenuIdsByRoleId(roleIds);
if (!menuIds.isEmpty()) {
List<Menu> Menus = menuMapper.selectList(new QueryWrapper<Menu>()
@ -204,10 +179,9 @@ public class PoliceUserServiceImpl implements IPoliceUserService {
// 所有权限
auths.add("*");
}
// 返回数据
PoliceUserSelvesVo vo = new PoliceUserSelvesVo();
vo.setUser(informVo);
vo.setUser(user);
vo.setPermissions(auths);
return vo;
}

43
mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLoginServiceImpl.java

@ -1,13 +1,17 @@
package com.biutag.lan.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.biutag.exception.AuthException;
import com.biutag.lan.cache.CaptchaCache;
import com.biutag.lan.cache.UserCatch;
import com.biutag.lan.service.IDeptService;
import com.biutag.lan.service.IRoleService;
import com.biutag.lan.service.ISystemLoginService;
import com.biutag.lan.validate.system.PoliceUserLoginsValidate;
import com.biutag.lan.validate.system.ResetPasswordValidate;
import com.biutag.lan.vo.system.SystemCaptchaVo;
import com.biutag.lan.vo.system.SystemLoginVo;
import com.biutag.lan.vo.system.*;
import com.biutag.entity.system.PoliceUser;
import com.biutag.entity.system.SystemLogLogin;
import com.biutag.enums.ErrorEnum;
@ -18,9 +22,11 @@ import com.biutag.mapper.system.SystemLogLoginMapper;
import com.biutag.util.*;
import com.google.code.kaptcha.Producer;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import nl.bitwalker.useragentutils.UserAgent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.FastByteArrayOutputStream;
@ -34,18 +40,19 @@ import java.util.*;
/**
* 系统登录服务实现类
*/
@RequiredArgsConstructor
@Service
public class SystemLoginServiceImpl implements ISystemLoginService {
@Resource
Producer captchaProducer;
private final Producer captchaProducer;
@Resource
SystemLogLoginMapper systemLogLoginMapper;
private final SystemLogLoginMapper systemLogLoginMapper;
@Resource
PoliceUserMapper policeUserMapper;
private final PoliceUserMapper policeUserMapper;
private final IDeptService deptService;
private final IRoleService roleService;
private static final Logger log = LoggerFactory.getLogger(SystemLoginServiceImpl.class);
/**
@ -94,18 +101,15 @@ public class SystemLoginServiceImpl implements ISystemLoginService {
public SystemLoginVo login(PoliceUserLoginsValidate loginsValidate) {
String empNo = loginsValidate.getEmpNo();
String password = loginsValidate.getPassword();
String captchaStatus = YmlUtils.get("like.captcha.status");
if (StringUtils.isNotNull(captchaStatus) && captchaStatus.equals("true")) {
Assert.notNull(loginsValidate.getCode(), "code参数缺失");
Assert.notNull(loginsValidate.getUuid(), "uuid参数缺失");
String code =CaptchaCache.get(loginsValidate.getUuid());
if (!loginsValidate.getCode().equals(code)) {
throw new LoginException(ErrorEnum.CAPTCHA_ERROR.getCode(), ErrorEnum.CAPTCHA_ERROR.getMsg());
}
}
PoliceUser sysAdmin = policeUserMapper.selectOne(new QueryWrapper<PoliceUser>()
.eq("emp_no", empNo)
.last("limit 1"));
@ -126,24 +130,27 @@ public class SystemLoginServiceImpl implements ISystemLoginService {
this.recordLoginLog(sysAdmin.getId(), loginsValidate.getEmpNo(), ErrorEnum.LOGIN_ACCOUNT_ERROR.getMsg());
throw new LoginException(ErrorEnum.LOGIN_ACCOUNT_ERROR.getCode(), ErrorEnum.LOGIN_ACCOUNT_ERROR.getMsg());
}
try {
// 禁止多处登录
if (sysAdmin.getIsMultipoint().equals(0)) {
StpUtil.logout(sysAdmin.getId());
}
if (StrUtil.isBlank(sysAdmin.getRoleIds())) {
throw new AuthException();
}
// 实现账号登录
StpUtil.login(sysAdmin.getId());
// 更新登录信息
sysAdmin.setLastLoginIp(IpUtils.getIpAddress());
sysAdmin.setLastLoginTime(System.currentTimeMillis() / 1000);
policeUserMapper.updateById(sysAdmin);
// 记录登录日志
this.recordLoginLog(sysAdmin.getId(), loginsValidate.getEmpNo(), "");
DeptVo dept = deptService.detail(Integer.parseInt(sysAdmin.getDeptIds()));
DeptVo dataDept = deptService.detail(sysAdmin.getDataDeptId());
RoleVo role = roleService.detail(Integer.parseInt(sysAdmin.getRoleIds()));
UserCatch.set(sysAdmin.getId(), LoginUser.of(sysAdmin, dept, dataDept, role));
// 响应登录信息
SystemLoginVo vo = new SystemLoginVo();
vo.setId(sysAdmin.getId());
@ -165,7 +172,8 @@ public class SystemLoginServiceImpl implements ISystemLoginService {
*/
@Override
public void logout(String token) {
//RedisUtil.del(AdminConfig.backstageTokenKey + token);
UserCatch.remove(Integer.parseInt(StpUtil.getLoginId().toString()));
StpUtil.logout();
}
@Override
@ -205,7 +213,8 @@ public class SystemLoginServiceImpl implements ISystemLoginService {
/**
* 记录登录日志
*/
private void recordLoginLog(Integer adminId, String username, String error) {
@Async
public void recordLoginLog(Integer adminId, String username, String error) {
try {
HttpServletRequest request = Objects.requireNonNull(RequestUtils.handler());
final UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));

26
mailbox-lan/src/main/java/com/biutag/lan/util/LoginUserHelper.java

@ -0,0 +1,26 @@
package com.biutag.lan.util;
import cn.dev33.satoken.stp.StpUtil;
import com.biutag.enums.ErrorEnum;
import com.biutag.exception.LoginException;
import com.biutag.lan.cache.UserCatch;
import com.biutag.lan.vo.system.LoginUser;
import java.util.Objects;
public class LoginUserHelper {
public static LoginUser getCurrentUser() {
LoginUser user = UserCatch.get(Integer.parseInt(StpUtil.getLoginId().toString()));
if (Objects.isNull(user)) {
Integer errCode = ErrorEnum.TOKEN_INVALID.getCode();
String errMsg = ErrorEnum.TOKEN_INVALID.getMsg();
throw new LoginException(errCode, errMsg);
}
return user;
}
public static Integer getCurrentUserId() {
return getCurrentUser().getId();
}
}

5
mailbox-lan/src/main/java/com/biutag/lan/util/SmsLan.java

@ -1,5 +1,6 @@
package com.biutag.lan.util;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
@ -26,6 +27,10 @@ public class SmsLan {
private SmsLan() {
}
public static String send(String mobile, String content) {
return send(mobile, content, IdUtil.fastSimpleUUID());
}
/**
* @param mobiles 手机号 多个用","隔开 英文逗号必填
* @param content 短信内容 必填

57
mailbox-lan/src/main/java/com/biutag/lan/vo/system/LoginUser.java

@ -0,0 +1,57 @@
package com.biutag.lan.vo.system;
import com.biutag.entity.system.PoliceUser;
import com.biutag.enums.RoleEnum;
import lombok.Data;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@Data
public class LoginUser {
private Integer id;
private String name;
private String empNo;
private Integer roleId;
private String roleName;
private Integer deptId;
private String deptName;
private Integer dataDeptId;
private String dataDeptName;
private Integer postId;
private String postTitle;
private String fullName;
public static LoginUser of(PoliceUser user, DeptVo dept, DeptVo dataDept, RoleVo role) {
LoginUser loginUser = new LoginUser();
Integer roleId = Integer.parseInt(user.getRoleIds());
if (RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId)) {
loginUser.setFullName(String.format("市局专班 %s", user.getName()));
} else if(RoleEnum.SECOND_DEPT_CLASSES.getRoleId().equals(roleId) ||
RoleEnum.THREE_DEPT_CLASSES.getRoleId().equals(roleId)) {
loginUser.setFullName(String.format("%s专班 %s", dataDept.getFullName(), user.getName()));
} else {
loginUser.setFullName(String.format("%s %s", dataDept.getFullName(), user.getName()));
}
loginUser.setId(user.getId())
.setName(user.getName())
.setEmpNo(user.getEmpNo())
.setRoleId(roleId)
.setRoleName(role.getName())
.setDeptId(Integer.parseInt(user.getDeptIds()))
.setDeptName(dept.getFullName())
.setDataDeptId(user.getDataDeptId())
.setDataDeptName(dataDept.getFullName());
return loginUser;
}
}

59
mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserInformVo.java

@ -1,59 +0,0 @@
package com.biutag.lan.vo.system;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel("管理员信息Vo")
public class PoliceUserInformVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Integer id;
@ApiModelProperty(value = "部门ID")
private Integer deptId;
@ApiModelProperty(value = "岗位ID")
private Integer postId;
@ApiModelProperty(value = "账号")
private String username;
@ApiModelProperty(value = "昵称")
private String nickname;
@ApiModelProperty(value = "头像")
private String avatar;
@ApiModelProperty(value = "多端登录: [0=否, 1=是]")
private Integer isMultipoint;
@ApiModelProperty(value = "是否禁用: [0=否, 1=是]")
private Integer isDisable;
@ApiModelProperty(value = "最后登录IP")
private String lastLoginIp;
@ApiModelProperty(value = "最后登录时间")
private String lastLoginTime;
@ApiModelProperty(value = "创建时间")
private String createTime;
@ApiModelProperty(value = "更新时间")
private String updateTime;
private String roleName;
private String deptName;
private String name;
private String fullName;
}

12
mailbox-lan/src/main/java/com/biutag/lan/ws/WsController.java

@ -2,17 +2,21 @@ package com.biutag.lan.ws;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.core.AjaxResult;
import lombok.RequiredArgsConstructor;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.messaging.simp.annotation.SendToUser;
import org.springframework.stereotype.Controller;
@RequiredArgsConstructor
@Controller
public class WsController {
@MessageMapping("/hello")
@SendTo("/topic/greetings")
public AjaxResult<Void> greeting(JSONObject message) throws Exception {
return AjaxResult.success();
@MessageMapping("/con")
public void con(JSONObject message) {
System.out.println("con");
System.out.println(message.toJSONString());
}
}

29
mailbox-lan/src/main/java/com/biutag/lan/ws/message/WorkMessage.java

@ -0,0 +1,29 @@
package com.biutag.lan.ws.message;
import lombok.Setter;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import java.util.HashMap;
@Setter
public class WorkMessage<T> implements Message<T> {
private T payload;
@Override
public T getPayload() {
return payload;
}
@Override
public MessageHeaders getHeaders() {
return new MessageHeaders(new HashMap<>());
}
public static WorkMessage<String> of(String key) {
WorkMessage<String> workMessage = new WorkMessage<>();
workMessage.setPayload(key);
return workMessage;
}
}

2
mailbox-lan/src/main/resources/application.yml

@ -30,7 +30,7 @@ mybatis-plus:
# Sa-token配置
sa-token:
token-name: admin # token的名称
timeout: 2592000 # token有效期单位s(默认30天,-1代表永不过期)
timeout: 28800 # token有效期单位s(默认30天,-1代表永不过期)
active-timeout: -1 # token临时有效期(指定时间无操作掉线)
is-concurrent: false # 是否允许同一账号并发登录
is-share: false # 多人同登账号共用token

2
mailbox-outer/src/main/java/com/biutag/outer/controller/AuthController.java

@ -86,7 +86,7 @@ public class AuthController {
}
@PostMapping("wx/faceAuth")
public AjaxResult<Boolean> faceAuth(@RequestBody @Valid FaceAuthBo faceAuth) {
public AjaxResult<Boolean> faceAuth(@RequestBody FaceAuthBo faceAuth) {
log.info("人身认证结果:{}", JSON.toJSONString(faceAuth));
return AjaxResult.success(faceAuthService.save(faceAuth));
}

9
mailbox-outer/src/main/java/com/biutag/outer/controller/FileController.java

@ -1,5 +1,6 @@
package com.biutag.outer.controller;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.core.AjaxResult;
import com.biutag.config.Minio;
@ -32,8 +33,12 @@ public class FileController {
@ResponseBody
@PostMapping("upload/base64")
public AjaxResult<JSONObject> upload(@RequestBody JSONObject file) {
log.info("文件上传 base64: {}", file.toJSONString());
String filepath = minio.upload(file.getString("base64"));
String base64 = file.getString("base64");
log.info("文件上传 base64: {}", StrUtil.isNotBlank(base64) ? base64.substring(0, Math.min(20, base64.length())) : "");
if (base64.startsWith("data:image")) {
base64 = base64.substring(base64.indexOf(",") + 1);
}
String filepath = minio.upload(base64);
return AjaxResult.success(JSONObject.of("filepath", filepath));
}

6
mailbox-outer/src/main/java/com/biutag/outer/controller/SmsController.java

@ -26,13 +26,11 @@ public class SmsController {
@PostMapping("send")
public AjaxResult<JSONObject> sendCode(@RequestParam String phone) {
String code = String.valueOf(1000 + random.nextInt(9000));
if (active.equals("prod")) {
SmsSend.sendSms(phone,code);
SmsSend.sendCode(phone,code);
} else {
Sms.send(phone, code);
}
// 设置缓存
return AjaxResult.success(JSONObject.of("requestId", CodeUtil.set(code)));
}

2
mailbox-outer/src/main/java/com/biutag/outer/domain/bo/MailBo.java

@ -97,7 +97,7 @@ public class MailBo {
@Getter
public static class Attachment {
private String filepath;
private String filetype;
private String type;
private String originFilename;
}

3
mailbox-outer/src/main/java/com/biutag/outer/job/Job.java

@ -68,6 +68,7 @@ public class Job {
.body(JSON.toJSONString(mail))
.execute();
if (!httpResponse.isOk()) {
log.error("推送信件内容异常,body: {}", httpResponse.body());
throw new RuntimeException(String.format("httpCode: %s", httpResponse.getStatus()));
}
log.info("推送信件内容返回结果:{}", httpResponse.body());
@ -121,7 +122,7 @@ public class Job {
/**
* 每年12月1日 零点执行
*/
//@Scheduled(cron = "0 0 0 1 12 ? 2024-2099")
@Scheduled(cron = "0 0 0 1 12 *")
public void pushHoliday() {
log.info("开始推送节假日数---------------------------------------");
int year = LocalDateTime.now().getYear() + 1;

4
mailbox-outer/src/main/java/com/biutag/outer/mapper/MailMapper.java

@ -13,10 +13,10 @@ public interface MailMapper extends BaseMapper<Mail> {
@Select("SELECT nextval('mail_id_seq') ")
Integer getMailIdSeqVal();
@Select("select m.* from mail m left join mail_etl etl on m.id = etl.mail_id and etl.success = 1 where etl.id is null")
@Select("select m.* from mail m left join mail_etl etl on m.id = etl.mail_id where etl.id is null")
List<Mail> listByMailEtl();
@Select("select m.* from mail m left join mail_evaluate_etl etl on m.id = etl.mail_id and etl.success = 1 where m.satisfaction is not null and etl.id is null")
@Select("select m.* from mail m left join mail_evaluate_etl etl on m.id = etl.mail_id and etl.success = 1 where m.satisfaction is not null and m.satisfaction != '' and etl.id is null")
List<Mail> listByMailEvaluateEtl();
}

11
mailbox-outer/src/main/java/com/biutag/outer/util/SmsSend.java

@ -1,24 +1,21 @@
package com.biutag.outer.util;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.outer.domain.vo.mt.JsonSmsSend;
import com.biutag.outer.domain.vo.mt.Mobile;
import com.biutag.outer.util.sms.PostSms;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Slf4j
public class SmsSend {
public static void sendCode(String phone, String code) {
sendSms(phone, String.format("您的验证码为:%s,请勿泄露于他人!", code));
}
/**
* 发送单个短信短信
*

2
mailbox-outer/src/main/java/com/biutag/outer/util/Weixin2.java

@ -40,7 +40,7 @@ public class Weixin2 {
public static JSONObject getAccessToken() {
// http://172.24.138.108:6060/cgi-bin/token
String url = String.format("http://172.24.138.108:6060/cgi-bin/stable_token?grant_type=client_credential&appid=%s&secret=%s",
String url = String.format("http://172.24.138.108:6060/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s",
APP_ID,
SECRET);
HttpResponse httpResponse = HttpUtil.createGet(url)

9
sql/0306.sql

@ -0,0 +1,9 @@
ALTER TABLE "mailbox"."mail"
ADD COLUMN "extension_request_id" varchar(20);
COMMENT ON COLUMN "mailbox"."mail"."extension_request_id" IS '申请延期ID';
ALTER TABLE "mailbox"."mail_extension_approval"
ADD COLUMN "request_id" varchar(20);
COMMENT ON COLUMN "mailbox"."mail_extension_approval"."request_id" IS '申请延期ID';

17
sql/0307.sql

@ -1,9 +1,14 @@
ALTER TABLE "mailbox"."mail"
ADD COLUMN "extension_request_id" varchar(20);
ALTER TABLE "mailbox"."police_user"
ADD COLUMN "data_dept_id" int;
COMMENT ON COLUMN "mailbox"."mail"."extension_request_id" IS '申请延期ID';
COMMENT ON COLUMN "mailbox"."police_user"."data_dept_id" IS '数据部门ID';
ALTER TABLE "mailbox"."mail_extension_approval"
ADD COLUMN "request_id" varchar(20);
update police_user set data_dept_id = dept_ids where data_dept_id is null;
COMMENT ON COLUMN "mailbox"."mail_extension_approval"."request_id" IS '申请延期ID';
ALTER TABLE "mailbox"."notice"
ADD COLUMN "dept_id" int4;
COMMENT ON COLUMN "mailbox"."notice"."dept_id" IS '部门ID';
ALTER TABLE "mailbox"."notice"
ADD COLUMN "work_id" int8;
Loading…
Cancel
Save