当前位置: 首页 > news >正文

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

  • 继承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是否包含规定的keyif (jsonObject.containsKey("sendToNotifyInfo")) {//获取规定的key值,得到JSON数组JSONArray jsonArray = jsonObject.getJSONArray("sendToNotifyInfo");// 数组不为空,则进行遍历,获取每一项的值if (jsonArray.size() != 0 && !jsonArray.isEmpty()) {//保存数据modelThirdNotifyInfoDetails 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服务接口-开始--><extensionpoint="com.landray.kmss.sys.webservice2"><itemname="registry"><paramname="serviceName"value="外部系统消息通知"/><paramname="serviceClass"value="com.landray.kmss.third.notify.webservice.IThirdNotifyWebService"/><paramname="serviceBean"value="thirdNotifyWebService"/><paramname="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*/@Overridepublic 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;}/*查询到需要发送消息通知的定时任务条件数据*/@Overridepublic 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属性
    <!--外部系统消息通知定时任务服务接口-开始--><quartzmessageKey="third-notify:module.third.notify"jobService="thirdNotifyJobWebService"cronExpression="0 10 0 ? * *"jobMethod="sendToNotifyInfoJob"description="third-notify:module.third.notify.description"/><!--外部系统消息通知定时任务服务接口-结束-->
  • 系统配置中导入系统任务
    在这里插入图片描述

相关文章:

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

继承com.landray.kmss.sys.webservice2.interfaces.ISysWebservice&#xff0c;同时在接口上使用WebService注解将其标识为WebService接口 package com.landray.kmss.third.notify.webservice;import com.alibaba.fastjson.JSONObject; import com.landray.kmss.sys.webservic…...

如何确定IP地址的具体位置?

IP地址通过几种方法帮助确定具体位置&#xff0c;尽管它们的准确性和精度因不同的情况而异。以下是几种确定具体位置的主要方法&#xff1a; 地理IP数据库&#xff1a;这是最常用的方法之一&#xff0c;它使用IP地址和地理位置数据的映射来确定用户的位置。这些数据库存储了大量…...

软考-网络安全体系与网络安全模型

本文为作者学习文章&#xff0c;按作者习惯写成&#xff0c;如有错误或需要追加内容请留言&#xff08;不喜勿喷&#xff09; 本文为追加文章&#xff0c;后期慢慢追加 by 2023年10月 网络安全体系相关安全模型 BLP机密性模型 BLP&#xff08;Biba-格雷泽-麦克拉伦&#x…...

Java身份证OCR识别 - 阿里云API【识别准确率超过99%】

1. 阿里云API市场 https://market.aliyun.com/products/57124001/cmapi00063618.html?spm5176.28261954.J_7341193060.41.60e52f3drduOTh&scm20140722.S_market%40%40API%E5%B8%82%E5%9C%BA%40%40cmapi00063618._.ID_market%40%40API%E5%B8%82%E5%9C%BA%40%40cmapi0006361…...

vue中获取复选框是否被选中的值、如何用JavaScript判断复选框是否被选中

一、方法介绍 第一种方法&#xff1a;通过获取dom元素&#xff0c;getElementById、querySelector、getElementsByName、querySelectorAll&#xff08;需要遍历&#xff0c;例如&#xff1a;for循环&#xff09; 第二种是用v-model在input复选框上绑定一个变量&#xff0c;通过…...

Python学习之逻辑中的循环有哪些?

1. for循环 for 循环用于迭代 (遍历)一个序列&#xff0c;例如列表、元组、字符串或字典中的元素。 通常使用 for 循环来遍历可迭代对象中的元素&#xff0c;并对每个元素执行相同的操作。 示例: for item in iterable: # 执行操作2.while循环 -while循环用于在满足某个条件…...

【uniapp微信小程序+springBoot(binarywang)

uniapp前端代码 <template><view><page-head :title"title"></page-head><view class"uni-padding-wrap"><view style"background:#FFF; padding:50rpx 0;"><view class"uni-hello-text uni-cente…...

智能井盖的用处有哪些?好用在什么地方?

智能井盖是一种基于物联网技术的井盖系统&#xff0c;通过集成传感器、通信设备和数据处理功能&#xff0c;实现对井盖的实时监测、远程管理和智能化控制。WITBEE万宾的智能井盖传感器EN100-C2&#xff0c;只要在城市需要的井盖上面安装即可使用&#xff0c;一体式结构&#xf…...

微信小程序数据存储方式有哪些

在微信小程序中&#xff0c;数据存储方式有以下几种&#xff1a; 本地存储 本地存储是一种轻量级的数据存储方式&#xff0c;用于存储小量的数据&#xff0c;例如用户的配置信息、页面的状态等。微信小程序提供了 wx.setStorage() 和 wx.getStorage() 方法&#xff0c;用于将数…...

FTC局部路径规划代码分析

前置知识: costmap_2d::Costmap2DROS costmap; costmap_2d::Costmap2DROS 是一个ROS包中提供的用于处理2D成本地图的类。它是一个高级的接口&#xff0c;通常用于与ROS导航栈中的导航规划器和本地路径跟踪器等模块进行集成。 costmap 是一个指向 Costmap2DROS 对象的指针。通…...

SpringBoot集成Activiti7

SpringBoot集成Activiti7 SpringBoot版本使用2.7.16 <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.7.16</version><relativePath/> <!-- lookup…...

25.1 MySQL SELECT语句

1. SQL概述 1.1 SQL背景知识 1946年, 世界上诞生了第一台电脑, 而今借由这台电脑的发展, 互联网已经成为一个独立的世界. 在过去几十年里, 许多技术和产业在互联网的舞台上兴衰交替. 然而, 有一门技术却从未消失, 甚至日益强大, 那就是SQL.SQL(Structured Query Language&…...

【VSCode】Windows环境下,VSCode 搭建 cmake 编译环境(通过配置文件配置)

除了之前的使用 VSCode 插件来编译工程外&#xff0c;我们也可以使用配置文件来编译cmake工程&#xff0c;主要依赖 launch.json 和 tasks.json 文件。 目录 一、下载编译器 1、下载 Windows GCC 2、选择编译器路径 二、配置 debug 环境 1、配置 lauch.json 文件 2、配置…...

useragent识别访问设备

背景需求 ruoyi框架&#xff0c;前后端分离。现在要在用户访问的时候根据不同的设备跳转到不同的登录页面。 教程 router/index.js 修改src/router/index.js&#xff0c;在这里增加自己的要跳转的页面 permission.js 在白名单中添加自己的登录页面 增加以下识别的代码 le…...

紫光同创FPGA实现UDP协议栈网络视频传输,带录像和抓拍功能,基于YT8511和RTL8211,提供2套PDS工程源码和技术支持

目录 1、前言免责声明 2、相关方案推荐我这里已有的以太网方案紫光同创FPGA精简版UDP方案紫光同创FPGA带ping功能UDP方案紫光同创FPGA精简版UDP视频传输方案 3、设计思路框架OV5640摄像头配置及采集数据缓冲FIFOUDP协议栈详解MAC层发送MAC发送模式MAC层接收ARP发送ARP接收ARP缓…...

【机器学习】逻辑回归

文章目录 逻辑回归定义损失函数正则化 sklearn里面的逻辑回归多项式逻辑回归 逻辑回归 逻辑回归&#xff0c;是一种名为“回归”的线性分类器&#xff0c;其本质是由线性回归变化而来的&#xff0c;一种广泛使用于分类问题中的广义回归算法。 线性回归是机器学习中最简单的的…...

DITA-OT 4.0新特性 - PDF themes,定制PDF样式的新方法

随着DITA-OT 4.0的发布&#xff0c;它提供了一种新的定制PDF样式方法&#xff0c;这种方法就是PDF theme。这篇文章来聊一聊这种定制PDF输出的新方法和实验结果。 在进入PDF theme细节之前&#xff0c;为各位读者梳理一下DITA-OT将DITA和Markdown发布成PDF的几种方法。 - 1 …...

MySQL 8.0 OCP认证精讲视频、环境和题库之四 多实例启动 缓存、事务、脏读

一、配置第一个mysqld服务 1、编辑选项文件&#xff0c;指定以下选项&#xff1a; [mysqld] basedir/mysql80 datadir/mysql80/data1 socket/mysql80/data1/mysqld.sock pid-file/mysql80/data1/mysqld.pid log-error/mysql80/dat…...

对代码感兴趣 但不擅长数学怎么办——《机器学习图解》来救你

目前&#xff0c;该领域中将理论与实践相结合、通俗易懂的著作较少。机器学习是人工智能的一部分&#xff0c;很多初学者往往把机器学习和深度学习作为人工智能入门的突破口&#xff0c;非科班出身的人士更是如此。当前&#xff0c;国内纵向复合型人才和横向复合型人才奇缺;具有…...

【EI会议征稿】第三届大数据、信息与计算机网络国际学术会议(BDICN 2024)

第三届大数据、信息与计算机网络国际学术会议&#xff08;BDICN 2024&#xff09; 2024 3rd International Conference on Big Data, Information and Computer Network 第三届大数据、信息与计算机网络国际学术会议&#xff08;BDICN 2024&#xff09;定于2024年1月12-14日在…...

Docker 运行 Kafka 带 SASL 认证教程

Docker 运行 Kafka 带 SASL 认证教程 Docker 运行 Kafka 带 SASL 认证教程一、说明二、环境准备三、编写 Docker Compose 和 jaas文件docker-compose.yml代码说明&#xff1a;server_jaas.conf 四、启动服务五、验证服务六、连接kafka服务七、总结 Docker 运行 Kafka 带 SASL 认…...

UDP(Echoserver)

网络命令 Ping 命令 检测网络是否连通 使用方法: ping -c 次数 网址ping -c 3 www.baidu.comnetstat 命令 netstat 是一个用来查看网络状态的重要工具. 语法&#xff1a;netstat [选项] 功能&#xff1a;查看网络状态 常用选项&#xff1a; n 拒绝显示别名&#…...

跨链模式:多链互操作架构与性能扩展方案

跨链模式&#xff1a;多链互操作架构与性能扩展方案 ——构建下一代区块链互联网的技术基石 一、跨链架构的核心范式演进 1. 分层协议栈&#xff1a;模块化解耦设计 现代跨链系统采用分层协议栈实现灵活扩展&#xff08;H2Cross架构&#xff09;&#xff1a; 适配层&#xf…...

Java线上CPU飙高问题排查全指南

一、引言 在Java应用的线上运行环境中&#xff0c;CPU飙高是一个常见且棘手的性能问题。当系统出现CPU飙高时&#xff0c;通常会导致应用响应缓慢&#xff0c;甚至服务不可用&#xff0c;严重影响用户体验和业务运行。因此&#xff0c;掌握一套科学有效的CPU飙高问题排查方法&…...

2025季度云服务器排行榜

在全球云服务器市场&#xff0c;各厂商的排名和地位并非一成不变&#xff0c;而是由其独特的优势、战略布局和市场适应性共同决定的。以下是根据2025年市场趋势&#xff0c;对主要云服务器厂商在排行榜中占据重要位置的原因和优势进行深度分析&#xff1a; 一、全球“三巨头”…...

Aspose.PDF 限制绕过方案:Java 字节码技术实战分享(仅供学习)

Aspose.PDF 限制绕过方案&#xff1a;Java 字节码技术实战分享&#xff08;仅供学习&#xff09; 一、Aspose.PDF 简介二、说明&#xff08;⚠️仅供学习与研究使用&#xff09;三、技术流程总览四、准备工作1. 下载 Jar 包2. Maven 项目依赖配置 五、字节码修改实现代码&#…...

iOS性能调优实战:借助克魔(KeyMob)与常用工具深度洞察App瓶颈

在日常iOS开发过程中&#xff0c;性能问题往往是最令人头疼的一类Bug。尤其是在App上线前的压测阶段或是处理用户反馈的高发期&#xff0c;开发者往往需要面对卡顿、崩溃、能耗异常、日志混乱等一系列问题。这些问题表面上看似偶发&#xff0c;但背后往往隐藏着系统资源调度不当…...

Qt 事件处理中 return 的深入解析

Qt 事件处理中 return 的深入解析 在 Qt 事件处理中&#xff0c;return 语句的使用是另一个关键概念&#xff0c;它与 event->accept()/event->ignore() 密切相关但作用不同。让我们详细分析一下它们之间的关系和工作原理。 核心区别&#xff1a;不同层级的事件处理 方…...

[特殊字符] 手撸 Redis 互斥锁那些坑

&#x1f4d6; 手撸 Redis 互斥锁那些坑 最近搞业务遇到高并发下同一个 key 的互斥操作&#xff0c;想实现分布式环境下的互斥锁。于是私下顺手手撸了个基于 Redis 的简单互斥锁&#xff0c;也顺便跟 Redisson 的 RLock 机制对比了下&#xff0c;记录一波&#xff0c;别踩我踩过…...

Java多线程实现之Runnable接口深度解析

Java多线程实现之Runnable接口深度解析 一、Runnable接口概述1.1 接口定义1.2 与Thread类的关系1.3 使用Runnable接口的优势 二、Runnable接口的基本实现方式2.1 传统方式实现Runnable接口2.2 使用匿名内部类实现Runnable接口2.3 使用Lambda表达式实现Runnable接口 三、Runnabl…...