6c
2024-08-01 78a2270a9f47b0143474ff800d6a69f8d72a17dd
预警转发
已修改4个文件
128 ■■■■ 文件已修改
src/main/java/com/product/administration/config/SystemCode.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/controller/EarlyWarningManagerController.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/service/EarlyWarningManagerService.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/service/ide/IEarlyWarningManager.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/config/SystemCode.java
@@ -247,17 +247,17 @@
    TEAM_MANAGER_DELETE_FAIL_HAS_SUB_TEAM("团队删除失败,包含子团队", ModuleEnum.ADMINISTRAT.getValue() + "176"),
    TEAM_MANAGER_DELETE_FAIL_HAS_STAFF_REFERED("团队删除失败,员工已经关联", ModuleEnum.ADMINISTRAT.getValue() + "177"),
    TEAM_SAVE_FAIL_DUPLICATE_NAME("保存失败,团队名称重复", ModuleEnum.ADMINISTRAT.getValue() + "178"),
    COMPANY_NOT_CONFIG_PUNCH_TIME("公司未配置打卡时间", ModuleEnum.ADMINISTRAT.getValue() + "179"),
    LIST_COOPERATES_MODEL_FAIL("协同模板列表获取失败", ModuleEnum.ADMINISTRAT.getValue() + "180"),
    FIND_COOPERATES_MODEL_FAIL("协同模板获取失败", ModuleEnum.ADMINISTRAT.getValue() + "181"),
    ATTENDANCE_LOCATION_SAVE_FAIL("考勤点保存失败", ModuleEnum.ADMINISTRAT.getValue() + "182"),
    ATTENDANCE_LOCATION_LIST_FAIL("考勤点查询失败", ModuleEnum.ADMINISTRAT.getValue() + "183"),
    WARN_NO_NORMAL_STATUS_RECORD("为获取到启用的预警记录", ModuleEnum.ADMINISTRAT.getValue() + "184"),
    COMPANY_PUNCH_TIME_NOT_CONFIG("公司打卡时间未配置", ModuleEnum.ADMINISTRAT.getValue()+"185"),
    KNOWLEDGE_SHARING_LIST_FAIL("获取知识共享列表失败", ModuleEnum.ADMINISTRAT.getValue() + "186"),
@@ -271,13 +271,16 @@
    CONFERENCE_ROOM_SAVE_FIAL_DUPLICATE_NAME("会议室保存失败,已存在同名称会议室", ModuleEnum.ADMINISTRAT.getValue() + "193"),
    WORK_ATTENDANCE_REPORT_FAIL("考勤报表获取失败!", ModuleEnum.ADMINISTRAT.getValue() + "194"),
    ANNOUNCEMENT_FAIL("公告详情", ModuleEnum.ADMINISTRAT.getValue() + "195"),
    ANNOUNCEMENT_ADD("公告新增", ModuleEnum.ADMINISTRAT.getValue() + "196"),
    ANNOUNCEMENT_UPDATE("公告修改", ModuleEnum.ADMINISTRAT.getValue() + "197"),
    ANNOUNCEMENT_DELECT("公告删除", ModuleEnum.ADMINISTRAT.getValue() + "198"),
    ANNOUNCEMENT_REMIND("已读提醒失败", ModuleEnum.ADMINISTRAT.getValue() + "199"),
    ANNOUNCEMENT_REMIND("已读提醒失败", ModuleEnum.ADMINISTRAT.getValue() + "199"),
    WARN_TRANSMIT_USER_IS_NULL("预警转发人员为空", ModuleEnum.ADMINISTRAT.getValue() + "200"),
    WARN_TRANSMIT_USER_REPEAT("预警转发人员重复", ModuleEnum.ADMINISTRAT.getValue() + "201"),
    EXPORT_FILE_FAIL("导出文件失败", ModuleEnum.ADMINISTRAT.getValue() + "998"),
    IMPORT_FILE_FAIL("导入文件失败", ModuleEnum.ADMINISTRAT.getValue() + "999"),
