ecology_maven/com/api/aiyh_quanshi/service/Impl/DeleteMetingServiceImpl.java

72 lines
3.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.api.aiyh_quanshi.service.Impl;
import aiyh.utils.zwl.common.ToolUtil;
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent;
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter;
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceBefore;
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam;
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaBeforeReplaceParam;
import weaver.aiyh_quanshi.RequestApi;
import weaver.aiyh_quanshi.entity.QsResponse;
import weaver.conn.RecordSet;
import java.util.Map;
/**
* 如不标注名称,则按类的全路径注入
*/
@WeaIocReplaceComponent("deleteMetingService")
public class DeleteMetingServiceImpl {
ToolUtil toolUtil = new ToolUtil();
RequestApi requestApi = new RequestApi();
boolean flag = true;
/**
* 这是接口前置方法,这个方法会在接口执行前执行
* 前值方法必须用@WeaReplaceBefore,这里面有两个参数第一个叫value是你的api地址
* 第二个参数叫order如果你有很多方法拦截的是一个api那么这个就决定了执行顺序
* 前置方法的参数为WeaBeforeReplaceParam 这个类里面有四个参数requestresponse请求参数的mapapi的地址
*/
@WeaReplaceBefore(value = "/api/meeting/monitor/delete", order = 1, description = "会议接口前拦截")
public void before(WeaBeforeReplaceParam weaBeforeReplaceParam) {
// 获取会议id
Map paramMap = weaBeforeReplaceParam.getParamMap();
String ids = String.valueOf(paramMap.get("meetingids"));
// 通过会议id获取全时会议id
String query = "select * from meeting where id in (" + ids + ") and cancel != 1 and meetingstatus not in (2,4)";
RecordSet rs = new RecordSet();
rs.executeQuery(query);
// 获取删除的会议的所有对应的全时id以及创建人
while (rs.next()) {
String quanShiId = rs.getString("quan_shi_id");
String hrmId = rs.getString("contacter");
query = "select * from hrmresource where id = ?";
rs.executeQuery(query, hrmId);
rs.next();
String creatorEmail = rs.getString("email");
QsResponse qsResponse = requestApi.cancelConference(quanShiId, creatorEmail);
// 通过全时会议id对会议进行取消
if (!"0".equals(qsResponse.getStatus())) {
// 取消失败
flag = false;
}
}
}
/**
* 这个是接口后置方法,大概的用法跟前置方法差不多,稍有差别
* 注解名称为WeaReplaceAfter
* 返回类型必须为String
* 参数叫WeaAfterReplaceParam这个类前四个参数跟前置方法的那个相同不同的是多了一个叫data的String这个是那个接口执行完返回的报文
* 你可以对那个报文进行操作然后在这个方法里return回去
*/
@WeaReplaceAfter(value = "/api/meeting/monitor/delete", order = 1)
public String after(WeaAfterReplaceParam weaAfterReplaceParam) {
//这个就是接口执行完的报文
String data = weaAfterReplaceParam.getData();
if (!flag) {
// 取消会议失败
}
return data;
}
}