Browse Source

# APP消息推送线程池修改

# 设备信息懒加载树接口调整
# 消息推送消息中心列表去除数据权限
zhongwei
haungxing 1 year ago
parent
commit
f61883984d
  1. 10
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  2. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  3. 19
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  4. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  5. 11
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java
  6. 2
      hzims-service/message/src/main/java/com/hnac/hzims/message/config/ThreadPoolConfig.java
  7. 4
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java
  8. 15
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java
  9. 10
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

10
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -79,7 +79,7 @@ public interface IEmInfoClient {
String GET_EM_INFO_TREE_BY_EM_CODE = API_PREFIX + "/getEmInfoTreeByEmCode";
String UPDATE_BY_EM_CODE = API_PREFIX + "/updateByEmCode";
String UPDATE_BATCH_EM_STATE = API_PREFIX + "/updateBachEmState";
String GET_CHILDREN_BY_EM_CODE = API_PREFIX + "/getChildrenByEmCode";
String GET_EM_CREATE_TABLE = API_PREFIX + "/getEmCreateTable";
@PostMapping(DETAIL)
@ -153,4 +153,12 @@ public interface IEmInfoClient {
@PostMapping(GET_EM_CREATE_TABLE)
List<CreateTableVO> getEmCreateTable(@RequestParam("list") List<String> tableNames);
/**
* 获取设备下的子设备编号列表
* @param emCode 设备编号
* @return 子设备编号列表
*/
@GetMapping(GET_CHILDREN_BY_EM_CODE)
R<List<String>> getChildrenByEmCode(@RequestParam("emCode") String emCode);
}

5
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -98,4 +98,9 @@ public class IEmInfoClientBack implements IEmInfoClient {
public List<CreateTableVO> getEmCreateTable(List<String> tableNames) {
return new ArrayList<>();
}
@Override
public R<List<String>> getChildrenByEmCode(String emCode) {
return R.fail("远程调用失败");
}
}

19
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -3,19 +3,20 @@ package com.hnac.hzims.equipment.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.DeviceVO;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.vo.CreateTableVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@ -133,6 +134,16 @@ public class EmInfoClient implements IEmInfoClient {
return service.getEmCreateTable(tableNames);
}
@Override
public R<List<String>> getChildrenByEmCode(@RequestParam String emCode) {
EmInfoEntity emInfo = service.getOne(Wrappers.<EmInfoEntity>lambdaQuery().eq(EmInfoEntity::getNumber, emCode));
if(ObjectUtil.isEmpty(emInfo)) {
return R.data(Lists.newArrayList());
}
LambdaQueryWrapper<EmInfoEntity> wrapper = Wrappers.<EmInfoEntity>lambdaQuery().like(EmInfoEntity::getPath, emInfo.getPath());
return R.data(service.list(wrapper).stream().map(EmInfoEntity::getNumber).distinct().collect(Collectors.toList()));
}
/**
*
* @param emCode

5
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -599,14 +599,15 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
.flatMap(path -> Arrays.stream(path.split("/"))).distinct().collect(Collectors.toList());
emCodes.addAll(childrenEmCode);
}
EmInfoEntity emInfo = this.getOne(Wrappers.<EmInfoEntity>lambdaQuery().eq(EmInfoEntity::getNumber, parentCode));
// 获取parentCode下的子设备集合
LambdaQueryWrapper<EmInfoEntity> queryWrapper = Wrappers.<EmInfoEntity>lambdaQuery()
.eq(EmInfoEntity::getGpid, parentCode)
.eq(EmInfoEntity::getGpid, Optional.ofNullable(emInfo).map(EmInfoEntity::getId).orElse(0L))
.eq(EmInfoEntity::getDepartment,deptId);
List<EmInfoEntity> emInfoList = this.list(queryWrapper);
List<JSONObject> result = emInfoList.stream().map(emInfoEntity -> {
JSONObject object = JSONObject.parseObject(JSON.toJSONString(emInfoEntity));
object.put("disabled", emCodes.contains(emInfoEntity.getNumber()) ? true : false);
object.put("disabled", emCodes.contains(emInfoEntity.getNumber()) ? false : true);
return object;
}).collect(Collectors.toList());
return result;

11
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.google.zxing.BarcodeFormat;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzinfo.inspect.Constants;
import com.hnac.hzinfo.inspect.obj.ObjectConstants;
import com.hnac.hzinfo.inspect.obj.entity.*;
@ -58,6 +59,8 @@ public class ObjectServiceImpl extends BaseServiceImpl<InspectObjectMapper, Obje
private IObjectDangerService objectDangerService;
@Autowired
private ProjectService projectService;
@Autowired
private IEmInfoClient emInfoClient;
/** pdf文件存储路径 */
@Value("${hzinfo.task.pdf.file-path}")
@ -268,15 +271,15 @@ public class ObjectServiceImpl extends BaseServiceImpl<InspectObjectMapper, Obje
templateProjectService.remove(queryWrapper);
// 保存巡检模板与巡检项目的绑定关系
List<String> emCodeList = Func.toStrList(",", object.getEmCodes());
Function<Integer,TemplateProjectEntity> getTemplateProjectByEmCode = index -> {
Function<String,TemplateProjectEntity> getTemplateProjectByEmCode = emCode -> {
ProjectEntity project = new ProjectEntity();
project.setEmCode(emCodeList.get(index));
project.setEmCode(emCode);
project.setStatus(ObjectConstants.ProjectEnableEnum.YES.getEnableType());
ProjectEntity one = projectService.getOne(project);
return TemplateProjectEntity.builder().templateId(template.getId()).projectId(one.getId()).sort(index).build();
return TemplateProjectEntity.builder().templateId(template.getId()).projectId(one.getId()).build();
};
List<TemplateProjectEntity> templateProjectList = Stream.iterate(0,n -> n + 1).limit(emCodeList.size())
.map(getTemplateProjectByEmCode).collect(Collectors.toList());
.flatMap(index -> emInfoClient.getChildrenByEmCode(emCodeList.get(index)).getData().stream()).map(getTemplateProjectByEmCode).collect(Collectors.toList());
templateProjectService.saveBatch(templateProjectList);
}
}

2
hzims-service/message/src/main/java/com/hnac/hzims/message/config/ThreadPoolConfig.java

@ -25,6 +25,6 @@ public class ThreadPoolConfig {
@Bean
public ExecutorService appMessagePushExecutor() {
return new ThreadPoolExecutor(2, 5, 5L, TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>());
return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>());
}
}

4
hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java

@ -51,7 +51,7 @@ public class MessagePushRecordController extends BladeController {
@ApiOperation("查询消息推送记录列表")
@ApiOperationSupport(order = 3)
public R<List<MessagePushRecordEntity>> list(MessagePushRecordEntity request) {
return R.data(messagePushRecordService.list(request));
return R.data(messagePushRecordService.listNoUserScope(request));
}
@GetMapping("/listPage")
@ -62,7 +62,7 @@ public class MessagePushRecordController extends BladeController {
title = "消息管理", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action = "分页查询消息推送记录列表")
public R<IPage<MessagePushRecordEntity>> listPage(MessagePushRecordEntity request, Query query) {
return R.data(messagePushRecordService.listPage(request, query));
return R.data(messagePushRecordService.listPageNoUserScope(request, query));
}
@GetMapping("/send/{id}")

15
hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java

@ -22,6 +22,13 @@ public interface IMessagePushRecordService extends BaseService<MessagePushRecord
List<MessagePushRecordEntity> list(MessagePushRecordEntity request);
/**
* 查询消息推送记录列表 - 无数据权限
* @param request
* @return
*/
List<MessagePushRecordEntity> listNoUserScope(MessagePushRecordEntity request);
/**
* 分页查询消息推送记录列表
* @param request 查询条件
* @param query 分页
@ -29,6 +36,14 @@ public interface IMessagePushRecordService extends BaseService<MessagePushRecord
*/
IPage<MessagePushRecordEntity> listPage(MessagePushRecordEntity request, Query query);
/**
* 分页查询消息推送记录列表 - 无数据权限
* @param request 查询条件
* @param query 分页
* @return 消息记录列表
*/
IPage<MessagePushRecordEntity> listPageNoUserScope(MessagePushRecordEntity request, Query query);
/** @Author hx
* @Description 根据ID发送短信
* @Date 2023/4/4 17:37

10
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

@ -57,10 +57,20 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
}
@Override
public List<MessagePushRecordEntity> listNoUserScope(MessagePushRecordEntity request) {
return noAurhScopeMapper.selectList(this.getQueryWrapper(request));
}
@Override
public IPage<MessagePushRecordEntity> listPage(MessagePushRecordEntity request, Query query) {
return this.page(Condition.getPage(query), this.getQueryWrapper(request));
}
@Override
public IPage<MessagePushRecordEntity> listPageNoUserScope(MessagePushRecordEntity request, Query query) {
return noAurhScopeMapper.selectPage(Condition.getPage(query), this.getQueryWrapper(request));
}
/**
* @return java.lang.Boolean 推送结果
* @Author hx

Loading…
Cancel
Save