src/main/java/com/product/administration/controller/EarlyWarningManagerController.java
@@ -1,17 +1,7 @@
package com.product.administration.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.product.admin.service.PublicService;
import com.product.admin.service.idel.IPublicService;
import com.product.core.spring.context.SpringMVCContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.product.administration.config.CmnConst;
import com.product.administration.config.SystemCode;
import com.product.administration.service.EarlyWarningManagerService;
@@ -25,7 +15,16 @@
import com.product.core.entity.FieldSetEntity;
import com.product.core.entity.RequestParameterEntity;
import com.product.core.exception.BaseException;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.module.sys.version.ApiVersion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
@@ -589,4 +588,45 @@
            return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage());
        }
    }
    /**
     * 批量修改预警时间
     *
     * @param request
     * @return
     */
    @PostMapping("/transmit/{version}")
    @ApiVersion(1)
    public String transmit(HttpServletRequest request) {
        try {
            //获取参数
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if (bean != null) {
                RequestParameterEntity reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
            }
            //判断参数是否为空
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            if (fse.getTableName() == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
            }
            IEarlyWarningManager service = (IEarlyWarningManager) getProxyInstance(earlyWarningManagerService);
            service.transmit(fse);
            return OK();
        } catch (BaseException e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage());
        }
    }
}
src/main/java/com/product/administration/service/EarlyWarningManagerService.java
@@ -492,4 +492,35 @@
        }
        return dte;
    }
    /**
     * 转发
     * @param fse
     */
    @Override
    public void transmit(FieldSetEntity fse) {
        String uuid = fse.getUUID();
        String messageAccepter = fse.getString("user");
        FieldSetEntity warnMsgFse = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO, uuid, false);
        String preReceiver = warnMsgFse.getString(CmnConst.RECEIVER);
        Set<String> preReceiverSet = Sets.newHashSet(preReceiver.split(","));
        if (StringUtils.isEmpty(messageAccepter)) {
            throw new BaseException(SystemCode.WARN_TRANSMIT_USER_IS_NULL);
        }
        Set<String> transmitUserSet = Sets.newHashSet(messageAccepter.split(","));
        transmitUserSet.forEach(transmitUser -> {
            if (preReceiverSet.contains(transmitUser)) {
                FieldSetEntity transmitUserFse = baseDao.getFieldSetByFilter(CmnConst.PRODUCT_SYS_USERS, "user_id=?", new Object[]{transmitUser}, false);
                throw new BaseException(SystemCode.WARN_TRANSMIT_USER_REPEAT.getValue(), String.format("%s:%s", SystemCode.WARN_TRANSMIT_USER_REPEAT.getText(), transmitUserFse.getString(CmnConst.USER_NAME)));
            }
        });
        warnMsgFse.setValue(CmnConst.RECEIVER, preReceiver + "," + messageAccepter);
        SystemUser curUser = SpringMVCContextHolder.getCurrentUser();
        FieldSetEntity msgFse = baseDao.getFieldSetByFilter(CmnConst.PRODUCT_SYS_MESSAGE, "source_table=? and source_uuid=?", new Object[]{CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO, uuid}, false);
        String title = String.format("%s向您转发了预警消息《%s》", curUser.getUser_name(), msgFse.getString(CmnConst.TITLE));
        String content = msgFse.getString("content");
        WebsocketMesssageServiceThread.getInstance().appendMessage(messageAccepter, content, title, curUser.getUser_id(),
                "31", CmnConst.BUTTON_URL_WARN_MESSAGE_INFO + "?uuid=" + fse.getUUID(),
                CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO, fse.getUUID(), curUser.getUser_id(), 0, 0, null);
    }
}
src/main/java/com/product/administration/service/ide/IEarlyWarningManager.java
@@ -7,30 +7,30 @@
import com.product.core.exception.BaseException;
public interface IEarlyWarningManager {
    /**
     *     预警配置新增
     * @param fse
     * @return
     */
    String addWarning(FieldSetEntity fse) throws BaseException, SchedulerException, TaskException;
    /**
     *     预警配置修改
     * @param fse
     * @return
     * @throws TaskException
     * @throws SchedulerException
     * @throws BaseException
     * @throws TaskException
     * @throws SchedulerException
     * @throws BaseException
     */
    boolean updateWarning(FieldSetEntity fse) throws BaseException, SchedulerException, TaskException;
    /**
     *     预警配置删除
     * @param uuid
     * @return
     * @throws SchedulerException
     * @throws BaseException
     * @throws SchedulerException
     * @throws BaseException
     */
    boolean deleteWarning(String uuid) throws BaseException, SchedulerException;
@@ -42,4 +42,10 @@
     * @throws BaseException
     */
    boolean updateEarlyWarningTime(FieldSetEntity fse)throws BaseException, SchedulerException, TaskException;
    /**
     * 转发
     * @param fse
     */
    void transmit(FieldSetEntity fse);
}