From 9894da46a0f6f6f15c531aa3506eba9fc6fe5eb9 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期五, 19 十二月 2025 07:36:51 +0800
Subject: [PATCH] 功能优化
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/WarningServiceImpl.java | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 106 insertions(+), 3 deletions(-)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/WarningServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/WarningServiceImpl.java
index 0b6d126..da0bdca 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/WarningServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/WarningServiceImpl.java
@@ -7,6 +7,10 @@
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.dingTalk.DingTalk;
import com.doumee.core.exception.BusinessException;
+import com.doumee.core.haikang.model.HKConstants;
+import com.doumee.core.haikang.model.param.BaseResponse;
+import com.doumee.core.haikang.model.param.request.EventSubRequest;
+import com.doumee.core.haikang.service.HKService;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.WeatherUtil;
@@ -75,6 +79,23 @@
.eq(Warning::getName,warning.getName()) )>0){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝浜嬩欢绫诲瀷宸插瓨鍦紝璇疯繑鍥炲埛鏂伴〉闈㈡煡鐪嬶紒");
}
+
+ if(StringUtils.isNotBlank(warning.getCode())&&Constants.equalsInteger(warning.getType(),Constants.ZERO)||Constants.equalsInteger(warning.getType(),Constants.ONE)){
+ EventSubRequest eventParam = new EventSubRequest();
+ String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode();
+ eventParam.setEventDest(path+"/notice");
+ try {
+ eventParam.setEventTypes(new Integer[]{Integer.valueOf(warning.getCode())});
+ }catch (Exception e){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浜嬩欢缂栫爜閿欒锛�");
+ }
+ HKService.cancelEventSub(eventParam);//鍏堝彇娑�
+ if(Constants.equalsInteger(warning.getStatus(),Constants.ONE)){
+ HKService.eventSub(eventParam);//瀹夐槻浜嬩欢
+ }
+ }
+
+
warning.setStatus(Constants.formatIntegerNum(warning.getStatus()));
warning.setIsdeleted(Constants.ZERO);
warning.setCreator(warning.getLoginUserInfo().getId());
@@ -89,6 +110,23 @@
@Override
public void deleteById(Integer id, LoginUserInfo user) {
+ Warning warning = warningMapper.selectById(id);
+ if(Objects.isNull(warning)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+
+ if(StringUtils.isNotBlank(warning.getCode())&&Constants.equalsInteger(warning.getType(),Constants.ZERO)||Constants.equalsInteger(warning.getType(),Constants.ONE)){
+ EventSubRequest eventParam = new EventSubRequest();
+ String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode();
+ eventParam.setEventDest(path+"/notice");
+ try {
+ eventParam.setEventTypes(new Integer[]{Integer.valueOf(warning.getCode())});
+ }catch (Exception e){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浜嬩欢缂栫爜閿欒锛�");
+ }
+ HKService.cancelEventSub(eventParam);//鍏堝彇娑�
+ }
+
warningMapper.update(null,new UpdateWrapper<Warning>().lambda()
.set(Warning::getIsdeleted,Constants.ONE)
.set(Warning::getEditor,user.getId())
@@ -124,6 +162,22 @@
.eq(Warning::getName,warning.getName()) )>0){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝浜嬩欢绫诲瀷宸插瓨鍦紝璇疯繑鍥炲埛鏂伴〉闈㈡煡鐪嬶紒");
}
+
+ if(StringUtils.isNotBlank(warning.getCode())&&Constants.equalsInteger(warning.getType(),Constants.ZERO)||Constants.equalsInteger(warning.getType(),Constants.ONE)){
+ EventSubRequest eventParam = new EventSubRequest();
+ String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode();
+ eventParam.setEventDest(path+"/notice");
+ try {
+ eventParam.setEventTypes(new Integer[]{Integer.valueOf(warning.getCode())});
+ }catch (Exception e){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浜嬩欢缂栫爜閿欒锛�");
+ }
+ HKService.cancelEventSub(eventParam);//鍏堝彇娑�
+ if(Constants.equalsInteger(warning.getStatus(),Constants.ONE)){
+ HKService.eventSub(eventParam);//瀹夐槻浜嬩欢
+ }
+ }
+
warning.setEditDate(warning.getCreateDate());
warning.setEditor(warning.getCreator());
warningMapper.updateById(warning);
@@ -242,10 +296,62 @@
if(Constants.equalsInteger(model.getStatus(),param.getStatus())){
return;
}
+
+ if(StringUtils.isNotBlank(model.getCode())&&(Constants.equalsInteger(model.getType(),Constants.ZERO)||Constants.equalsInteger(model.getType(),Constants.ONE))){
+ EventSubRequest eventParam = new EventSubRequest();
+ String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode();
+ eventParam.setEventDest(path+"/notice");
+ try {
+ eventParam.setEventTypes(new Integer[]{Integer.valueOf(model.getCode())});
+ }catch (Exception e){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浜嬩欢缂栫爜閿欒锛�");
+ }
+ HKService.cancelEventSub(eventParam);//鍏堝彇娑�
+ if(Constants.equalsInteger(param.getStatus(),Constants.ONE)){
+ BaseResponse response = HKService.eventSub(eventParam);//瀹夐槻浜嬩欢
+ if(Objects.nonNull(response)&&StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
+ model.setSubscribeStatus(Constants.ONE);
+ }else{
+ model.setSubscribeStatus(Constants.TWO);
+ model.setSubscribeInfo(response.getMsg());
+ }
+
+ startCheckThirdDest(eventParam);
+
+ }else{
+ model.setSubscribeStatus(Constants.ZERO);
+ }
+ }
model.setStatus(param.getStatus());
model.setEditDate(new Date());
model.setEditor(param.getLoginUserInfo().getId());
warningMapper.updateById(model);
+ }
+
+ /**
+ * 妫�鏌ヤ笁鏂规槸鍚﹂渶瑕佽闃呮捣搴蜂簨浠�
+ * @param eventParam
+ */
+
+ private void startCheckThirdDest(EventSubRequest eventParam) {
+ try {
+ String thirdpath =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_THIRD_URL).getCode();
+ if(StringUtils.isNotBlank(thirdpath)){
+ String[] ss = thirdpath.split(";");
+ for(String s : ss){
+ eventParam.setEventDest(s);
+ BaseResponse response = HKService.eventSub(eventParam);
+ if(Objects.nonNull(response)&&StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
+ log.error("========璁㈤槄鍏朵粬涓夋柟鍦板潃鎴愬姛:"+s);
+ }else{
+ log.error("========璁㈤槄鍏朵粬涓夋柟鍦板潃閿欒:"+s);
+ }
+ }
+ }
+ }catch (Exception e){
+ log.error("========璁㈤槄鍏朵粬涓夋柟鍦板潃閿欒"+e.getMessage());
+ }
+
}
@@ -346,9 +452,6 @@
}catch (Exception e){
}
-
-
-
}
--
Gitblit v1.9.3