Commit 5896c0ef authored by liangyb's avatar liangyb

#20240903 ai查重结构调整,整合到专家评标界面

parent b28a56cc
......@@ -35,57 +35,63 @@ import com.gx.obe.config.utils.PropertiesUtils;
import com.gx.obe.evaluation.step.shell.ShowAiProcessShell;
import com.gx.obe.util.utils.ObjectUtils;
import com.gx.obe.util.utils.RuntimeUtils;
import com.gx.obe.util.utils.StringUtil;
import com.gx.obe.util.utils.StringUtils;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.swtdesigner.ResourceManager;
import com.swtdesigner.SWTResourceManager;
/**
* AI查重
* @author lyb
* @version 2024-09-02 14:45:00
*
*/
public class AiEvalLeftButton extends ImageButton{
private TenderProjectEntity curTender;
// private ShowAiProcessShell menuTipShell;
private MouseListener listener;
private ShowAiProcessShell showAiProcessShell;
private String name;
private File downLoadPath;
public static Color BG = ColorConstants.SKIN_BG;
private static final String title = "标书正在下载中... 请勿离开该页面";
private static final String todo = " 已耗时:";
//过渡弹窗,如果需要的话就放开
// private static final String title = "标书正在下载中... 请勿离开该页面";
// private static final String todo = " 已耗时:";
private static final ReentrantLock lock = new ReentrantLock();
private static volatile Future<Boolean> future = null;
/**
* AI查重
* @param parent 父级控件
* @param style 界面布局
* @param curTender 项目信息
*/
public AiEvalLeftButton(Composite parent, int style,TenderProjectEntity curTender) {
super(parent, SWT.CENTER|SWT.NONE);
this.setTopMargin(3);
this.setBottomMargin(3);
this.setLeftMargin(5);
this.setRightMargin(5);
this.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/evaluaton_step/default.png"));
this.curTender = curTender;
// button.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_HAND));
// button.setSurroundColor(SWTResourceManager.getColor(60, 138, 226));
this.setFont(SWTResourceManager.getFont("微软雅黑", 10, SWT.NORMAL));
this.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
// this.setBorderColor(SWTResourceManager.getColor(SWT.COLOR_WHITE));
this.setActiveBgColor(BG);
this.setActiveBgColor(SWTResourceManager.getColor(255, 153, 0));
// this.setActiveSurroundColor(SWTResourceManager.getColor(255, 153, 0));
this.setActiveForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
// this.setActiveSurroundColor(SWTResourceManager.getColor(SWT.COLOR_WHITE));
this.setSelectionBgColor(ColorConstants.SKIN_SELECTION_BG);
// this.setSelectionBorderColor(SWTResourceManager.getColor(255, 153, 0));
this.setArcWidth(6);
// button.setText(Messages.Button_reduce);
// button.setSurroundMargin(2);
// button.setFillSurround(false);
//渲染图形化界面
render();
init();
}
public AiEvalLeftButton(Composite parent, int style,TenderProjectEntity curTender, String name) {
super(parent, SWT.CENTER|SWT.NONE);
this.curTender = curTender;
this.name = name;
//渲染图形化界面
render();
init();
}
/**
* AI文件下载
*/
public void init(){
addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseEnter(MouseEvent e) {
HttpUrl httpUrl = HttpUtils.getProjectHttpUrl(curTender, PropertiesUtils.getWebserviceProperty(WebserviceConstants.GET_AI_RESULT_METHOD, "bidOpeningHS.do?downloadOpenBidSupplierAiResult"));
......@@ -104,36 +110,23 @@ public class AiEvalLeftButton extends ImageButton{
return;
}
downloadBiddingFile(httpResponse);
// showAiProcessShell = new ShowAiProcessShell(getShell(), EvalLeftButton1.this, 0, "");
// if(null != showAiProcessShell && !showAiProcessShell.isDisposed()){
// showAiProcessShell.open();
//// showAiProcessShell.setVisible(true);
// }
}
//
// @Override
// public void mouseExit(MouseEvent e) {
// if(null != menuTipShell && !menuTipShell.isDisposed()){
// menuTipShell.close();
// }
// super.mouseExit(e);
// }
}
});
}
/**
* 根据AI平台返回结果选择是否进行下载文件与展示等待时间
* @param httpResponse 请求响应结果集
*/
private void downloadBiddingFile(HttpResponse httpResponse){
String downUrl = "";
if(null == httpResponse.getContent() || "".equals(httpResponse.getContent())){
// LOG.debug("服务器返回数据为空!");
// callBackMsg(false, "服务器返回数据为空!");
// callBackMsg(false, "未获取到下载地址!");
return ;
}
String packageAiType = httpResponse.getDataParam("packageAiType");
downUrl = httpResponse.getDataParam("downUrl");
if(StringUtils.isNotEmpty(packageAiType) && packageAiType.equals(CommonEnum.YES) && StringUtils.isNotEmpty(downUrl) ){
// LOG.debug("下载地址获取成功"+downUrl);
// callBackMsg(true, "下载地址获取成功,开始解析下载地址...");
String downLoadPaths = downLoadPath.getAbsolutePath();
downLoadFile(downUrl, downLoadPaths);
}else {
......@@ -142,14 +135,15 @@ public class AiEvalLeftButton extends ImageButton{
String waitTime = httpResponse.getDataParam("waitTime");
showAiProcessShell = new ShowAiProcessShell(getShell(), AiEvalLeftButton.this, ObjectUtils.getIntValue(progress, 0), waitTime);
showAiProcessShell.open();
// ShowViewAiProcessDialog showViewAiProcessDialog = new ShowViewAiProcessDialog(getShell(), ObjectUtils.getIntValue(progress, 0), waitTime);
// showViewAiProcessDialog.open();
// callBackMsg(false, "获取下载地址失败!");
}
}
/**
* 下载AI文件
* @param downLoadUrl 下载URL,如果有的话
* @param downLoadPaths 目标下载路径
*/
private void downLoadFile(String downLoadUrl, String downLoadPaths){
// callBackMsg("开始下载招标文件...");
HttpURLDown httpURLDown = new HttpURLDown(downLoadUrl, downLoadPaths, new CallBack() {});
// 初始化ExecutorService
ExecutorService executor = Executors.newSingleThreadExecutor();
......@@ -168,6 +162,7 @@ public class AiEvalLeftButton extends ImageButton{
future = executor.submit(downLoadTask);
// 调用异步前的操作
AiEvalLeftButton.this.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/white/hourglass.png"));
//过渡弹窗,如果需要的话就放开
// showAiProcessShell = new ShowAiProcessShell(getShell(), AiEvalLeftButton.this, ObjectUtils.getIntValue("0", 0), "0s", title, todo);
// showAiProcessShell.open();
} else {
......@@ -218,17 +213,47 @@ public class AiEvalLeftButton extends ImageButton{
// 每隔5秒检查一次任务状态
scheduler.scheduleAtFixedRate(checkTask, 0, 5, TimeUnit.SECONDS);
}
// HttpUrl httpUrl = HttpUtils.getProjectHttpUrl(curTender, PropertiesUtils.getWebserviceProperty(WebserviceConstants.GET_AI_RESULT_METHOD, "bidOpeningHS.do?downloadOpenBidSupplierAiResult"));
// HttpResponse httpResponse = HttpUtils.doPost(httpUrl);
// downloadBiddingFile(httpResponse);
/**
* 下载过程ui变化
* @param start 进度起始
* @param end 进度终点
* @param picture 过渡picture
*/
private void changeStyle(String start, String end, String picture) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
//过渡弹窗,如果需要的话就放开
// showAiProcessShell = new ShowAiProcessShell(getShell(), AiEvalLeftButton.this, ObjectUtils.getIntValue(start, 0), end, title, todo);
// showAiProcessShell.open();
AiEvalLeftButton.this.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, picture));
}
});
}
/**
* 渲染图形化界面
*/
private void render() {
this.setTopMargin(3);
this.setBottomMargin(3);
this.setLeftMargin(5);
this.setRightMargin(5);
this.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/white/view.png"));
this.setText(name);
this.setToolTipText("标书查重");
if(StringUtil.empty(name)) {
this.setFont(SWTResourceManager.getFont("微软雅黑", 10, SWT.NORMAL));
this.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
}else {
this.setFont(SWTResourceManager.getFont("微软雅黑", 12, SWT.BOLD));
this.setForeground(SWTResourceManager.getColor(60, 138, 226));
}
// this.setActiveBgColor(BG);
this.setActiveBgColor(SWTResourceManager.getColor(255, 153, 0));
this.setActiveForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
this.setSelectionBgColor(ColorConstants.SKIN_SELECTION_BG);
this.setArcWidth(6);
}
}
......@@ -57,6 +57,7 @@ import com.gx.obe.components.core.enumeration.TenderProjectEnum;
import com.gx.obe.evaluation.dialog.EvaluationGroupDialog;
import com.gx.obe.evaluation.dialog.MyAuditDialog;
import com.gx.obe.evaluation.shell.MeetingRoomOpenShell;
import com.gx.obe.evaluation.step.composite.AiEvalLeftButton;
import com.gx.obe.evaluation.step.form.WasteBidStepDialog;
import com.gx.obe.evaluation.step.listener.ExpertEvaluationListener;
import com.gx.obe.evaluation.step.resutl.action.BusinessEvaluationResultAction;
......@@ -321,14 +322,14 @@ public class MyEvaluationStepComposite extends Composite implements ActionListen
preEvalLink.setForeground(SWTResourceManager.getColor(60, 138, 226));
preEvalLink.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/signature.png"));
menuFunctionUtils.addFunction(preEvalLink, "EVALUATION_PREEVAL");
//如果需要屏蔽,直接注释掉该行
new AiEvalLeftButton(toolsComposite, SWT.NONE, tenderProject, "标书查重");
signature_btn = new ELink(toolsComposite, SWT.NONE);
signature_btn.setFont(SWTResourceManager.getFont("微软雅黑", 12, SWT.BOLD));
signature_btn.setForeground(SWTResourceManager.getColor(60, 138, 226));
menuFunctionUtils.addFunction(signature_btn, "EVALUATION_SIGNATURE");
wasteBiddding_btn = new ELink(toolsComposite, SWT.NONE);
wasteBiddding_btn.setFont(SWTResourceManager.getFont("微软雅黑", 12, SWT.BOLD));
wasteBiddding_btn.setForeground(SWTResourceManager.getColor(60, 138, 226));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment