EKP接口开发Webservice服务和Restservice服务以及定时任务Demo

news2025/1/24 22:38:35
  • 继承com.landray.kmss.sys.webservice2.interfaces.ISysWebservice,同时在接口上使用@WebService注解将其标识为WebService接口
package com.landray.kmss.third.notify.webservice;

import com.alibaba.fastjson.JSONObject;
import com.landray.kmss.sys.webservice2.interfaces.ISysWebservice;

import javax.jws.WebService;

/**
 * 外部系统消息通知服务接口
 */
@WebService
public interface IThirdNotifyWebService extends ISysWebservice {

    /*外部系统消息通知服务接口*/
    JSONObject sendToNotifyInfo(JSONObject jsonObject) throws Exception;
}

  • 编写服务实现类
package com.landray.kmss.third.notify.webservice.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.landray.kmss.common.service.IBaseService;
import com.landray.kmss.constant.SysNotifyConstant;
import com.landray.kmss.hr.staff.model.HrStaffPersonInfo;
import com.landray.kmss.hr.staff.service.IHrStaffPersonInfoService;
import com.landray.kmss.sys.metadata.interfaces.ExtendDataServiceImp;
import com.landray.kmss.sys.notify.constant.SysNotifyConstants;
import com.landray.kmss.sys.notify.interfaces.ISysNotifyMainCoreService;
import com.landray.kmss.sys.notify.interfaces.NotifyContext;
import com.landray.kmss.third.notify.model.ThirdNotifyInfoDetails;
import com.landray.kmss.third.notify.service.IThirdNotifyInfoDetailsService;
import com.landray.kmss.third.notify.webservice.IThirdNotifyWebService;
import com.landray.kmss.web.annotation.RestApi;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static com.landray.kmss.third.notify.webservice.ThirdNotifyConstant.*;
import static com.landray.kmss.util.SpringBeanUtil.getBean;


/**
 * 外部系统消息通知服务接口
 */
@Controller
@RequestMapping(value = "/api/third-notify/thirdNotifyWebService", method = RequestMethod.POST)
@RestApi(docUrl = "/third/notify/webservice/third_notify_service_help.jsp", name = "thirdNotifyWebServiceImp", resourceKey = "third-notify:module.third.notify")
public class ThirdNotifyWebServiceImpl extends ExtendDataServiceImp implements IThirdNotifyWebService {

    /*注入外部系统消息通知信息表信息*/
    private IThirdNotifyInfoDetailsService thirdNotifyInfoDetailsService;

    public IBaseService getServiceImp() {
        if (thirdNotifyInfoDetailsService == null) {
            thirdNotifyInfoDetailsService = (IThirdNotifyInfoDetailsService) getBean("thirdNotifyInfoDetailsService");
        }
        return thirdNotifyInfoDetailsService;
    }

    /*注入消息通知*/
    private ISysNotifyMainCoreService sysNotifyMainCoreService;

    public ISysNotifyMainCoreService getSysNotifyMainCoreServiceImp() {
        if (sysNotifyMainCoreService == null) {
            sysNotifyMainCoreService = (ISysNotifyMainCoreService) getBean("sysNotifyMainCoreService");
        }
        return sysNotifyMainCoreService;
    }

    /*注入人员组织架构*/
    private IHrStaffPersonInfoService hrStaffPersonInfoService;

    public IHrStaffPersonInfoService getHrStaffPersonInfoServiceImp() {
        if (hrStaffPersonInfoService == null) {
            hrStaffPersonInfoService = (IHrStaffPersonInfoService) getBean("hrStaffPersonInfoService");
        }
        return hrStaffPersonInfoService;
    }

    /**
     * @param jsonObject
     * @return com.alibaba.fastjson.JSONObject
     * @description: 外部系统消息通知服务接口
     * @author: 王雄峰
     * @date: 2023/10/16
     */
    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    @ResponseBody
    @RequestMapping(value = "/sendToNotifyInfo", method = RequestMethod.POST)
    public JSONObject sendToNotifyInfo(@RequestBody JSONObject jsonObject) throws Exception {
        //声明最后返回消息变量
        JSONObject resultJson = new JSONObject();
        //声明返回消息的数组类型
        JSONArray resultJsonArr = new JSONArray();
        //数据校验是否有误
        boolean isError = false;
        //格式化日期
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        try {
            //判断JSON参数是否为空
            if (jsonObject != null && !jsonObject.isEmpty() && jsonObject.size() != 0) {
                //判断JSON是否包含规定的key
                if (jsonObject.containsKey("sendToNotifyInfo")) {
                    //获取规定的key值,得到JSON数组
                    JSONArray jsonArray = jsonObject.getJSONArray("sendToNotifyInfo");
                    // 数组不为空,则进行遍历,获取每一项的值
                    if (jsonArray.size() != 0 && !jsonArray.isEmpty()) {
                        //保存数据model
                        ThirdNotifyInfoDetails thirdNotifyInfoDetails = new ThirdNotifyInfoDetails();
                        JSONObject jsonItem;//每一个json数据对象变量
                        String notifySubject;//消息主题
                        String notifyContent;//消息内容
                        String notifySenderNo;//发送给对应人员的编号
                        String notifyPush;//消息推送类型,即时或者是定时
                        String notifyType;//消息推送通知方式,钉钉或者邮件通知等等
                        String notifySendTime;//定时消息通知发送时间
                        for (int i = 0; i < jsonArray.size(); i++) {
                            //重置数据校验标识
                            isError = false;
                            jsonItem = jsonArray.getJSONObject(i);
                            if (jsonItem != null && !jsonItem.isEmpty()) {
                                //消息通知主题
                                notifySubject = jsonItem.get("notifySubject").toString();
                                thirdNotifyInfoDetails.setNotifySubject(notifySubject);
                                //消息通知内容
                                notifyContent = jsonItem.get("notifyContent").toString();
                                thirdNotifyInfoDetails.setNotifyContent(notifyContent);
                                //消息通知发送人编号
                                notifySenderNo = jsonItem.get("notifySenderNo").toString();
                                if ("".equals(notifySenderNo) || notifySenderNo == "") {
                                    JSONObject resultNoJson = new JSONObject();
                                    resultNoJson.put(RETURNSTATE, ERROR);
                                    resultNoJson.put(RETURNMESSAGE, "[notifySenderNo]" + MESSAGENOTIFYSENDERNO);
                                    resultJsonArr.add(resultNoJson);
                                    isError = true;
                                } else {
                                    thirdNotifyInfoDetails.setNotifySenderNo(notifySenderNo);
                                }
                                //消息通知发送人姓名
                                thirdNotifyInfoDetails.setNotifySenderName(jsonItem.get("notifySenderName").toString());
                                //消息通知发送时间
                                notifySendTime = jsonItem.get("notifySendTime").toString();
                                //时间不为空,则校验格式
                                if (!"".equals(notifySendTime) && notifySendTime != "") {
                                    try {
                                        thirdNotifyInfoDetails.setNotifySendTime(dateFormat.parse(notifySendTime));
                                    } catch (Exception e) {
                                        JSONObject resultTimeJson = new JSONObject();
                                        resultTimeJson.put(RETURNSTATE, ERROR);
                                        resultTimeJson.put(RETURNMESSAGE, "编号:[" + notifySenderNo + "]" + MESSAGENOTIFYTIME);
                                        resultJsonArr.add(resultTimeJson);
                                        isError = true;
                                    }
                                } else {
                                    thirdNotifyInfoDetails.setNotifySendTime(null);
                                }
                                //消息通知系统来源(调用系统来源:lims系统、报告系统)
                                thirdNotifyInfoDetails.setNotifySource(jsonItem.get("notifySource").toString());
                                //消息通知推送类型(即时推送-1;定时推送-2;)
                                notifyPush = jsonItem.get("notifyPush").toString();
                                if (NOW.equals(notifyPush) || TIMED.equals(notifyPush)) {
                                    thirdNotifyInfoDetails.setNotifyPush(notifyPush);
                                } else {
                                    JSONObject resultPushJson = new JSONObject();
                                    resultPushJson.put(RETURNSTATE, ERROR);
                                    resultPushJson.put(RETURNMESSAGE, "编号:[" + notifySenderNo + "]" + MESSAGENOTIFYPUSH);
                                    resultJsonArr.add(resultPushJson);
                                    isError = true;
                                }
                                //消息通知推送方式(以哪一种通知类型进行通知:钉钉类型-1;邮件类型-2;)
                                notifyType = jsonItem.get("notifyType").toString();
                                if (DINGTALK.equals(notifyType) || EMAIL.equals(notifyType)) {
                                    thirdNotifyInfoDetails.setNotifyType(notifyType);
                                } else {
                                    JSONObject resultTypeJson = new JSONObject();
                                    resultTypeJson.put(RETURNSTATE, ERROR);
                                    resultTypeJson.put(RETURNMESSAGE, "编号:[" + notifySenderNo + "]" + MESSAGENOTIFYTYPE);
                                    resultJsonArr.add(resultTypeJson);
                                    isError = true;
                                }
                                //消息通知接收人编号
                                thirdNotifyInfoDetails.setNotifyRecipientNo(jsonItem.get("notifyRecipientNo").toString());
                                //消息通知接收人姓名
                                thirdNotifyInfoDetails.setNotifyRecipientName(jsonItem.get("notifyRecipientName").toString());
                                //消息通知创建时间(当前时间)
                                thirdNotifyInfoDetails.setNotifyCreateTime(new Date());
                                //消息通知更新时间(当前时间)
                                thirdNotifyInfoDetails.setNotifyUpdateTime(new Date());
                                //消息通知推送类型(即时推送-1;定时推送-2;)即时推送则调用推送方法,定时则保存数据,等待定时任务进行推送
                                if (NOW.equals(notifyPush) && DINGTALK.equals(notifyType) && !isError) {
                                    try {
                                        //即时发送
                                        JSONObject sendResult = this.sendTodoFromResource(notifySenderNo, notifySubject, notifyContent);
                                        if (SUCCES.equals(sendResult.getString(RETURNSTATE))) {
                                            //消息通知推送标识(未完成-0;已完成-1)
                                            thirdNotifyInfoDetails.setNotifyIsFlag("1");
                                            //发送成功保存数据
                                            getServiceImp().add(thirdNotifyInfoDetails);
                                        } else {
                                            JSONObject getSendState = new JSONObject();
                                            getSendState.put(RETURNSTATE, sendResult.getString(RETURNSTATE));
                                            getSendState.put(RETURNMESSAGE, "编号:[" + notifySenderNo + "]" + sendResult.getString(RETURNMESSAGE));
                                            resultJsonArr.add(getSendState);
                                            isError = true;
                                        }
                                    } catch (Exception e) {
                                        //声明存放异常的JSON变量
                                        JSONObject errorJson = new JSONObject();
                                        errorJson.put(RETURNSTATE, ERROR);
                                        errorJson.put(RETURNMESSAGE, "编号:[" + notifySenderNo + "]" + MESSAGESEND2);
                                        resultJsonArr.add(errorJson);
                                        isError = true;
                                        e.printStackTrace();
                                    }
                                } else if (TIMED.equals(notifyPush) && !isError) {//定时推送
                                    //消息通知推送标识(未完成-0;已完成-1)
                                    thirdNotifyInfoDetails.setNotifyIsFlag("0");
                                    getServiceImp().add(thirdNotifyInfoDetails);
                                }
                            }
                        }
                    } else {
                        //放入返回请求信息
                        resultJson.put(RETURNSTATE, ERROR);
                        resultJson.put(RETURNMESSAGE, MESSAGE4);
                        return resultJson;
                    }
                } else {
                    //放入返回请求信息
                    resultJson.put(RETURNSTATE, ERROR);
                    resultJson.put(RETURNMESSAGE, MESSAGE3);
                    return resultJson;
                }
            } else {
                //放入返回请求信息
                resultJson.put(RETURNSTATE, ERROR);
                resultJson.put(RETURNMESSAGE, MESSAGE2);
                return resultJson;
            }
        } catch (Exception e) {
            //放入返回请求信息
            resultJson.put(RETURNSTATE, ERROR);
            resultJson.put(RETURNMESSAGE, MESSAGE1);
            e.printStackTrace();
            return resultJson;
        }
        if (isError) {
            resultJson.put(RETURNSTATE, ERROR);
            resultJson.put(RETURNMESSAGE, resultJsonArr);
        } else {
            resultJson.put(RETURNSTATE, SUCCES);
            resultJson.put(RETURNMESSAGE, MESSAGESUCCES);
        }
        return resultJson;
    }


    /**
     * @param notifySenderNo
     * @param notifySubject
     * @param notifyContent
     * @return com.alibaba.fastjson.JSONObject
     * @description: 根据传递的人员编号给对应的人员OA和钉钉发送通知
     * @author: 王雄峰
     * @date: 2023/10/16
     */
    public JSONObject sendTodoFromResource(String notifySenderNo, String notifySubject, String notifyContent) {
        //声明返回消息变量
        JSONObject sendResultJson = new JSONObject();
        //默认调用成功
        sendResultJson.put(RETURNSTATE, SUCCES);
        sendResultJson.put(RETURNMESSAGE, MESSAGESEND1);
        try {
            //根据工号查询员工信息
            HrStaffPersonInfo senderInfo = getHrStaffPersonInfoServiceImp().findPersonInfoByStaffNo(notifySenderNo);
            if (senderInfo == null) {
                //查询不到对应编号的员工信息,调用失败
                sendResultJson.put(RETURNSTATE, ERROR);
                sendResultJson.put(RETURNMESSAGE, MESSAGESEND3);
                return sendResultJson;
            }
            //获取上下文
            NotifyContext notifyContext = getSysNotifyMainCoreServiceImp()
                    .getContext(null);
            //获取通知方式
            notifyContext.setNotifyType("todo");
            // 设置发布类型为“待办”(默认为待阅)
            //“待办”消息发送出去后,需要到某事件发生后才变成已办,如审批通过等
            notifyContext.setFlag(SysNotifyConstant.NOTIFY_TODOTYPE_ONCE);
            // 设置发布KEY值,为后面的删除准备
            notifyContext.setKey("thirdNotifyInfo");
            //获取通知人
            List targets = new ArrayList();
            targets.add(senderInfo.getFdOrgPerson());
            //设置发布通知人
            notifyContext.setNotifyTarget(targets);
            notifyContext.setLink("");
            notifyContext.setSubject(notifySubject);
            notifyContext.setContent(notifyContent);
            notifyContext.setParameter1(SysNotifyConstants.SUPPORT_MORETIMES_SEND_TODO);
            getSysNotifyMainCoreServiceImp().sendNotify(senderInfo, notifyContext, null);
        } catch (Exception e) {
            e.printStackTrace();
            sendResultJson.put(RETURNSTATE, ERROR);
            sendResultJson.put(RETURNMESSAGE, MESSAGESEND2);
            return sendResultJson;
        }
        return sendResultJson;
    }
}

  • 添加spring bean配置
<!--外部系统消息通知WebService服务接口-->
<bean id="thirdNotifyWebService" class="com.landray.kmss.third.notify.webservice.impl.ThirdNotifyWebServiceImpl"/>
  • 在功能模块中添加WebService的扩展配置,实现Web服务的扩展点
    <!--外部系统消息通知WebService服务接口-开始-->
    <extension
            point="com.landray.kmss.sys.webservice2">
        <item
                name="registry">
            <param
                    name="serviceName"
                    value="外部系统消息通知"/>
            <param
                    name="serviceClass"
                    value="com.landray.kmss.third.notify.webservice.IThirdNotifyWebService"/>
            <param
                    name="serviceBean"
                    value="thirdNotifyWebService"/>
            <param
                    name="serviceDoc"
                    value="/third/notify/webservice/third_notify_service_help.jsp"/>
        </item>
    </extension>
    <!--外部系统消息通知WebService服务接口-结束-->
  • 导入并发布服务
    在这里插入图片描述
定时任务
  • 添加一个接口
package com.landray.kmss.third.notify.webservice;

import com.landray.kmss.common.service.IBaseService;

/**
 * 外部系统消息通知定时任务服务接口
 */
public interface IThirdNotifyJobWebService extends IBaseService {

    /*外部系统消息通知定时任务服务接口*/
    void sendToNotifyInfoJob() throws Exception;
}

  • 添加一个服务类,实现接口,实现接口中的方法
package com.landray.kmss.third.notify.webservice.impl;

import com.alibaba.fastjson.JSONObject;
import com.landray.kmss.common.service.BaseServiceImp;
import com.landray.kmss.common.service.IBaseService;
import com.landray.kmss.third.notify.model.ThirdNotifyInfoDetails;
import com.landray.kmss.third.notify.service.IThirdNotifyInfoDetailsService;
import com.landray.kmss.third.notify.webservice.IThirdNotifyJobWebService;
import com.landray.kmss.util.SpringBeanUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.Date;
import java.util.List;

import static com.landray.kmss.third.notify.webservice.ThirdNotifyConstant.*;
import static com.landray.kmss.util.SpringBeanUtil.getBean;

/**
 * 外部系统消息通知定时任务服务接口
 */
public class ThirdNotifyJobWebServiceImpl extends BaseServiceImp implements IThirdNotifyJobWebService {

    private static final Log logger = LogFactory.getLog(ThirdNotifyJobWebServiceImpl.class);

    /*注入外部系统消息通知信息表信息*/
    private IThirdNotifyInfoDetailsService thirdNotifyInfoDetailsService;

    public IBaseService getServiceImp() {
        if (thirdNotifyInfoDetailsService == null) {
            thirdNotifyInfoDetailsService = (IThirdNotifyInfoDetailsService) getBean("thirdNotifyInfoDetailsService");
        }
        return thirdNotifyInfoDetailsService;
    }

    private IThirdNotifyInfoDetailsService getThirdNotifyInfoDetailsService() {
        if (thirdNotifyInfoDetailsService == null)
            thirdNotifyInfoDetailsService = (IThirdNotifyInfoDetailsService) SpringBeanUtil
                    .getBean("thirdNotifyInfoDetailsService");
        return thirdNotifyInfoDetailsService;
    }

    /*注入即时发送消息通知的接口*/
    private ThirdNotifyWebServiceImpl thirdNotifyWebService;

    private ThirdNotifyWebServiceImpl getThirdNotifyWebService() {
        if (thirdNotifyWebService == null)
            thirdNotifyWebService = (ThirdNotifyWebServiceImpl) SpringBeanUtil
                    .getBean("thirdNotifyWebService");
        return thirdNotifyWebService;
    }

