Commit 6408f8b3 by baochunxin

#G:修改通知列表

parent 0582c893
......@@ -69,10 +69,20 @@ public class SchoolNotificationGroupController extends BaseController {
return getDataTable(list);
}
/**
* 根据分组id查询人员信息
* 接收人列表
* @return
*/
@GetMapping("/getGroupNameList")
public AjaxResult getGroupNameList(){
List<SchoolNotificationGroup> list = schoolNotificationGroupService.list();
return AjaxResult.success(list);
}
/**
* 根据分组id查询人员信息
*/
@GetMapping("/getUserList/{notificationId}")
public TableDataInfo selectOne(@PathVariable("notificationId") Long notificationId) {
startPage();
......
......@@ -26,6 +26,11 @@ public class SchoolMessagePush extends OurBaseEntity {
//@Excel(name = "接收人")
private Long receivePacket;
/**
* 接收人分组id
*/
private Long groupId;
/** 消息类型 */
@Excel(name = "消息类型",readConverterExp = "1=通知,2=公告")
private String messageType;
......
......@@ -16,12 +16,14 @@ import yangtz.cs.liu.campus.domain.message.SchoolMessageParentsPushs;
import yangtz.cs.liu.campus.domain.message.SchoolMessageParentsPushsDetails;
import yangtz.cs.liu.campus.domain.message.SchoolMessagePush;
import yangtz.cs.liu.campus.domain.message.SchoolMessagePushDetails;
import yangtz.cs.liu.campus.domain.notificationGroup.SchoolNotificationUser;
import yangtz.cs.liu.campus.mapper.message.SchoolMessageParentsPushsDetailsMapper;
import yangtz.cs.liu.campus.mapper.message.SchoolMessageParentsPushsMapper;
import yangtz.cs.liu.campus.mapper.message.SchoolMessagePushDetailsMapper;
import yangtz.cs.liu.campus.mapper.message.SchoolMessagePushMapper;
import yangtz.cs.liu.campus.mapper.teacher.SchoolTeacherMapper;
import yangtz.cs.liu.campus.service.message.ISchoolMessagePushService;
import yangtz.cs.liu.campus.service.notificationGroup.SchoolNotificationUserService;
import yangtz.cs.liu.campus.vo.message.SchoolMessagePushExportVO;
import yangtz.cs.liu.wechat.vo.message.MessagePushVO;
......@@ -49,7 +51,8 @@ public class SchoolMessagePushServiceImpl extends ServiceImpl<SchoolMessagePushM
private SchoolTeacherMapper teacherMapper;
@Autowired
UserInfoUtil userInfoUtil;
@Autowired
SchoolNotificationUserService schoolNotificationUserService;
private Logger log = LoggerFactory.getLogger(SchoolMessagePushServiceImpl.class);
/**
......@@ -96,7 +99,7 @@ public class SchoolMessagePushServiceImpl extends ServiceImpl<SchoolMessagePushM
//修改前的信息推送
SchoolMessagePush push = schoolMessagePushMapper.selectById(schoolMessagePush.getId());
//接收人(角色)未修改
if (schoolMessagePush.getReceivePacket().equals(push.getReceivePacket())) {
if (schoolMessagePush.getGroupId().equals(push.getGroupId())) {
return schoolMessagePushMapper.updateById(schoolMessagePush);
} else {
//修改信息推送
......@@ -125,18 +128,25 @@ public class SchoolMessagePushServiceImpl extends ServiceImpl<SchoolMessagePushM
//添加信息推送接收用户
public int insertDetails(SchoolMessagePush schoolMessagePush) {
/**
* 根据分组发送
*/
Long groupId = schoolMessagePush.getGroupId();
//获取接收人角色
Long roleId = schoolMessagePush.getReceivePacket();
LambdaQueryWrapper<SchoolNotificationUser> lqw = new LambdaQueryWrapper();
lqw.eq(SchoolNotificationUser::getNotificationId,groupId);
List<SchoolNotificationUser> list = schoolNotificationUserService.list(lqw);
//查询分组下所有人员
//该角色下所有用户
List<Long> userIdList = roleMapper.getRoleAllUserIds(roleId);
if (StringUtils.isNull(userIdList) || userIdList.size() == 0) {
if (StringUtils.isNull(list) || list.size() == 0) {
return 0;
}
List<SchoolMessagePushDetails> detailsList = new ArrayList<>();
for (Long userId : userIdList) {
for (SchoolNotificationUser userId : list) {
SchoolMessagePushDetails details = new SchoolMessagePushDetails();
details.setPushId(schoolMessagePush.getId());
details.setUserId(userId);
details.setUserId(userId.getUserId());
details.setStatus(NORMAL);
details.insert();
detailsList.add(details);
......
package yangtz.cs.liu.wechat.controller.api;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
......@@ -203,7 +204,30 @@ public class Sha1Util {
/*sha1加密*/
public static String sha1(String decript) {
try {
MessageDigest digest = MessageDigest
.getInstance("SHA-1");
digest.update(decript.getBytes());
byte messageDigest[] = digest.digest();
// Create Hex String
StringBuffer hexString = new StringBuffer();
// 字节数组转换为 十六进制 数
for (int i = 0; i < messageDigest.length; i++) {
String shaHex = Integer.toHexString(messageDigest[i] & 0xFF);
if (shaHex.length() < 2) {
hexString.append(0);
}
hexString.append(shaHex);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return "";
}
/**
* @Comment SHA1实现
......
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