修改群内bug
This commit is contained in:
+22
-9
@@ -13,7 +13,6 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.aspect.annotation.PermissionData;
|
||||
@@ -28,8 +27,10 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -73,11 +74,31 @@ public class WatchMqttNoticeController extends JeecgController<WatchMqttNotice,
|
||||
Page<WatchMqttNotice> page = new Page<WatchMqttNotice>(pageNo, pageSize);
|
||||
IPage<WatchMqttNotice> pageList = watchMqttNoticeService.page(page, queryWrapper);
|
||||
if(CollectionUtil.isNotEmpty(pageList.getRecords())){
|
||||
String allUserIds = pageList.getRecords().stream()
|
||||
.map(WatchMqttNotice::getUserId).distinct()
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
List<String> userIdList = Arrays.stream(allUserIds.split(","))
|
||||
.map(id -> id.replace("\"", "").trim()).distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<LoginUser> loginUsers = sysBaseAPI.listUserByIdsNew(userIdList);
|
||||
Map<String, String> userMap = loginUsers.stream().collect(Collectors.toMap(LoginUser::getId, LoginUser::getRealname));
|
||||
|
||||
for(WatchMqttNotice mn:pageList.getRecords()){
|
||||
LoginUser loginUser = sysBaseAPI.getUserById(mn.getCreateBy());
|
||||
if(loginUser!=null){
|
||||
mn.setCreateByName(loginUser.getRealname());
|
||||
}
|
||||
String[] userIds = mn.getUserId().split(",");
|
||||
List<String> nameList = new ArrayList<>();
|
||||
for (String userId : userIds) {
|
||||
String name = userMap.get(userId);
|
||||
if (StrUtil.isNotEmpty(name)) {
|
||||
nameList.add(name);
|
||||
}
|
||||
}
|
||||
mn.setUserName(StrUtil.join(",", nameList));
|
||||
}
|
||||
}
|
||||
return Result.OK(pageList);
|
||||
@@ -91,7 +112,6 @@ public class WatchMqttNoticeController extends JeecgController<WatchMqttNotice,
|
||||
*/
|
||||
@AutoLog(value = "watch_mqtt_notice-添加")
|
||||
@Operation(summary = "watch_mqtt_notice-添加", description = "watch_mqtt_notice-添加")
|
||||
@RequiresPermissions("watch:watch_mqtt_notice:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody WatchMqttNotice watchMqttNotice) {
|
||||
//createBy保存为当前登录用户id
|
||||
@@ -108,7 +128,6 @@ public class WatchMqttNoticeController extends JeecgController<WatchMqttNotice,
|
||||
* @return result
|
||||
*/
|
||||
@PostMapping(value = "/addMatchMsg")
|
||||
@RequiresPermissions("watch:watch_mqtt_notice:add")
|
||||
public Result<String> addMatchMsg(@RequestBody WatchMqttNotice watchMqttNotice) {
|
||||
try {
|
||||
watchMqttNotice.setNoticeStatus(WatchConstants.MSG_SEND_NO_0);
|
||||
@@ -146,7 +165,6 @@ public class WatchMqttNoticeController extends JeecgController<WatchMqttNotice,
|
||||
* @return result
|
||||
*/
|
||||
@PostMapping(value = "/sendMatchMsgAgain")
|
||||
@RequiresPermissions("watch:watch_mqtt_notice:send")
|
||||
public Result<Object> sendMatchMsgAgain(@RequestBody WatchMqttNotice notice) {
|
||||
if (StrUtil.isBlank(notice.getId())) {
|
||||
return Result.error("参数缺失");
|
||||
@@ -167,7 +185,6 @@ public class WatchMqttNoticeController extends JeecgController<WatchMqttNotice,
|
||||
*/
|
||||
@AutoLog(value = "watch_mqtt_notice-编辑")
|
||||
@Operation(summary = "watch_mqtt_notice-编辑", description = "watch_mqtt_notice-编辑")
|
||||
@RequiresPermissions("watch:watch_mqtt_notice:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody WatchMqttNotice watchMqttNotice) {
|
||||
watchMqttNoticeService.updateById(watchMqttNotice);
|
||||
@@ -182,7 +199,6 @@ public class WatchMqttNoticeController extends JeecgController<WatchMqttNotice,
|
||||
*/
|
||||
@AutoLog(value = "watch_mqtt_notice-通过id删除")
|
||||
@Operation(summary = "watch_mqtt_notice-通过id删除", description = "watch_mqtt_notice-通过id删除")
|
||||
@RequiresPermissions("watch:watch_mqtt_notice:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
watchMqttNoticeService.removeById(id);
|
||||
@@ -197,7 +213,6 @@ public class WatchMqttNoticeController extends JeecgController<WatchMqttNotice,
|
||||
*/
|
||||
@AutoLog(value = "watch_mqtt_notice-批量删除")
|
||||
@Operation(summary = "watch_mqtt_notice-批量删除", description = "watch_mqtt_notice-批量删除")
|
||||
@RequiresPermissions("watch:watch_mqtt_notice:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.watchMqttNoticeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
@@ -243,7 +258,6 @@ public class WatchMqttNoticeController extends JeecgController<WatchMqttNotice,
|
||||
* @param request
|
||||
* @param watchMqttNotice
|
||||
*/
|
||||
@RequiresPermissions("watch:watch_mqtt_notice:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, WatchMqttNotice watchMqttNotice) {
|
||||
return super.exportXls(request, watchMqttNotice, WatchMqttNotice.class, "watch_mqtt_notice");
|
||||
@@ -256,7 +270,6 @@ public class WatchMqttNoticeController extends JeecgController<WatchMqttNotice,
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("watch:watch_mqtt_notice:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, WatchMqttNotice.class);
|
||||
|
||||
Reference in New Issue
Block a user