Commit 22f7984b authored by 黄重's avatar 黄重

去掉不用插件

parent c38ba585
# \u89d2\u8272
EXPERT=\u8bc4\u6807\u4e13\u5bb6
EVALUATION_MANAGER=\u8bc4\u6807\u7ba1\u7406
OPENING_MANAGER=\u5f00\u6807\u7ba1\u7406
EVALUATION_MONITOR=\u8bc4\u6807\u76d1\u7763
EVALUATOIN_WORKER=\u8bc4\u6807\u5de5\u4f5c\u4eba\u5458
SUPER_MANAGER=\u8d85\u7ea7\u7ba1\u7406\u5458
SYSTEM_MANAGER=\u7cfb\u7edf\u7ba1\u7406
# \u89d2\u8272
EXPERT=Evaluation Expert
EVALUATION_MANAGER=Bid Evaluation Management
OPENING_MANAGER=Bid Opening Management
EVALUATION_MONITOR=Bid Evaluation Supervision
EVALUATOIN_WORKER=Bid Evaluation Staff
SUPER_MANAGER=Administrator
SYSTEM_MANAGER=System Management
# \u89d2\u8272
EXPERT=\u8bc4\u6807\u4e13\u5bb6
EVALUATION_MANAGER=\u8bc4\u6807\u7ba1\u7406
OPENING_MANAGER=\u5f00\u6807\u7ba1\u7406
EVALUATION_MONITOR=\u8bc4\u6807\u76d1\u7763
EVALUATOIN_WORKER=\u8bc4\u6807\u5de5\u4f5c\u4eba\u5458
SUPER_MANAGER=\u8d85\u7ea7\u7ba1\u7406\u5458
SYSTEM_MANAGER=\u7cfb\u7edf\u7ba1\u7406
MY_PROJECT=\u6211\u7684\u9879\u76ee
POLICY_LAW =\u6cd5\u5f8b\u6cd5\u89c4
PROJECT_INFO=\u9879\u76ee\u4fe1\u606f
PROJECT_BASE_INFO=\u57fa\u672c\u4fe1\u606f
SUPPLIER_INFO=\u6295\u6807\u4eba\u4fe1\u606f
BIDDING_FILE=\u62db\u6807\u6587\u4ef6
SELECT_PACKAGE=\u5207\u6362\u5305\u4ef6
DOWNLOAD_BID_FILE=\u4e0b\u8f7d\u6807\u4e66
BT_SEED_TORRENT=\u6807\u4e66BT\u53d1\u5e03
SYSTEM_MANAGE=\u7cfb\u7edf\u7ba1\u7406
BID_PRICE_MANAGE=\u6295\u6807\u4ef7\u7ba1\u7406
EVALUATION_PRICE_MANAGE=\u8bc4\u6807\u4ef7\u7ba1\u7406
BID_BOND_INFO=\u6295\u6807\u4fdd\u8bc1\u91d1
#\u4f9b\u5e94\u5546
SUPPLIER_MANAGE=\u4f9b\u5e94\u5546\u7ba1\u7406
SUPPLIER_SIGNIN=\u7b7e\u5230\u7ba1\u7406
SUPPLIER_SIGNIN_INFO=\u7b7e\u5230\u4fe1\u606f
#\u5f00\u6807\u5de5\u5177
OPENING_TOOL_PROJECT=\u5f00\u6807\u5de5\u5177\u9879\u76ee\u83dc\u5355
OPENING_TOP_PROJECT=\u5f00\u6807\u5de5\u5177\u9876\u90e8\u83dc\u5355
OPENING_PREPARE=\u5f00\u6807\u51c6\u5907
OPENING_SETTING=\u5f00\u6807\u8bbe\u7f6e
OPENING_HALL=\u5f00\u6807\u5927\u5385
OPENING_RESULT=\u5f00\u6807\u7ed3\u679c
OPENING_DECRYPT=\u5f00\u6807\u89e3\u5bc6
#\u8bc4\u6807\u7ba1\u7406
MANAGEMENT_TOOL_PROJECT=\u8bc4\u6807\u7ba1\u7406\u9879\u76ee\u83dc\u5355
MANAGEMENT_TOP_PROJECT=\u8bc4\u6807\u7ba1\u7406\u9876\u90e8\u83dc\u5355
EVAL_OPERATION=\u64cd\u4f5c\u6d41\u7a0b
OPENING_MANAGE=\u5f00\u6807\u7ba1\u7406
EVALUATON_MANAGE=\u8bc4\u6807\u7ba1\u7406
EVALUATON_RULE=\u8bc4\u6807\u89c4\u5219
EVALUATON_METHOD=\u8bc4\u6807\u529e\u6cd5
EVALUATON_STEP=\u8bc4\u6807\u6b65\u9aa4
EVALUATON_EXPERT=\u8bc4\u6807\u4e13\u5bb6
EVALUATON_WORKER=\u8bc4\u6807\u5de5\u4f5c\u4eba\u5458
EVALUATON_SUPERVISOR=\u8bc4\u6807\u76d1\u7763
CLARIFY_ANSWER=\u6f84\u6e05\u7b54\u7591
BIDDING_ANSWERS=\u7b54\u7591\u8865\u7591
BID_CLARIFY_ANSWERS=\u6f84\u6e05\u7b54\u590d
EVALUATION_RESULT=\u8bc4\u6807\u7ed3\u679c
EVALUATION_PROGRESS=\u8bc4\u6807\u8fdb\u5ea6
EVALUATION_OPINION=\u8bc4\u6807\u610f\u89c1
LIMIT_WINNING=\u9650\u4e2d\u6807\u63a8\u8350
EVALUATION_REPORT=\u8bc4\u6807\u62a5\u8868
BID_COMMENTS_AUDIT=\u6e05\u6807\u5ba1\u6838
WASTE_BID=\u9879\u76ee\u5e9f\u6807
UPLOAD_EVAL_RESULT=\u4e0a\u4f20\u8bc4\u6807\u7ed3\u679c
GENERATE_REPORT=\u751f\u6210\u62a5\u8868
SIGNATURE_REPORT=\u62a5\u8868\u7b7e\u540d
SUPERVISION=\u76d1\u7763\u7ba1\u7406
EVALUATION_HALL=\u8bc4\u6807\u5927\u5385
VIDEOMEETING=\u89c6\u9891\u4f1a\u8bae
SIGNATURE=\u626b\u7801\u7b7e\u7ae0
UPLOAD_BID_FILE=\u4e0a\u4f20\u6807\u4e66
#\u8bc4\u6807\u5de5\u5177
MY_PROJECT=My project
POLICY_LAW =Laws and Regulations
PROJECT_INFO=Project info
PROJECT_BASE_INFO=Base info
SUPPLIER_INFO=Supplier info
BIDDING_FILE=Bidding file
SELECT_PACKAGE=Select package
DOWNLOAD_BID_FILE=Download bid file
BT_SEED_TORRENT=BT seed torrent
SYSTEM_MANAGE=System
BID_PRICE=Bid price
BID_PRICE_MANAGE=Bid price manage
EVALUATION_PRICE_MANAGE=Eval price manage
BID_BOND_INFO=Bid bond info
#\u4f9b\u5e94\u5546
SUPPLIER_MANAGE=Supplier manage
SUPPLIER_SIGNIN=Sign-in manage
SUPPLIER_SIGNIN_INFO=Sign-in info
#\u5f00\u6807\u5de5\u5177
OPENING_TOOL_PROJECT=Opening project menu
OPENING_TOP_PROJECT=Opening top menu
OPENING_PREPARE=Opening prepare
OPENING_SETTING=Opening setting
OPENING_HALL=Opening hall
OPENING_RESULT=Opening result
OPENING_DECRYPT=Decrypt&Opening
#\u8bc4\u6807\u7ba1\u7406
MANAGEMENT_TOOL_PROJECT=Manage project menu
MANAGEMENT_TOP_PROJECT=Manage top menu
EVAL_OPERATION=Operation process
OPENING_MANAGE=Opening manage
EVALUATON_MANAGE=Eval manage
EVALUATON_RULE=Eval rule
EVALUATON_METHOD=Eval method
EVALUATON_STEP=Eval step
EVALUATON_EXPERT=Eval expert
EVALUATON_WORKER=Eval worker
EVALUATON_SUPERVISOR=Eval supervisor
CLARIFY_ANSWER=Clarify answer
BIDDING_ANSWERS=Bidding answers
BID_CLARIFY_ANSWERS=Tender answers
EVALUATION_RESULT=Eval result
EVALUATION_PROGRESS=Eval progress
EVALUATION_OPINION=Eval opinion
LIMIT_WINNING=Limit Winning
EVALUATION_REPORT=Eval report
BID_COMMENTS_AUDIT=Bid comments audit
WASTE_BID=Waste Bid
UPLOAD_EVAL_RESULT=Upload eval result
GENERATE_REPORT=Generate report
SIGNATURE_REPORT=Signature report
SUPERVISION=Supervision
EVALUATION_HALL=Eval hall
VIDEOMEETING=Video Meeting
SIGNATURE=Signature
UPLOAD_BID_FILE=Upload bid file
\ No newline at end of file
MY_PROJECT=\u6211\u7684\u9879\u76ee
POLICY_LAW =\u6cd5\u5f8b\u6cd5\u89c4
PROJECT_INFO=\u9879\u76ee\u4fe1\u606f
PROJECT_BASE_INFO=\u57fa\u672c\u4fe1\u606f
SUPPLIER_INFO=\u6295\u6807\u4eba\u4fe1\u606f
BIDDING_FILE=\u62db\u6807\u6587\u4ef6
SELECT_PACKAGE=\u5207\u6362\u5305\u4ef6
DOWNLOAD_BID_FILE=\u4e0b\u8f7d\u6807\u4e66
BT_SEED_TORRENT=\u6807\u4e66BT\u53d1\u5e03
SYSTEM_MANAGE=\u7cfb\u7edf\u7ba1\u7406
BID_PRICE_MANAGE=\u6295\u6807\u4ef7\u7ba1\u7406
EVALUATION_PRICE_MANAGE=\u8bc4\u6807\u4ef7\u7ba1\u7406
BID_BOND_INFO=\u6295\u6807\u4fdd\u8bc1\u91d1
#\u4f9b\u5e94\u5546
SUPPLIER_MANAGE=\u4f9b\u5e94\u5546\u7ba1\u7406
SUPPLIER_SIGNIN=\u7b7e\u5230\u7ba1\u7406
SUPPLIER_SIGNIN_INFO=\u7b7e\u5230\u4fe1\u606f
#\u5f00\u6807\u5de5\u5177
OPENING_TOOL_PROJECT=\u5f00\u6807\u5de5\u5177\u9879\u76ee\u83dc\u5355
OPENING_TOP_PROJECT=\u5f00\u6807\u5de5\u5177\u9876\u90e8\u83dc\u5355
OPENING_PREPARE=\u5f00\u6807\u51c6\u5907
OPENING_SETTING=\u5f00\u6807\u8bbe\u7f6e
OPENING_HALL=\u5f00\u6807\u5927\u5385
OPENING_RESULT=\u5f00\u6807\u7ed3\u679c
OPENING_DECRYPT=\u5f00\u6807\u89e3\u5bc6
#\u8bc4\u6807\u7ba1\u7406
MANAGEMENT_TOOL_PROJECT=\u8bc4\u6807\u7ba1\u7406\u9879\u76ee\u83dc\u5355
MANAGEMENT_TOP_PROJECT=\u8bc4\u6807\u7ba1\u7406\u9876\u90e8\u83dc\u5355
EVAL_OPERATION=\u64cd\u4f5c\u6d41\u7a0b
OPENING_MANAGE=\u5f00\u6807\u7ba1\u7406
EVALUATON_MANAGE=\u8bc4\u6807\u7ba1\u7406
EVALUATON_RULE=\u8bc4\u6807\u89c4\u5219
EVALUATON_METHOD=\u8bc4\u6807\u529e\u6cd5
EVALUATON_STEP=\u8bc4\u6807\u6b65\u9aa4
EVALUATON_EXPERT=\u8bc4\u6807\u4e13\u5bb6
EVALUATON_WORKER=\u8bc4\u6807\u5de5\u4f5c\u4eba\u5458
EVALUATON_SUPERVISOR=\u8bc4\u6807\u76d1\u7763
CLARIFY_ANSWER=\u6f84\u6e05\u7b54\u7591
BIDDING_ANSWERS=\u7b54\u7591\u8865\u7591
BID_CLARIFY_ANSWERS=\u6f84\u6e05\u7b54\u590d
EVALUATION_RESULT=\u8bc4\u6807\u7ed3\u679c
EVALUATION_PROGRESS=\u8bc4\u6807\u8fdb\u5ea6
EVALUATION_OPINION=\u8bc4\u6807\u610f\u89c1
LIMIT_WINNING=\u9650\u4e2d\u6807\u63a8\u8350
EVALUATION_REPORT=\u8bc4\u6807\u62a5\u8868
BID_COMMENTS_AUDIT=\u6e05\u6807\u5ba1\u6838
UPLOAD_EVAL_RESULT=\u4e0a\u4f20\u8bc4\u6807\u7ed3\u679c
GENERATE_REPORT=\u751f\u6210\u62a5\u8868
SIGNATURE_REPORT=\u62a5\u8868\u7b7e\u540d
SUPERVISION=\u76d1\u7763\u7ba1\u7406
EVALUATION_HALL=\u8bc4\u6807\u5927\u5385
#\u8bc4\u6807\u5de5\u5177
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.gx.obe.datastruct</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Datastruct
Bundle-SymbolicName: com.gx.obe.datastruct;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.gx.obe.datastruct.Activator
Bundle-Vendor: GX
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.gx.obe.utils
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: com.gx.obe.datastruct
Bundle-ActivationPolicy: lazy
Export-Package: com.gx.obe.datastruct.tree,
com.gx.obe.datastruct.tree.table
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
javacDefaultEncoding.. = UTF-8
\ No newline at end of file
package com.gx.obe.datastruct;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.gx.obe.datastruct"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}
package com.gx.obe.datastruct.tree;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Predicate;
import com.gx.obe.util.utils.CollectionUtils;
public class Forest<T extends ITree<T>> {
private final List<T> treeList;
private final List<T> leafList = new LinkedList<>();
public Forest(List<T> treeList) {
this.treeList = Optional.ofNullable(treeList).orElseGet(LinkedList::new);
initLeafList(this.treeList);
}
private void initLeafList(List<T> treeList) {
for (T iTree : treeList) {
List<T> childList = iTree.getChildList();
if (CollectionUtils.isNull(childList)) {
leafList.add(iTree);
continue;
}
initLeafList(childList);
}
}
public List<T> getTreeList() {
return treeList;
}
public List<T> getLeafList() {
return leafList;
}
public void removeLeafPath(T leaf) {
if (!leafList.remove(leaf)) {
return;
}
removePath(leaf);
}
public void filterPath(Predicate<T> predicate) {
Iterator<T> iterator = getLeafList().iterator();
while (iterator.hasNext()) {
T iTree = iterator.next();
if (!predicate.test(iTree)) {
iterator.remove();
removePath(iTree);
}
}
}
private void removePath(T iTree) {
T parent = iTree.getParent();
if (Objects.isNull(parent)) {
treeList.remove(iTree);
return;
}
List<T> childList = parent.getChildList();
if (!childList.remove(iTree)) {
return;
}
if (childList.size() != 0) {
return;
}
removePath(parent);
}
}
package com.gx.obe.datastruct.tree;
import java.util.List;
public interface ITree<T extends ITree<T>> {
public T getParent();
public List<T> getChildList();
}
package com.gx.obe.datastruct.tree.table;
import java.util.List;
/**
* @Description: 树
* @author chenxw
*/
public interface ITree {
/**
* @Description: 获取树根节点
* @author chenxw
* @return
*/
ITree getRoot();
/**
* @Description: 子树列表
* @author chenxw
* @return
*/
List<? extends ITree> getITrees();
/**
* @Description: 名称
* @author chenxw
* @return
*/
String getName();
/**
* @Description: 键
* @author chenxw
* @return
*/
String getKey();
/**
* @Description: 值
* @author chenxw
* @param key
* @return
*/
String getValue(Object key);
}
package com.gx.obe.datastruct.tree.table;
import java.util.ArrayList;
import java.util.List;
import com.gx.obe.util.utils.CollectionUtils;
/**
* @Description: 解析树
* @author chenxw
*/
public class ParseTrees {
/**
* @Description: 叶子节点列表
*/
private List<Tree> leafList = new ArrayList<>();
/**
* @Description: 树横向合并列表
*/
private List<TreeSpan> wideSpanList = new ArrayList<>();
/**
* @Description: 树竖向合并列表
*/
private List<TreeSpan> highSpanList = new ArrayList<>();
/**
* @Description: 高度
*/
private int height;
/**
* @Description: 叶子节点个数
*/
private int leafCount;
/**
* @Description: 空树
*/
private final Tree NULL_TREE = new Tree();
/**
* @author chenxw
* @param iTreeList
*/
public ParseTrees(List<? extends ITree> iTreeList) {
if (CollectionUtils.isNull(iTreeList)) {
return;
}
initLeafList(iTreeList, 0, null);
initHeight(iTreeList, 1);
initHighSpanList();
initWideSpanList(iTreeList, 0, 0);
initLeafCount();
}
/**
* @Description: 初始化叶子节点列表
* @author chenxw
* @param iTreeList
* @param level
* @param parent
*/
private void initLeafList(List<? extends ITree> iTreeList, int level, Tree parent) {
for (ITree iTree : iTreeList) {
Tree tree = new Tree();
tree.setLevel(level);
tree.setParent(parent);
tree.setValue(iTree);
List<? extends ITree> iTrees = iTree.getITrees();
if (CollectionUtils.isNull(iTrees)) leafList.add(tree);
else initLeafList(iTrees, level + 1, tree);
}
}
/**
* @Description: 初始化树横向合并列表
* @author chenxw
* @param iTreeList
* @param level
* @param leafIndex
*/
private int initWideSpanList(List<? extends ITree> iTreeList, int level, int leafIndex) {
for (ITree iTree : iTreeList) {
List<? extends ITree> iTrees = iTree.getITrees();
if (CollectionUtils.isNull(iTrees)) leafIndex++;
else {
TreeSpan span = new TreeSpan();
span.setLevel(level);
span.setLeafIndex(leafIndex);
span.setSpanCount(iTrees.size());
wideSpanList.add(span);
leafIndex = initWideSpanList(iTree.getITrees(), level + 1, leafIndex);
}
}
return leafIndex;
}
/**
* @Description: 初始化树竖向合并列表
* @author chenxw
*/
private void initHighSpanList() {
for (int i = 0; i < leafList.size(); i++) {
Tree tree = leafList.get(0);
if (height > tree.getLevel()) {
TreeSpan span = new TreeSpan();
span.setLevel(tree.getLevel());
span.setLeafIndex(i);
span.setSpanCount(height - tree.getLevel() + 1);
highSpanList.add(span);
}
}
}
/**
* @Description: 初始化树的高度
* @author chenxw
* @param iTreeList
* @param level
*/
private void initHeight(List<? extends ITree> iTreeList, int level) {
for (ITree iTree : iTreeList) {
List<? extends ITree> iTrees = iTree.getITrees();
if (CollectionUtils.isNull(iTrees)) height = Math.max(height, level);
else initHeight(iTrees, level + 1);
}
}
/**
* @Description: 初始化叶子节点的数量
* @author chenxw
*/
private void initLeafCount() {
leafCount = leafList.size();
}
/**
* @Description: 根据叶子节点索引获取叶子节点
* @author chenxw
* @param leafIndex
* @return
*/
public ITree get(int leafIndex) {
return leafList.get(leafIndex).getValue();
}
/**
* @Description: 根据层数及叶子节点索引获取对应包含这个叶子节点是节点
* @author chenxw
* @param level
* @param leafIndex
* @return
*/
public ITree getITree(int level, int leafIndex) {
return getTree(level, leafList.get(leafIndex)).getValue();
}
/**
* @Description: 根据层数递归获取节点
* @author chenxw
* @param level
* @param tree
* @return
*/
private Tree getTree(int level, Tree tree) {
if (level > tree.getLevel() || level < 0) {
return NULL_TREE;
}
if (level == tree.getLevel()) {
return tree;
}
return getTree(level, tree.getParent());
}
/**
* @Description: 获取树横向合并列表
* @author chenxw
* @return
*/
public List<TreeSpan> getWideSpanList() {
return wideSpanList;
}
/**
* @Description: 获取树竖向合并列表
* @author chenxw
* @return
*/
public List<TreeSpan> getHighSpanList() {
return highSpanList;
}
/**
* @Description: 获取数的高度
* @author chenxw
* @return
*/
public int getHeight() {
return height;
}
/**
* @Description: 获取叶子节点数
* @author chenxw
* @return
*/
public int getLeafCount() {
return leafCount;
}
}
package com.gx.obe.datastruct.tree.table;
import java.util.List;
import java.util.function.Function;
/**
* @Description: 字符串树
* @author chenxw
*/
public class StringTree implements ITree {
/**
* @Description: 父节点
*/
private ITree root;
/**
* @Description: 名称
*/
private String name;
/**
* @Description: 获取value函数
*/
private Function<Object, String> function;
/**
* @author chenxw
* @param name
* @param function
*/
public StringTree(ITree root, String name, Function<Object, String> function) {
this.root = root;
this.name = name;
this.function = function;
}
@Override
public ITree getRoot() {
return root;
}
@Override
public List<ITree> getITrees() {
return null;
}
@Override
public String getName() {
return name;
}
@Override
public String getKey() {
return null;
}
@Override
public String getValue(Object key) {
return function.apply(key);
}
}
package com.gx.obe.datastruct.tree.table;
/**
* @Description: 树
* @author chenxw
*/
class Tree {
/**
* @Description: 层数
*/
private int level;
/**
* @Description: 父节点
*/
private Tree parent;
/**
* @Description: 值
*/
private ITree value;
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public Tree getParent() {
return parent;
}
public void setParent(Tree parent) {
this.parent = parent;
}
public ITree getValue() {
return value;
}
public void setValue(ITree value) {
this.value = value;
}
}
\ No newline at end of file
package com.gx.obe.datastruct.tree.table;
public class TreeSpan {
private int level;
private int leafIndex;
private int spanCount;
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getLeafIndex() {
return leafIndex;
}
public void setLeafIndex(int leafIndex) {
this.leafIndex = leafIndex;
}
public int getSpanCount() {
return spanCount;
}
public void setSpanCount(int spanCount) {
this.spanCount = spanCount;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="/org.eclipse.swt.core/lib/de.kupzog.KTable.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.gx.obe.quote</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding/<project>=UTF-8
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Quote
Bundle-SymbolicName: com.gx.obe.quote
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.gx.obe.quote.Activator
Bundle-Vendor: GX
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.gx.obe.components.core,
com.gx.obe.business,
org.eclipse.swt.core,
com.gx.obe.dynamicview,
com.gx.obe.common.icons,
com.gx.obe.common.widget,
com.gx.obe.action;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: com.gx.obe.quote
Bundle-ActivationPolicy: lazy
Export-Package: com.gx.obe.quote.action,
com.gx.obe.quote.beans,
com.gx.obe.quote.calculator,
com.gx.obe.quote.service
Import-Package: im.util
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
javacDefaultEncoding.. = UTF-8
\ No newline at end of file
package com.gx.obe.quote;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.gx.obe.quote"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}
package com.gx.obe.quote.action;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import com.gx.obe.action.bean.CAction;
import com.gx.obe.quote.composite.AdjustStrategyManageComposite;
/**
* @Description: 修正策略管理
* @author chenxw
*/
public class AdjustStrategyManageAction extends CAction {
@Override
protected Composite initComposite(Composite parent) {
AdjustStrategyManageComposite composite = new AdjustStrategyManageComposite(parent, SWT.NONE);
composite.refresh(getTenderProject().getId());
return composite;
}
}
package com.gx.obe.quote.action;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import com.gx.obe.action.bean.CAction;
import com.gx.obe.quote.composite.BidPriceManageComposite;
/**
* @Description: 投标报价管理
* @author chenxw
*/
public class BidPriceManageAction extends CAction {
@Override
protected Composite initComposite(Composite parent) {
BidPriceManageComposite composite = new BidPriceManageComposite(parent, SWT.NONE);
composite.refresh(getTenderProject().getId());
return composite;
}
}
package com.gx.obe.quote.beans;
import java.math.BigDecimal;
import com.gx.obe.components.core.util.MoneyUtils;
import com.gx.obe.quote.enums.AdjustTypeEnum;
import com.gx.obe.util.utils.BigDecimalUtils;
/**
* @Description: 调整策略
* @author chenxw
*/
public class AdjustStrategy {
private String id;
private String tenderId;
private String supplierId;
private String bidPriceId;
/**
* @Description: 调整类型
*/
private String adjustType;
/**
* @Description: 调整的值
*/
private BigDecimal adjustValue;
/**
* @Description: 调整原因
*/
private String adjustReason;
private int scale = 2;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTenderId() {
return tenderId;
}
public void setTenderId(String tenderId) {
this.tenderId = tenderId;
}
public String getSupplierId() {
return supplierId;
}
public void setSupplierId(String supplierId) {
this.supplierId = supplierId;
}
public String getBidPriceId() {
return bidPriceId;
}
public void setBidPriceId(String bidPriceId) {
this.bidPriceId = bidPriceId;
}
public String getAdjustType() {
return adjustType;
}
public void setAdjustType(String adjustType) {
this.adjustType = adjustType;
}
public BigDecimal getAdjustValue() {
return adjustValue;
}
public void setAdjustValue(BigDecimal adjustValue) {
this.adjustValue = adjustValue;
}
public String getAdjustReason() {
return adjustReason;
}
public void setAdjustReason(String adjustReason) {
this.adjustReason = adjustReason;
}
public String getDescribe(String priceUnit) {
if (!AdjustTypeEnum.MAP.containsKey(getAdjustType())) {
return "";
}
switch (AdjustTypeEnum.MAP.get(getAdjustType())) {
case DISCOUNT_RATE:
if (adjustValue.compareTo(BigDecimal.ZERO) == -1) {
return "下浮".concat(BigDecimalUtils.round(adjustValue.multiply(BigDecimal.valueOf(-1)), scale).toString()).concat("%");
} else if (adjustValue.compareTo(BigDecimal.ZERO) == 1) {
return "上浮".concat(BigDecimalUtils.round(adjustValue, scale).toString()).concat("%");
}
break;
case DISCOUNT_AMOUNT:
if (adjustValue.compareTo(BigDecimal.ZERO) == -1) {
return "减少".concat(MoneyUtils.getMoneyFormatByUnit(adjustValue.multiply(BigDecimal.valueOf(-1)), priceUnit)).concat(priceUnit);
} else if (adjustValue.compareTo(BigDecimal.ZERO) == 1) {
return "增加".concat(MoneyUtils.getMoneyFormatByUnit(adjustValue, priceUnit)).concat(priceUnit);
}
break;
default:
break;
}
return "";
}
}
package com.gx.obe.quote.beans;
import java.math.BigDecimal;
/**
* @Description: 汇率
* @author chenxw
*/
public class ExchangeRate {
private String id;
private String tenderId;
/**
* @Description: 转换之前的币种编号
*/
private String beforeCode;
/**
* @Description: 转换之后的币种编号
*/
private String afterCode;
/**
* @Description: 汇率
*/
private BigDecimal rate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTenderId() {
return tenderId;
}
public void setTenderId(String tenderId) {
this.tenderId = tenderId;
}
public String getBeforeCode() {
return beforeCode;
}
public void setBeforeCode(String beforeCode) {
this.beforeCode = beforeCode;
}
public String getAfterCode() {
return afterCode;
}
public void setAfterCode(String afterCode) {
this.afterCode = afterCode;
}
public BigDecimal getRate() {
return rate;
}
public void setRate(BigDecimal rate) {
this.rate = rate;
}
}
package com.gx.obe.quote.calculator;
import java.math.BigDecimal;
import java.util.Objects;
import java.util.Optional;
import com.gx.obe.quote.beans.AdjustStrategy;
import com.gx.obe.quote.enums.AdjustTypeEnum;
/**
* @Description: 修正策略计算器
* @author chenxw
*/
public class AdjustStrategyCalculator implements Calculator {
private AdjustStrategy adjustStrategy;
/**
* @author chenxw
* @param adjustStrategy
*/
public AdjustStrategyCalculator(AdjustStrategy adjustStrategy) {
this.adjustStrategy = adjustStrategy;
}
@Override
public BigDecimal calculate(BigDecimal bigDecimal) {
if (Objects.isNull(bigDecimal)) {
return null;
}
if (Objects.isNull(adjustStrategy)) {
return bigDecimal;
}
Optional<AdjustTypeEnum> adjustTypeEnumOptional = Optional.of(adjustStrategy).map(AdjustStrategy::getAdjustType).map(AdjustTypeEnum.MAP::get);
if (!adjustTypeEnumOptional.isPresent()) {
return bigDecimal;
}
BigDecimal adjustValue = adjustStrategy.getAdjustValue();
if (Objects.isNull(adjustValue)) {
return bigDecimal;
}
return adjustTypeEnumOptional.get().discount(bigDecimal, adjustValue);
}
}
package com.gx.obe.quote.calculator;
import java.math.BigDecimal;
import java.util.Objects;
/**
* @Description: 计算器
* @author chenxw
*/
@FunctionalInterface
public interface Calculator {
/**
* @Description: 计算
* @author chenxw
* @param bigDecimal
* @return
*/
public BigDecimal calculate(BigDecimal bigDecimal);
/**
* @Description: 之前
* @author chenxw
* @param before
* @return
*/
default Calculator compose(Calculator before) {
Objects.requireNonNull(before);
return t -> calculate(before.calculate(t));
}
/**
* @Description: 之后
* @author chenxw
* @param after
* @return
*/
default Calculator andThen(Calculator after) {
Objects.requireNonNull(after);
return t -> after.calculate(calculate(t));
}
}
package com.gx.obe.quote.calculator;
import java.math.BigDecimal;
import java.util.Objects;
import com.gx.obe.quote.exception.NoSetExchangeRateException;
import com.gx.obe.quote.utils.BidPriceUtils;
import com.gx.obe.web.entity.price.BidPriceResult;
import com.gx.obe.web.entity.tender.TenderProjectRuleEntity;
/**
* @Description: 评标价计算器
* @author chenxw
*/
public class EvaluationPriceCalculator {
private ExchangeRateCalculatorFactory calculatorFactory;
/**
* @author chenxw
* @param tenderId
*/
public EvaluationPriceCalculator(String tenderId, TenderProjectRuleEntity projectRule) {
if (Objects.isNull(projectRule)) {
return;
}
this.calculatorFactory = new ExchangeRateCalculatorFactory(tenderId, projectRule.getEvalCurrencyCode());
}
/**
* @Description: 计算
* @author chenxw
* @param bidPriceResult
* @return
* @throws NoSetExchangeRateException
*/
public BigDecimal calculate(BidPriceResult bidPriceResult) throws NoSetExchangeRateException {
if (Objects.isNull(bidPriceResult)) {
return null;
}
return createCalculator(bidPriceResult.getCurrencyCode()).calculate(BidPriceUtils.getFinalBidPrice(bidPriceResult));
}
/**
* @Description: 创建计算器
* @author chenxw
* @param beforeCode
* @return
* @throws NoSetExchangeRateException
*/
public Calculator createCalculator(String beforeCode) throws NoSetExchangeRateException {
if (Objects.isNull(calculatorFactory)) {
return t -> t;
}
return calculatorFactory.createCalculator(beforeCode);
}
}
package com.gx.obe.quote.calculator;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import com.gx.obe.quote.beans.ExchangeRate;
import com.gx.obe.quote.exception.NoSetExchangeRateException;
import com.gx.obe.quote.service.ExchangeRateService;
/**
* @Description: 汇率计算器工厂
* @author chenxw
*/
public class ExchangeRateCalculatorFactory {
private String tenderId;
private String afterCode;
private Map<String, BigDecimal> exchangeRateMap;
/**
* @author chenxw
* @param tenderId
* @param afterCode
*/
public ExchangeRateCalculatorFactory(String tenderId, String afterCode) {
this.tenderId = tenderId;
this.afterCode = afterCode;
this.exchangeRateMap = initExchangeRateMap();
}
/**
* @Description: 初始化汇率map
* @author chenxw
* @return
*/
private Map<String, BigDecimal> initExchangeRateMap() {
List<ExchangeRate> exchangeRateList = ExchangeRateService.getListByAfterCode(tenderId, afterCode);
if (Objects.isNull(exchangeRateList)) {
return new HashMap<>();
}
return exchangeRateList.stream().collect(Collectors.toMap(ExchangeRate::getBeforeCode, ExchangeRate::getRate));
}
/**
* @Description: 创建计算器
* @author chenxw
* @param beforeCode
* @return
* @throws NoSetExchangeRateException
*/
public Calculator createCalculator(String beforeCode) throws NoSetExchangeRateException {
if (Objects.equals(afterCode, beforeCode)) {
return t -> t;
}
BigDecimal exchangeRate = exchangeRateMap.get(beforeCode);
if (Objects.isNull(exchangeRate)) {
throw new NoSetExchangeRateException(beforeCode, afterCode);
}
return exchangeRate::multiply;
}
}
package com.gx.obe.quote.calculator;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import com.gx.obe.components.core.enumeration.BidPriceEnum;
import com.gx.obe.quote.beans.AdjustStrategy;
import com.gx.obe.quote.service.AdjustStrategyService;
import com.gx.obe.quote.utils.BidPriceUtils;
import com.gx.obe.util.utils.CollectionUtils;
import com.gx.obe.web.entity.SupplierOpeningResult;
import com.gx.obe.web.entity.price.BidPriceResult;
public class SupplierOpeningResultCalculator {
private final AdjustStrategyService adjustStrategyService = new AdjustStrategyService();
private final Collector<BidPriceResult, ?, EvaluationPrice> collector = Collectors.reducing(new EvaluationPrice(), EvaluationPrice::new, EvaluationPrice::add);
public SupplierOpeningResultCalculator(String tenderId, List<BidPriceResult> bidPriceResultList, List<SupplierOpeningResult> supplierOpeningResultList) {
if (CollectionUtils.isNull(bidPriceResultList)) {
return;
}
calculatorBidPriceResultList(tenderId, bidPriceResultList);
if (CollectionUtils.isNull(supplierOpeningResultList)) {
return;
}
calculatorSupplierOpeningResultList(bidPriceResultList, supplierOpeningResultList);
}
private void calculatorBidPriceResultList(String tenderId, List<BidPriceResult> bidPriceResultList) {
Map<String, AdjustStrategy> adjustStrategyMap = getAdjustStrategyMap(tenderId);
for (BidPriceResult t : bidPriceResultList) {
BigDecimal evaluationPriceOriginal = BidPriceUtils.getFinalBidPrice(t);
t.setEvaluationPriceOriginal(evaluationPriceOriginal);
t.setEvaluationPrice(new AdjustStrategyCalculator(adjustStrategyMap.get(t.getBidPriceId().concat("-").concat(t.getSupplierId()))).calculate(evaluationPriceOriginal));
}
}
private void calculatorSupplierOpeningResultList(List<BidPriceResult> bidPriceResultList, List<SupplierOpeningResult> supplierOpeningResultList) {
Map<String, EvaluationPrice> evaluationPriceMap = bidPriceResultList.stream().filter(t -> BidPriceEnum.JOIN_TOTAL.equals(t.getJoinTotal())).collect(Collectors.groupingBy(BidPriceResult::getSupplierId, collector));
for (SupplierOpeningResult supplierOpeningResult : supplierOpeningResultList) {
EvaluationPrice evaluationPrice = evaluationPriceMap.get(supplierOpeningResult.getSupplierId());
supplierOpeningResult.setEvaluationPriceOriginal(evaluationPrice.evaluationPriceOriginal);
supplierOpeningResult.setEvaluationPrice(evaluationPrice.evaluationPrice);
}
}
private Map<String, AdjustStrategy> getAdjustStrategyMap(String tenderId) {
List<AdjustStrategy> adjustStrategies = adjustStrategyService.getAdjustStrategyList(tenderId);
if (Objects.isNull(adjustStrategies)) {
return new HashMap<>();
}
return adjustStrategies.stream().collect(Collectors.toMap(t -> t.getBidPriceId().concat("-").concat(t.getSupplierId()), Function.identity()));
}
class EvaluationPrice {
BigDecimal evaluationPriceOriginal;
BigDecimal evaluationPrice;
public EvaluationPrice() {
evaluationPriceOriginal = BigDecimal.ZERO;
evaluationPrice = BigDecimal.ZERO;
}
public EvaluationPrice(BidPriceResult bidPriceResult) {
this.evaluationPriceOriginal = bidPriceResult.getEvaluationPriceOriginal();
this.evaluationPrice = bidPriceResult.getEvaluationPrice();
}
private EvaluationPrice add(EvaluationPrice evaluationPrice) {
EvaluationPrice t = new EvaluationPrice();
t.evaluationPriceOriginal = this.evaluationPriceOriginal.add(evaluationPrice.evaluationPriceOriginal);
t.evaluationPrice = this.evaluationPrice.add(evaluationPrice.evaluationPrice);
return t;
}
}
}
package com.gx.obe.quote.composite;
import java.math.BigDecimal;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.IntStream;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import com.gx.obe.components.core.util.MoneyUtils;
import com.swtdesigner.SWTResourceManager;
public class AdjustStrategyEditComposite extends Composite {
private Combo combo;
private Text text;
private Label label;
private String[] combos;
private String unit;
private BigDecimal adjustValue;
private Consumer<BigDecimal> consumer;
public AdjustStrategyEditComposite(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(3, false));
combo = new Combo(this, SWT.READ_ONLY);
combo.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> calculationAdjustValue()));
GridData gd_combo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_combo.widthHint = 50;
combo.setLayoutData(gd_combo);
text = new Text(this, SWT.BORDER | SWT.RIGHT);
text.addModifyListener(e -> calculationAdjustValue());
text.setFont(SWTResourceManager.getFont("微软雅黑", 12, SWT.NORMAL));
GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_text.widthHint = 150;
text.setLayoutData(gd_text);
label = new Label(this, SWT.NONE);
GridData gd_label = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_label.widthHint = 70;
label.setLayoutData(gd_label);
}
public void addAdjustValueListener(Consumer<BigDecimal> consumer) {
this.consumer = consumer;
}
private void calculationAdjustValue() {
adjustValue = MoneyUtils.getMoneyFromText(text.getText().trim(), unit);
if (Objects.isNull(adjustValue)) {
text.setText("0");
adjustValue = BigDecimal.ZERO;
} else if (combo.getSelectionIndex() == 1) {
adjustValue = BigDecimal.valueOf(-1).multiply(adjustValue);
}
Optional.ofNullable(consumer).ifPresent(t -> t.accept(adjustValue));
}
public void refresh(String[] combos, String unit) {
this.combos = combos;
this.unit = unit;
refreshComposite();
}
private void refreshComposite() {
combo.removeAll();
IntStream.range(0, combos.length).forEach(i -> combo.add(combos[i], i));
label.setText(unit);
refreshAdjustValue();
layout();
}
public void setAdjustValue(BigDecimal adjustValue) {
this.adjustValue = adjustValue;
refreshAdjustValue();
}
private void refreshAdjustValue() {
adjustValue = Optional.ofNullable(adjustValue).orElse(BigDecimal.ZERO);
if (adjustValue.compareTo(BigDecimal.ZERO) == -1) {
adjustValue = BigDecimal.valueOf(-1).multiply(adjustValue);
combo.select(1);
} else {
combo.select(0);
}
text.setText(MoneyUtils.getMoneyFormatByUnit(adjustValue, unit));
}
@Override
public boolean setFocus() {
return text.setFocus();
}
public BigDecimal getAdjustValue() {
return adjustValue;
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
package com.gx.obe.quote.composite;
import java.util.Arrays;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.core.listener.RoundBorderLineListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import com.gx.obe.ColorConstants;
import com.gx.obe.common.widget.composite.TitleComposite;
import com.gx.obe.quote.table.AdjustStrategyTable;
import com.gx.obe.util.utils.CollectionUtils;
import com.gx.obe.web.entity.price.BidPrice;
import com.gx.obe.web.entity.tender.TenderProjectRuleEntity;
import com.gx.obe.web.service.BidPriceService;
import com.gx.obe.web.service.ProjectRuleService;
public class AdjustStrategyManageComposite extends Composite {
private final ProjectRuleService projectRuleService = new ProjectRuleService();
private final BidPriceService bidPriceService = new BidPriceService();
private Composite contentComposite;
public AdjustStrategyManageComposite(Composite parent, int style) {
super(parent, style);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
setLayout(gridLayout);
TitleComposite composite = new TitleComposite(this, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
composite.setTitle("调整评标价");
Composite composite_1 = new Composite(this, SWT.NONE);
composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
GridLayout gl_composite_1 = new GridLayout(1, false);
gl_composite_1.marginHeight = 1;
gl_composite_1.marginWidth = 1;
composite_1.setLayout(gl_composite_1);
composite_1.addPaintListener(new RoundBorderLineListener(ColorConstants.BORDER_LINE_COLOR));
contentComposite = new Composite(composite_1, SWT.NONE);
contentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
contentComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
}
public void refresh(String tenderId) {
Arrays.stream(contentComposite.getChildren()).forEach(Control::dispose);
TenderProjectRuleEntity projectRule = projectRuleService.getProjectRule(tenderId);
List<BidPrice> bidPriceList = bidPriceService.getTenderBidPriceList(tenderId);
if (CollectionUtils.isNotNull(bidPriceList)) {
if (bidPriceList.size() == 1) {
new AdjustStrategyTable(contentComposite).refresh(tenderId, bidPriceList.get(0).getId(), projectRule);
} else {
new MultiBidPriceAdjustComposite(contentComposite, projectRule).refresh(bidPriceList);
}
}
contentComposite.layout();
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
package com.gx.obe.quote.composite;
import java.util.Arrays;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.core.listener.RoundBorderLineListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import com.gx.obe.ColorConstants;
import com.gx.obe.common.widget.composite.TitleComposite;
import com.gx.obe.quote.table.BidPriceModifyTable;
import com.gx.obe.util.utils.CollectionUtils;
import com.gx.obe.web.entity.price.BidPrice;
import com.gx.obe.web.service.BidPriceService;
public class BidPriceManageComposite extends Composite {
private final BidPriceService bidPriceService = new BidPriceService();
private Composite contentComposite;
public BidPriceManageComposite(Composite parent, int style) {
super(parent, style);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
setLayout(gridLayout);
TitleComposite composite = new TitleComposite(this, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
composite.setTitle("修正投标价");
Composite composite_1 = new Composite(this, SWT.NONE);
composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
GridLayout gl_composite_1 = new GridLayout(1, false);
gl_composite_1.marginHeight = 1;
gl_composite_1.marginWidth = 1;
composite_1.setLayout(gl_composite_1);
composite_1.addPaintListener(new RoundBorderLineListener(ColorConstants.BORDER_LINE_COLOR));
contentComposite = new Composite(composite_1, SWT.NONE);
contentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
contentComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
}
public void refresh(String tenderId) {
Arrays.stream(contentComposite.getChildren()).forEach(Control::dispose);
List<BidPrice> bidPriceList = bidPriceService.getTenderBidPriceList(tenderId);
if (CollectionUtils.isNotNull(bidPriceList)) {
if (bidPriceList.size() == 1) {
new BidPriceModifyTable(contentComposite).refresh(tenderId, bidPriceList.get(0).getId());
} else {
new MultiBidPriceModifyComposite(contentComposite).refresh(bidPriceList);
}
}
contentComposite.layout();
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
package com.gx.obe.quote.composite;
import org.eclipse.swt.SWT;
import org.eclipse.swt.core.widgets.ImageButton;
import org.eclipse.swt.widgets.Composite;
import com.gx.obe.quote.table.AdjustStrategyTable;
import com.gx.obe.web.entity.price.BidPrice;
import com.gx.obe.web.entity.tender.TenderProjectRuleEntity;
public class MultiBidPriceAdjustComposite extends TabSwitchComposite<BidPrice> {
public MultiBidPriceAdjustComposite(Composite parent, TenderProjectRuleEntity projectRule) {
super(parent);
addTabSwitchListener(new TabSwitchListener<BidPrice>() {
public void newContentComposite(Composite parent, BidPrice type) {
new AdjustStrategyTable(parent).refresh(type.getTenderId(), type.getId(), projectRule);
}
public ImageButton getImageButton(Composite parent, BidPrice type) {
ImageButton button = new ImageButton(parent, SWT.NONE);
button.setText(type.getBidPriceName());
return button;
}
});
}
}
package com.gx.obe.quote.composite;
import org.eclipse.swt.SWT;
import org.eclipse.swt.core.widgets.ImageButton;
import org.eclipse.swt.widgets.Composite;
import com.gx.obe.quote.table.BidPriceModifyTable;
import com.gx.obe.web.entity.price.BidPrice;
public class MultiBidPriceModifyComposite extends TabSwitchComposite<BidPrice> {
public MultiBidPriceModifyComposite(Composite parent) {
super(parent);
addTabSwitchListener(new TabSwitchListener<BidPrice>() {
public void newContentComposite(Composite parent, BidPrice type) {
new BidPriceModifyTable(parent).refresh(type.getTenderId(), type.getId());
}
public ImageButton getImageButton(Composite parent, BidPrice type) {
ImageButton button = new ImageButton(parent, SWT.NONE);
button.setText(type.getBidPriceName());
return button;
}
});
}
}
package com.gx.obe.quote.composite;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import org.eclipse.swt.SWT;
import org.eclipse.swt.core.widgets.ImageButton;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
public class TabSwitchComposite<T> extends Composite {
private List<T> list;
private Composite btnComposite;
private Composite contentComposite;
private ImageButton curButton;
private TabSwitchListener<T> tabSwitchListener;
public TabSwitchComposite(Composite parent) {
super(parent, SWT.NONE);
setLayout(new GridLayout(1, false));
btnComposite = new Composite(this, SWT.NONE);
btnComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
btnComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
contentComposite = new Composite(this, SWT.NONE);
contentComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
contentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
}
public void refresh(List<T> list) {
this.list = list;
refreshBtnComposite();
}
private void refreshBtnComposite() {
Arrays.stream(btnComposite.getChildren()).forEach(Control::dispose);
list.stream().forEach(this::createButton);
btnComposite.layout();
btnComposite.getChildren()[0].notifyListeners(SWT.MouseUp, null);
}
private void createButton(T type) {
ImageButton button = tabSwitchListener.getImageButton(btnComposite, type);
button.addMouseListener(MouseListener.mouseUpAdapter(e -> {
Optional.ofNullable(curButton).ifPresent(t -> t.setSelection(false));
curButton = button;
curButton.setSelection(true);
Arrays.stream(contentComposite.getChildren()).forEach(Control::dispose);
tabSwitchListener.newContentComposite(contentComposite, type);
contentComposite.layout();
}));
}
public void addTabSwitchListener(TabSwitchListener<T> tabSwitchListener) {
this.tabSwitchListener = tabSwitchListener;
}
public interface TabSwitchListener<T> {
ImageButton getImageButton(Composite parent, T type);
void newContentComposite(Composite parent, T type);
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
package com.gx.obe.quote.converter;
import com.gx.obe.components.core.util.MoneyUtils;
import com.gx.obe.dynamicview.converter.tostirng.ToStringConverter;
import com.gx.obe.quote.vo.QuoteVo;
public class MoneyConverter implements ToStringConverter {
@Override
public String convert(Object object) {
if (!(object instanceof QuoteVo)) {
return "";
}
QuoteVo quote = (QuoteVo) object;
return MoneyUtils.getMoneyFormatByUnit(quote.getPrice(), quote.getUnit());
}
}
package com.gx.obe.quote.enums;
import java.math.BigDecimal;
import java.util.Map;
import com.gx.obe.util.utils.EnumUtils;
/**
* @Description: 调整类型
* @author chenxw
*/
public enum AdjustTypeEnum {
/**
* @Description: 折扣率
*/
DISCOUNT_RATE("01") {
public BigDecimal discount(BigDecimal quote, BigDecimal adjustValue) {
return BigDecimal.valueOf(0.01).multiply(adjustValue).add(BigDecimal.ONE).multiply(quote);
}
},
/**
* @Description: 折扣金额
*/
DISCOUNT_AMOUNT("02") {
public BigDecimal discount(BigDecimal quote, BigDecimal adjustValue) {
return quote.add(adjustValue);
}
};
private String key;
/**
* @author chenxw
* @param key
*/
private AdjustTypeEnum(String key) {
this.setKey(key);
}
public static Map<String, AdjustTypeEnum> MAP = EnumUtils.toMap(values(), AdjustTypeEnum::getKey);
/**
* @Description: 折扣
* @author chenxw
* @param quote
* @param adjustValue
* @return
*/
public abstract BigDecimal discount(BigDecimal quote, BigDecimal adjustValue);
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
package com.gx.obe.quote.exception;
public class NoSetExchangeRateException extends Exception {
/**
* @Description:
*/
private static final long serialVersionUID = 1L;
private String beforeCode;
private String afterCode;
public NoSetExchangeRateException(String beforeCode, String afterCode) {
this.beforeCode = beforeCode;
this.afterCode = afterCode;
}
public String getBeforeCode() {
return beforeCode;
}
public void setBeforeCode(String beforeCode) {
this.beforeCode = beforeCode;
}
public String getAfterCode() {
return afterCode;
}
public void setAfterCode(String afterCode) {
this.afterCode = afterCode;
}
}
package com.gx.obe.quote.listener;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;
public class PatternModifyListener implements ModifyListener {
private Pattern p;
private String defaultValue;
private Consumer<String> consumer;
public PatternModifyListener(String regex, String defaultValue, Consumer<String> consumer) {
this.p = Pattern.compile(regex);
this.defaultValue = defaultValue;
this.consumer = consumer;
}
@Override
public void modifyText(ModifyEvent e) {
Text text = (Text) e.widget;
String value = text.getText().trim();
if (value.equals(defaultValue)) {
consumer.accept(value);
return;
}
if (p.matcher(value).matches()) {
consumer.accept(value);
return;
}
text.setText(defaultValue);
}
}
package com.gx.obe.quote.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gx.obe.quote.beans.AdjustStrategy;
import com.gx.obe.web.utils.ObeHttpUtils;
import com.gx.obe.web.vo.UpdateAssignPropertyVo;
public class AdjustStrategyService {
protected static final String URL = "obeAdjustStrategy";
public List<AdjustStrategy> getListByBidPriceId(String tenderId, String bidPriceId) {
Map<String, Object> param = new HashMap<>();
param.put("tenderId", tenderId);
param.put("bidPriceId", bidPriceId);
return ObeHttpUtils.getList(URL.concat("/getListByBidPriceId"), param , AdjustStrategy.class);
}
public boolean insert(AdjustStrategy adjustStrategy) {
return ObeHttpUtils.post(URL.concat("/insert"), adjustStrategy);
}
public boolean updateAssignProperty(AdjustStrategy adjustStrategy, String[] attributes) {
UpdateAssignPropertyVo<AdjustStrategy> vo = new UpdateAssignPropertyVo<>();
vo.setEntity(adjustStrategy);
vo.setAttributes(attributes);
return ObeHttpUtils.post(URL.concat("/updateAssignProperty"), vo);
}
public List<AdjustStrategy> getAdjustStrategyList(String tenderId) {
Map<String, Object> param = new HashMap<>();
param.put("tenderId", tenderId);
return ObeHttpUtils.getList(URL.concat("/getAdjustStrategyList"), param, AdjustStrategy.class);
}
// public boolean deleteById(String id) {
// Map<String, Object> param = new HashMap<>();
// param.put("id", id);
// return ObeHttpUtils.getBoolean(URL.concat("/deleteById"), param);
// }
//
}
package com.gx.obe.quote.service;
import java.util.List;
import com.gx.obe.quote.beans.ExchangeRate;
public class ExchangeRateService {
/**
* @Description: 根据需要转换的币种获取当前姓名设置的汇率列表
* @author chenxw
* @param tenderId
* @param afterCode
* @return
*/
public static List<ExchangeRate> getListByAfterCode(String tenderId, String afterCode) {
// TODO Auto-generated method stub
return null;
}
}
package com.gx.obe.quote.table;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.eclipse.swt.SWT;
import org.eclipse.swt.core.MessageDialog;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import com.gx.obe.common.icons.IconsActivator;
import com.gx.obe.dynamicview.view.DynamicTable;
import com.gx.obe.dynamicview.view.vo.OperateColVo;
import com.gx.obe.quote.beans.AdjustStrategy;
import com.gx.obe.quote.calculator.EvaluationPriceCalculator;
import com.gx.obe.quote.dialog.AdjustStrategyDialog;
import com.gx.obe.quote.exception.NoSetExchangeRateException;
import com.gx.obe.quote.service.AdjustStrategyService;
import com.gx.obe.quote.vo.AdjustStrategyVo;
import com.gx.obe.quote.vo.QuoteVo;
import com.gx.obe.util.utils.CollectionUtils;
import com.gx.obe.web.entity.Supplier;
import com.gx.obe.web.entity.price.BidPriceResult;
import com.gx.obe.web.entity.tender.TenderProjectRuleEntity;
import com.gx.obe.web.service.BidPriceResultService;
import com.gx.obe.web.service.SupplierService;
import com.gx.obe.web.service.evaluation.EvaluationStepService;
import com.swtdesigner.ResourceManager;
import de.kupzog.ktable.SWTX;
public class AdjustStrategyTable extends DynamicTable {
private final Image editImage = ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/edit.png");
private final Image deleteImage = ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/delete.png");
private final SupplierService supplierService = new SupplierService();
private final BidPriceResultService bidPriceResultService = new BidPriceResultService();
private final AdjustStrategyService adjustStrategyService = new AdjustStrategyService();
private final EvaluationStepService evaluationStepService = new EvaluationStepService();
private String tenderId;
private String bidPriceId;
private TenderProjectRuleEntity projectRule;
public AdjustStrategyTable(Composite parent) {
super(parent, SWTX.AUTO_SCROLL | SWT.FULL_SELECTION | SWTX.EDIT_ON_KEY | SWTX.FILL_WITH_LASTCOL);
}
public void refresh(String tenderId, String bidPriceId, TenderProjectRuleEntity projectRule) {
this.tenderId = tenderId;
this.bidPriceId = bidPriceId;
this.projectRule = projectRule;
refreshTable();
}
private void refreshTable() {
// if (!evaluationStepService.isCompletePriceAndRecommendStep(tenderId)) {
// addOperateCol(new OperateColVo("操作", "调整", editImage, this::editEnablePre, this::editActionRender));
// addOperateCol(new OperateColVo("操作", "重置", deleteImage, this::deleteEnablePre, this::deleteActionRender));
// }
putReplaceMap("evalPriceUnit", projectRule.getEvalPriceUnit());
List<AdjustStrategyVo> adjustStrategyVoList = null;
List<Supplier> supplierList = supplierService.getOpenBidSuccessSupplier(tenderId);
if (CollectionUtils.isNotNull(supplierList)) {
adjustStrategyVoList = supplierList.stream().map(getAdjustStrategyVoMapper()).collect(Collectors.toList());
}
super.refresh(adjustStrategyVoList, AdjustStrategyVo.class);
}
private Function<Supplier, AdjustStrategyVo> getAdjustStrategyVoMapper() {
Map<String, BidPriceResult> bidPriceResultMap = null;
List<BidPriceResult> bidPriceResultList = bidPriceResultService.getBidPriceResultList(tenderId, bidPriceId);
if (CollectionUtils.isNotNull(bidPriceResultList)) {
bidPriceResultMap = bidPriceResultList.stream().collect(Collectors.toMap(BidPriceResult::getSupplierId, Function.identity()));
}
Map<String, AdjustStrategy> adjustStrategyMap = null;
List<AdjustStrategy> adjustStrategyList = adjustStrategyService.getListByBidPriceId(tenderId, bidPriceId);
if (CollectionUtils.isNotNull(adjustStrategyList)) {
adjustStrategyMap = adjustStrategyList.stream().collect(Collectors.toMap(AdjustStrategy::getSupplierId, Function.identity()));
}
Map<String, BidPriceResult> _bidPriceResultMap = Optional.ofNullable(bidPriceResultMap).orElseGet(HashMap::new);
Map<String, AdjustStrategy> _adjustStrategyMap = Optional.ofNullable(adjustStrategyMap).orElseGet(HashMap::new);
EvaluationPriceCalculator evaluationPriceCalculator = new EvaluationPriceCalculator(tenderId, projectRule);
return t -> {
BigDecimal beforePrice = null;
try {
beforePrice = evaluationPriceCalculator.calculate(_bidPriceResultMap.get(t.getId()));
} catch (NoSetExchangeRateException e) {
MessageDialog.openWarning(getShell(), "未设置".concat(e.getAfterCode()).concat(e.getBeforeCode()).concat("汇率!"));
}
AdjustStrategyVo adjustStrategyVo = new AdjustStrategyVo(t.getSupplierName(), new QuoteVo(beforePrice, projectRule.getEvalPriceUnit()));
adjustStrategyVo.setAdjustStrategy(_adjustStrategyMap.computeIfAbsent(t.getId(), this::adjustStrategyMapping), projectRule.getEvalPriceUnit());
return adjustStrategyVo;
};
}
private AdjustStrategy adjustStrategyMapping(String supplierId) {
AdjustStrategy adjustStrategy = new AdjustStrategy();
adjustStrategy.setTenderId(tenderId);
adjustStrategy.setSupplierId(supplierId);
adjustStrategy.setBidPriceId(bidPriceId);
return adjustStrategy;
}
private boolean editEnablePre(Object t) {
return Objects.nonNull(((AdjustStrategyVo) t).getBeforePrice().getPrice());
}
private boolean deleteEnablePre(Object t) {
return Objects.nonNull(((AdjustStrategyVo) t).getAdjustStrategy().getId());
}
private void editActionRender(Object t) {
new AdjustStrategyDialog(getShell(), tenderId, projectRule.getEvalPriceUnit(), (AdjustStrategyVo) t, this::confirmAction).open();
}
private void deleteActionRender(Object t) {
if (!MessageDialog.openConfirm(getShell(), "重置将清空当前供应商调整后评标价及调整原因,是否确认重置?")) {
return;
}
AdjustStrategyVo adjustStrategyVo = (AdjustStrategyVo) t;
// if (!adjustStrategyService.deleteById(adjustStrategyVo.getAdjustStrategy().getId())) {
// MessageDialog.openError(getShell(), "重置失败!");
// return;
// }
adjustStrategyVo.setAdjustStrategy(adjustStrategyMapping(adjustStrategyVo.getAdjustStrategy().getSupplierId()), projectRule.getEvalPriceUnit());
redraw();
MessageDialog.openShortMessage("重置成功!");
}
private void confirmAction(AdjustStrategyVo adjustStrategyVo) {
redraw();
}
}
package com.gx.obe.quote.table;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.eclipse.swt.SWT;
import org.eclipse.swt.core.MessageDialog;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import com.gx.obe.common.icons.IconsActivator;
import com.gx.obe.dynamicview.view.DynamicTable;
import com.gx.obe.dynamicview.view.vo.OperateColVo;
import com.gx.obe.quote.dialog.ModifyBidPriceDialog;
import com.gx.obe.quote.vo.BidPriceModifyVo;
import com.gx.obe.util.utils.CollectionUtils;
import com.gx.obe.util.utils.StringUtils;
import com.gx.obe.web.entity.Supplier;
import com.gx.obe.web.entity.price.BidPriceResult;
import com.gx.obe.web.service.BidPriceResultService;
import com.gx.obe.web.service.SupplierService;
import com.gx.obe.web.service.evaluation.EvaluationStepService;
import com.swtdesigner.ResourceManager;
import de.kupzog.ktable.SWTX;
public class BidPriceModifyTable extends DynamicTable {
private final Image editImage = ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/edit.png");
private final Image deleteImage = ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/delete.png");
private final SupplierService supplierService = new SupplierService();
private final BidPriceResultService bidPriceResultService = new BidPriceResultService();
private final EvaluationStepService evaluationStepService = new EvaluationStepService();
private String tenderId;
private String bidPriceId;
public BidPriceModifyTable(Composite parent) {
super(parent, SWTX.AUTO_SCROLL | SWT.FULL_SELECTION | SWTX.EDIT_ON_KEY | SWTX.FILL_WITH_LASTCOL);
}
private boolean editEnablePre(Object t) {
return Objects.nonNull(((BidPriceModifyVo) t).getId());
}
private boolean deleteEnablePre(Object t) {
return StringUtils.isNotEmpty(((BidPriceModifyVo) t).getModifyReason());
}
private void editActionRender(Object t) {
new ModifyBidPriceDialog(getShell(), tenderId, (BidPriceModifyVo) t, this::confirmAction).open();
}
private void deleteActionRender(Object t) {
if (!MessageDialog.openConfirm(getShell(), "重置将清空当前供应商修正后报价及修正原因,是否确认重置?")) {
return;
}
BidPriceModifyVo modifyBidPriceVo = (BidPriceModifyVo) t;
// if (!bidPriceResultService.modifyBidPrice(modifyBidPriceVo.getId(), modifyBidPriceVo.getBidPrice().getPrice(), "")) {
// MessageDialog.openError(getShell(), "重置失败!");
// return;
// }
modifyBidPriceVo.setFinalBidPrice(modifyBidPriceVo.getBidPrice());
modifyBidPriceVo.setModifyReason("");
redraw();
MessageDialog.openShortMessage("重置成功!");
}
public void refresh(String tenderId, String bidPriceId) {
this.tenderId = tenderId;
this.bidPriceId = bidPriceId;
refreshTable();
}
private void refreshTable() {
// if (!evaluationStepService.isCompletePriceAndRecommendStep(tenderId)) {
// addOperateCol(new OperateColVo("操作", "修正", editImage, this::editEnablePre, this::editActionRender));
// addOperateCol(new OperateColVo("操作", "重置", deleteImage, this::deleteEnablePre, this::deleteActionRender));
// }
List<BidPriceModifyVo> modifyBidPriceVoList = null;
List<Supplier> supplierList = supplierService.getOpenBidSuccessSupplier(tenderId);
if (CollectionUtils.isNotNull(supplierList)) {
modifyBidPriceVoList = supplierList.stream().map(getModifyBidPriceVoMapper()).collect(Collectors.toList());
}
super.refresh(modifyBidPriceVoList, BidPriceModifyVo.class);
}
private Function<Supplier, BidPriceModifyVo> getModifyBidPriceVoMapper() {
List<BidPriceResult> bidPriceResultList = bidPriceResultService.getBidPriceResultList(tenderId, bidPriceId);
if (CollectionUtils.isNull(bidPriceResultList)) {
return t -> new BidPriceModifyVo(t.getSupplierName(), null);
}
Map<String, BidPriceResult> bidPriceResultMap = bidPriceResultList.stream().collect(Collectors.toMap(BidPriceResult::getSupplierId, Function.identity()));
return t -> new BidPriceModifyVo(t.getSupplierName(), bidPriceResultMap.get(t.getId()));
}
private void confirmAction(BidPriceModifyVo vo) {
redraw();
}
}
package com.gx.obe.quote.test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class TestShell extends Shell {
/**
* Launch the application.
* @param args
*/
public static void main(String args[]) {
try {
Display display = Display.getDefault();
TestShell shell = new TestShell(display);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the shell.
* @param display
*/
public TestShell(Display display) {
super(display, SWT.SHELL_TRIM);
createContents();
}
/**
* Create contents of the shell.
*/
protected void createContents() {
setText("SWT Application");
setSize(450, 300);
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
package com.gx.obe.quote.utils;
import java.math.BigDecimal;
import java.util.Objects;
import java.util.Optional;
import com.gx.obe.web.entity.price.BidPriceResult;
public class BidPriceUtils {
public static BigDecimal getFinalBidPrice(BidPriceResult bidPriceResult) {
Objects.requireNonNull(bidPriceResult);
return Optional.of(bidPriceResult.getFinalBidPrice()).orElse(bidPriceResult.getBidPrice());
}
}
package com.gx.obe.quote.utils;
import java.util.function.Supplier;
import org.eclipse.swt.core.MessageDialog;
import org.eclipse.swt.widgets.Control;
public class VerificationUtils {
public static boolean ver(Control control, Supplier<Boolean> condition, String message) {
if (!condition.get()) return false;
MessageDialog.openWarning(control.getShell(), message);
control.setFocus();
return true;
}
}
package com.gx.obe.quote.vo;
import com.gx.obe.dynamicview.annotation.TableCol;
import com.gx.obe.dynamicview.enums.ColAlignEnum;
import com.gx.obe.quote.beans.AdjustStrategy;
import com.gx.obe.quote.calculator.AdjustStrategyCalculator;
import com.gx.obe.quote.converter.MoneyConverter;
public class AdjustStrategyVo {
@TableCol(value = "供应商名称", width = 200, minWidth = 200, maxWidth = 300, align = ColAlignEnum.LEFT)
private String supplierName;
@TableCol(value = "调整前报价(${evalPriceUnit})", type = MoneyConverter.class, align = ColAlignEnum.RIGHT)
private QuoteVo beforePrice;
@TableCol("调整详情")
private String describe;
@TableCol(value = "调整后报价(${evalPriceUnit})", type = MoneyConverter.class, align = ColAlignEnum.RIGHT)
private QuoteVo afterPrice;
@TableCol(value = "调整原因", width = 300, minWidth = 200, maxWidth = 400, align = ColAlignEnum.LEFT)
private String adjustReason;
private AdjustStrategy adjustStrategy;
public AdjustStrategyVo(String supplierName, QuoteVo beforePrice) {
super();
this.supplierName = supplierName;
this.beforePrice = beforePrice;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public QuoteVo getBeforePrice() {
return beforePrice;
}
public void setBeforePrice(QuoteVo beforePrice) {
this.beforePrice = beforePrice;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
public QuoteVo getAfterPrice() {
return afterPrice;
}
public void setAfterPrice(QuoteVo afterPrice) {
this.afterPrice = afterPrice;
}
public String getAdjustReason() {
return adjustReason;
}
public void setAdjustReason(String adjustReason) {
this.adjustReason = adjustReason;
}
public AdjustStrategy getAdjustStrategy() {
return adjustStrategy;
}
public void setAdjustStrategy(AdjustStrategy adjustStrategy) {
this.adjustStrategy = adjustStrategy;
}
public void setAdjustStrategy(AdjustStrategy adjustStrategy, String priceUnit) {
this.afterPrice = new QuoteVo(new AdjustStrategyCalculator(adjustStrategy).calculate(beforePrice.getPrice()), priceUnit);
this.describe = adjustStrategy.getDescribe(priceUnit);
this.adjustReason = adjustStrategy.getAdjustReason();
this.adjustStrategy = adjustStrategy;
}
}
package com.gx.obe.quote.vo;
import java.math.BigDecimal;
public class QuoteVo {
private BigDecimal price;
private String unit;
public QuoteVo(BigDecimal price, String unit) {
this.price = price;
this.unit = unit;
}
public BigDecimal getPrice() {
return price;
}
public String getUnit() {
return unit;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="/org.eclipse.swt.core/lib/de.kupzog.KTable.jar"/>
<classpathentry kind="lib" path="/org.eclipse.swt.core/lib/org.eclipse.nebula.widgets.grid.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.gx.obe.step.appraise</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding/<project>=UTF-8
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Appraise
Bundle-SymbolicName: com.gx.obe.step.appraise;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.gx.obe.step.appraise.Activator
Bundle-Vendor: GX
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.gx.obe.components.core,
org.eclipse.swt.core,
com.gx.obe.components.messages;bundle-version="1.0.0",
com.gx.obe.step,
com.gx.obe.business,
com.gx.obe.common.widget;bundle-version="1.0.0",
com.gx.obe.action;bundle-version="1.0.0",
com.gx.obe.lib;bundle-version="1.0.0",
com.gx.obe.common.icons;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: com.gx.obe.appraise
Bundle-ActivationPolicy: lazy
Export-Package: com.gx.obe.step.appraise.action,
com.gx.obe.step.appraise.builder,
com.gx.obe.step.appraise.dialog
This diff is collapsed.
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
javacDefaultEncoding.. = UTF-8
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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