    /**
     * @param
     * @return void
     * @description: 外部系统消息通知定时任务服务执行方法
     * @author: 王雄峰
     * @date: 2023/10/17
     */
    @Override
    public void sendToNotifyInfoJob() throws Exception {
        try {
            //查询到需要推送的数据
            List<ThirdNotifyInfoDetails> sendDataList = getThirdNotifyInfoDetailsService().getSendJobData();
            //如果有符合条件的数据,那么进行则进行推送
            if (sendDataList.size() != 0) {
                //获取当前时间
                Date nowDate = new Date();
                for (int i = 0; i < sendDataList.size(); i++) {
                    //遍历每一条数据
                    ThirdNotifyInfoDetails infoDetails = sendDataList.get(i);
                    if (infoDetails != null) {
                        //获取当前数据中设置的定时时间与当前之前对比,如果当前时间大于数据中的时间,那么就就行推送
                        Date notifySendTime = infoDetails.getNotifySendTime();
                        //推送时间不为空,并且推送类型为钉钉推送方式
                        if (notifySendTime != null && DINGTALK.equals(infoDetails.getNotifyType())) {
                            //比较时间
                            int dateResult = nowDate.compareTo(notifySendTime);
                            //如果返回的结果小于0,则表示date1在date2之前;(date1<date2)
                            //如果返回的结果大于0,则表示date1在date2之后;(date2<date1)
                            //如果返回的结果等于0,则表示date1和date2相等
                            if (dateResult > 0 || dateResult == 0) {
                                //获取工号信息进行推送
                                String senderNo = infoDetails.getNotifySenderNo();
                                if (!"".equals(senderNo) && senderNo != "") {
                                    try {
                                        JSONObject sendResult = getThirdNotifyWebService().sendTodoFromResource(senderNo, infoDetails.getNotifySubject(), infoDetails.getNotifyContent());
                                        if (SUCCES.equals(sendResult.getString(RETURNSTATE))) {
                                            //更新标识,消息通知推送标识(未完成-0;已完成-1)
                                            infoDetails.setNotifyIsFlag("1");
                                            //更新数据的更新时间为当前时间
                                            infoDetails.setNotifyUpdateTime(nowDate);
                                            //更新数据
                                            getServiceImp().add(infoDetails);
                                        }
                                        String state = "编号:[" + senderNo + "]" + sendResult.getString(RETURNSTATE);
                                        String message = "编号:[" + senderNo + "]" + sendResult.getString(RETURNMESSAGE);
                                        logger.info("ThirdNotifyJobWebServiceImpl:外部系统消息通知定时任务服务接口调用状态:" + state + ";" + message + ";");
                                    } catch (Exception e) {
                                        logger.info("ThirdNotifyJobWebServiceImpl:外部系统消息通知定时任务服务接口调用异常");
                                        e.printStackTrace();
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                logger.info("ThirdNotifyJobWebServiceImpl:暂无需要推送的外部系统消息通知定时任务服务");
            }
        } catch (Exception e) {
            logger.info("ThirdNotifyJobWebServiceImpl:外部系统消息通知定时任务服务接口异常");
            e.printStackTrace();
        }
    }
}

  • 查询方法接口展示
package com.landray.kmss.third.notify.service;

import com.landray.kmss.sys.metadata.interfaces.IExtendDataService;
import com.landray.kmss.third.notify.model.ThirdNotifyInfoDetails;

import java.util.List;

/**
 * 外部系统消息通知信息表 服务接口
 */
public interface IThirdNotifyInfoDetailsService extends IExtendDataService {

    /*查询到需要发送消息通知的定时任务条件数据*/
    List<ThirdNotifyInfoDetails> getSendJobData() throws Exception;
}

  • 查询方法实现类展示
package com.landray.kmss.third.notify.service.spring;

import com.landray.kmss.common.actions.RequestContext;
import com.landray.kmss.common.convertor.ConvertorContext;
import com.landray.kmss.common.dao.HQLInfo;
import com.landray.kmss.common.forms.IExtendForm;
import com.landray.kmss.common.model.IBaseModel;
import com.landray.kmss.sys.metadata.interfaces.ExtendDataServiceImp;
import com.landray.kmss.sys.notify.interfaces.ISysNotifyMainCoreService;
import com.landray.kmss.third.notify.model.ThirdNotifyInfoDetails;
import com.landray.kmss.third.notify.service.IThirdNotifyInfoDetailsService;
import com.landray.kmss.third.notify.util.ThirdNotifyUtil;
import com.landray.kmss.util.SpringBeanUtil;

import java.util.Date;
import java.util.List;

/**
 * 外部系统消息通知信息表 服务实现
 */
public class ThirdNotifyInfoDetailsServiceImp extends ExtendDataServiceImp implements IThirdNotifyInfoDetailsService {

    private ISysNotifyMainCoreService sysNotifyMainCoreService;

    public IBaseModel convertBizFormToModel(IExtendForm form, IBaseModel model, ConvertorContext context) throws Exception {
        model = super.convertBizFormToModel(form, model, context);
        if (model instanceof ThirdNotifyInfoDetails) {
            ThirdNotifyInfoDetails thirdNotifyInfoDetails = (ThirdNotifyInfoDetails) model;
        }
        return model;
    }

    public IBaseModel initBizModelSetting(RequestContext requestContext) throws Exception {
        ThirdNotifyInfoDetails thirdNotifyInfoDetails = new ThirdNotifyInfoDetails();
        thirdNotifyInfoDetails.setNotifyCreateTime(new Date());
        thirdNotifyInfoDetails.setNotifyUpdateTime(new Date());
        ThirdNotifyUtil.initModelFromRequest(thirdNotifyInfoDetails, requestContext);
        return thirdNotifyInfoDetails;
    }

    public void initCoreServiceFormSetting(IExtendForm form, IBaseModel model, RequestContext requestContext) throws Exception {
        ThirdNotifyInfoDetails thirdNotifyInfoDetails = (ThirdNotifyInfoDetails) model;
    }

    public ISysNotifyMainCoreService getSysNotifyMainCoreService() {
        if (sysNotifyMainCoreService == null) {
            sysNotifyMainCoreService = (ISysNotifyMainCoreService) SpringBeanUtil.getBean("sysNotifyMainCoreService");
        }
        return sysNotifyMainCoreService;
    }

    /*查询到需要发送消息通知的定时任务条件数据*/
    @Override
    public List<ThirdNotifyInfoDetails> getSendJobData() throws Exception {
        HQLInfo hqlInfo = new HQLInfo();
        try {
            hqlInfo.setWhereBlock("thirdNotifyInfoDetails.notifyPush = :notifyPush and thirdNotifyInfoDetails.notifyIsFlag = :notifyIsFlag");
            //消息通知推送类型(即时推送-1;定时推送-2;)即时推送则调用推送方法,定时则保存数据,等待定时任务进行推送
            hqlInfo.setParameter("notifyPush", "2");
            //消息通知推送标识(未完成-0;已完成-1)
            hqlInfo.setParameter("notifyIsFlag", "0");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return this.findList(hqlInfo);
    }
}

  • 在spring中进行service的配置
    <!--外部系统消息通知定时任务服务接口-开始-->
    <bean id="thirdNotifyJobWebService"
          class="com.landray.kmss.third.notify.webservice.impl.ThirdNotifyJobWebServiceImpl"/>
    <!--外部系统消息通知定时任务服务接口-结束-->
  • 在design中配置quartz属性
    <!--外部系统消息通知定时任务服务接口-开始-->
    <quartz
            messageKey="third-notify:module.third.notify"
            jobService="thirdNotifyJobWebService"
            cronExpression="0 10 0 ? * *"
            jobMethod="sendToNotifyInfoJob"
            description="third-notify:module.third.notify.description"/>
    <!--外部系统消息通知定时任务服务接口-结束-->
  • 系统配置中导入系统任务
    在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1101701.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

CAD图形导出为XAML实践

文章目录 一、前言二、方法与实践2.1 画出原图&#xff0c;借第三方工具导出至指定格式2.2 CAD导出并转换2.3 两种方法的优劣2.3.1 直接导出代码量大2.3.2 导入导出需要调参 三、总结 一、前言 上位机通常有一个设备/场景界面&#xff0c;该界面用于清晰直观地呈现设备状态。 …

线程通信java

有包子 不做了 唤醒别人等地自己 this.notifyAll(); this.wait() package TheadCpd;public class TheadCpd {//目标&#xff1a;了解线程通信public static void main(String[] args) {//需求&#xff1a;3个人生产或者线程 负责生产包子 每个线程生产1个包子放桌子上// 2…

Pytorch:cat、stack、squeeze、unsqueeze的用法

Pytorch&#xff1a;cat、stack、squeeze、unsqueeze的用法 torch.cat 在指定原有维度上链接传入的张量&#xff0c;所有传入的张量都必须是相同形状 torch.cat(tensors, dim0, *, outNone) → Tensor tensor:相同形状的tensor dim:链接张量的维度&#xff0c;不能超过传入张…

C++对象模型(10)-- 虚函数2

1、虚函数表、虚函数表指针的创建时机 我们知道虚函数表是属于类的&#xff0c;而虚函数表指针是属于对象的。在编译的时候&#xff0c;编译器会往类的构造函数中插入创建虚函数表指针的代码。同样&#xff0c;在编译期间编译器也为每个类确定好了对应的虚函数表的内容。 虚函…

巡检系统是什么?设备巡检系统有什么用?

在现今这个高度自动化的时代&#xff0c;许多企业的设备规模日益扩大&#xff0c;设备巡检工作也变得越来越重要。它不仅是保证企业设备正常运行的重要环节&#xff0c;也是维护生产安全和提升运营效率的关键。那么&#xff0c;如何有效地进行设备巡检呢&#xff1f;答案就是—…

CSS Vue/RN 背景使用opacity,文字在背景上显示

Vue <div class"training_project_tip"> <div class"tip">展示的文字</div> </div> .training_project_tip { font-size: 12px; font-weight: 400; text-align: left; color: #ffffff; margin-top: 8px; position: relative; dis…

6.自定义相机控制器

愿你出走半生,归来仍是少年&#xff01; Cesium For Unity自带的Dynamic Camera,拥有优秀的动态展示效果&#xff0c;但是其对于场景的交互方式用起来不是很舒服。 通过模仿Cesium JS 的交互方式&#xff0c;实现在Unity中的交互&#xff1a; 通过鼠标左键拖拽实现场景平移通过…

模式植物背景基因集制作

一边学习&#xff0c;一边总结&#xff0c;一边分享&#xff01; 写在前面 关于GO背景基因集文件的制作&#xff0c;我们在很早以前也发过。近两天&#xff0c;自己在分析时候&#xff0c;也是被搞了头疼。想重新制作一份GO背景基因集&#xff0c;进行富集分析。但是结果&…

Cpolar+Inis结合在Ubuntu上打造出色的博客网站,快速上线公网访问

文章目录 前言1. Inis博客网站搭建1.1. Inis博客网站下载和安装1.2 Inis博客网站测试1.3 cpolar的安装和注册 2. 本地网页发布2.1 Cpolar临时数据隧道2.2 Cpolar稳定隧道&#xff08;云端设置&#xff09;2.3.Cpolar稳定隧道&#xff08;本地设置&#xff09; 3. 公网访问测试总…

编辑器功能:用一个快捷键来【锁定】或【解开】Inspector面板

一、需求 我有一个脚本&#xff0c;上面暴露了许多参数&#xff0c;我要在场景中拖物体给它进行配置。 如果不锁定Inspector面板的话&#xff0c;每次点击物体后&#xff0c;Inspector的内容就是刚点击的物体的内容&#xff0c;而不是挂载脚本的参数面板。 二、 解决 &…

适老化改造监管平台

文章目录 前言一、首页二、客户管理三、评估管理四、施工管理五、验收管理总结 前言 适老化改造监管平台是指一种为老年人住房进行适老化改造所建立的监管平台。该平台可以辅助政府监管相关企业或个人为老年人住房进行适老化改造的工作&#xff0c;确保改造符合相关标准和规定…

Android--Retrofit2执行多个请求任务并行,任务结束后执行统一输出结果

场景&#xff1a;后端上传文件接口只支持单个文件上传&#xff0c;而业务需求一次性上传多个图片&#xff0c;因此需要多个上传任务并发进行&#xff0c;拿到所有的返回结果后&#xff0c;才能进行下一个流程。 1、使用Java并发工具 private List<Response<JSONObject>…

JVM三色标记

三色标记 什么是三色标记法 三色标记法&#xff0c;也被称为Tri-color Marking Algorithm&#xff0c;是一种用于追踪对象存活状态的垃圾回收算法。它基于William D. Hana和Mark S. McCulleghan在1976年提出的两色标记法的基础上进行了改进。 与两色标记法只能将对象标记为“…

c++ --- 归并排序

2、归并排序 步骤&#xff1a; 选取中间点 mid (LR)/2递归排序 左边left 和 右边 right归并 ---- 将数组合二为一 模板代码 int temp[10]; void merge_sort(int q[], int l, int r) {//如果左右边界相等 直接退出if (l > r) return;//获取数组中心int mid (l r) / 2;/…

如何将模型原点设置到模型的中心

1、为什么要调整坐标原点位置&#xff1f; 从事3D建模相关工作的朋友们在工作中经常会需要调整模型的坐标原点&#xff0c;那么为什么一定要调整模型的坐标原点呢&#xff1f;主要原因如下&#xff1a; 方便后续操作&#xff1a;将原点设置为几何中心可以方便后续对模型进行旋…

香港主机免备案吗?为什么不用备案?

​  对于许多人来说&#xff0c;选择一个合适的主机是建立网站的重要一步。而在选择主机时&#xff0c;备案问题往往成为了一个让人头疼的难题。有幸的是&#xff0c;香港主机免备案&#xff0c;成为了不少网站建设者的首选。 那么&#xff0c;为什么香港主机不需要备案呢?我…

会议OA小程序首页布局

目录 一. Flex布局介绍 1.1 什么是Flex布局 1.2 基本概念 1.3 Flex属性 二. 会议OA首页轮播图的实现 配置 Mock工具 swiper 效果展示 三. 会议OA首页会议信息布局 index.js index.wxml index.wxss 首页整体效果展示 一. Flex布局介绍 布局的传统解决方案&#x…

LeetCode09——回文数

LeetCode09 自己写的解,转化为字符串再反转&#xff0c;比较笨。 import java.util.Scanner; public class Result01 {public static void main(String[] args) {System.out.println("请输入整数&#xff0c;我来帮您判断是否是回文数。");Scanner scanner new Sc…

2024年孝感市建筑类中级职称申报资料私企VS国企

2024年孝感市建筑类中级职称申报资料私企VS国企 民营企业中级职称申报跟事业单位或者是国企申报中级职称流程不一样么&#xff1f;实际上流程基本都是相同的&#xff0c;就是提交纸质版资料有点不一样。 孝感市建筑类中级职称申报基本流程 1.参加建筑类中级职称水平能力测试。 …

playwright: local variable ‘page‘ referenced before assignment

安装好playwright后&#xff0c;运行相关程序出现此错误&#xff0c;按照下述链接中的方法安装相关组件和浏览器驱动后&#xff0c;问题得以解决。 https://www.cnblogs.com/fengyangsheng/p/17531254.html安装playwright pip install -i https://mirrors.aliyun.com/pypi/si…