5 changed files with 164 additions and 26 deletions
@ -0,0 +1,36 @@ |
|||||||
|
package apelet.association.plugin.active; |
||||||
|
|
||||||
|
import apelet.common.core.object.ObjectValue; |
||||||
|
import apelet.common.core.util.ApplicationContextHolder; |
||||||
|
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||||
|
import apelet.common.online.abstractplugin.ListPlugin; |
||||||
|
import apelet.common.online.model.constant.AttributeEnum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 活动编辑插件 |
||||||
|
*/ |
||||||
|
public class ActivityInfoUpdatePlugin extends ListPlugin { |
||||||
|
|
||||||
|
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||||
|
|
||||||
|
public ActivityInfoUpdatePlugin() { |
||||||
|
ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void formCreated(String widgetVariableName, ObjectValue objectValue) { |
||||||
|
setWidgetAttribute("id", AttributeEnum.SHOW, false); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void change(String widgetVariableName, ObjectValue objectValue) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue) { |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,69 @@ |
|||||||
|
package apelet.association.plugin.active; |
||||||
|
|
||||||
|
import apelet.common.core.object.ObjectCollection; |
||||||
|
import apelet.common.core.object.ObjectValue; |
||||||
|
import apelet.common.core.util.ApplicationContextHolder; |
||||||
|
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||||
|
import apelet.common.online.abstractplugin.ListPlugin; |
||||||
|
import apelet.common.online.model.ShowParameter; |
||||||
|
import apelet.common.online.model.constant.ShowTypeEnum; |
||||||
|
import apelet.common.online.model.constant.ViewStatus; |
||||||
|
import apelet.common.orm.impl.Filter; |
||||||
|
import apelet.common.orm.impl.FilterItem; |
||||||
|
import apelet.common.orm.impl.Selector; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 大赛活动列表 插件 |
||||||
|
*/ |
||||||
|
public class CompetitionActivitiesListPlugin extends ListPlugin { |
||||||
|
|
||||||
|
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||||
|
|
||||||
|
public CompetitionActivitiesListPlugin() { |
||||||
|
ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected Filter getFilter() { |
||||||
|
Filter filter = new Filter(); |
||||||
|
filter.add(new FilterItem("name", FilterItem.equals, "大赛")); |
||||||
|
ObjectCollection collection = ormGenDataSourceUtil.query("activity_tags", filter, new Selector()); |
||||||
|
Filter filter1 = new Filter(); |
||||||
|
if (collection != null && !collection.isEmpty()) { |
||||||
|
ObjectValue object = collection.getObject(0); |
||||||
|
String labelId = object != null && |
||||||
|
StringUtils.isNotEmpty(object.getString("id")) ? object.getString("id") : "0"; |
||||||
|
filter1.add(new FilterItem("label", FilterItem.equals, labelId)); |
||||||
|
}else{ |
||||||
|
filter1.add(new FilterItem("label", FilterItem.equals, -1)); |
||||||
|
} |
||||||
|
return filter1; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue) { |
||||||
|
if(widgetVariableName.equals("作品投稿")){ |
||||||
|
List<Map> rowDatas = getDto().getModel().getRowDatas(); |
||||||
|
if (rowDatas.size() != 1) { |
||||||
|
showWarningMessage("请选择一条数据!!!"); |
||||||
|
return; |
||||||
|
} |
||||||
|
ShowParameter showParameter = new ShowParameter(); |
||||||
|
showParameter.setFormId("2069357777217654784"); |
||||||
|
showParameter.setHowType(ShowTypeEnum.OPEN_ONLINE_MODAL); |
||||||
|
showParameter.setStatus(ViewStatus.EDIT); |
||||||
|
showParameter.setPkId(null); |
||||||
|
Map<String, Object> customParam = new HashMap<>(); |
||||||
|
customParam.put("id", rowDatas.get(0).get("id")); |
||||||
|
customParam.put("name", rowDatas.get(0).get("name")); |
||||||
|
showParameter.setCustomParam(customParam); |
||||||
|
super.showForm(showParameter); |
||||||
|
cancelOperate(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,51 @@ |
|||||||
|
package apelet.association.plugin.active; |
||||||
|
|
||||||
|
import apelet.common.core.object.ObjectValue; |
||||||
|
import apelet.common.core.util.ApplicationContextHolder; |
||||||
|
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||||
|
import apelet.common.online.abstractplugin.ListPlugin; |
||||||
|
import apelet.common.online.model.constant.AttributeEnum; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 作品投稿 编辑插件 |
||||||
|
*/ |
||||||
|
public class SubmissionWorksUpdatePlugin extends ListPlugin { |
||||||
|
|
||||||
|
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||||
|
|
||||||
|
public SubmissionWorksUpdatePlugin() { |
||||||
|
ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void formCreated(String widgetVariableName, ObjectValue objectValue) { |
||||||
|
Map eventParams = getDto().getEventParams(); |
||||||
|
if (eventParams != null && !eventParams.isEmpty()) { |
||||||
|
this.setWidgetAttribute("associationActivityId", AttributeEnum.VALUE_CHANGE, eventParams); |
||||||
|
} |
||||||
|
if(objectValue.get("id") != null){ |
||||||
|
this.setWidgetAttribute("id", AttributeEnum.SHOW,false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void change(String widgetVariableName, ObjectValue objectValue) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue) { |
||||||
|
if("保存".equals(widgetVariableName)){ |
||||||
|
int views = objectValue.getInt("views"); |
||||||
|
objectValue.put("views", ++views); |
||||||
|
try { |
||||||
|
ormGenDataSourceUtil.update(objectValue.getTableName(), objectValue, null); |
||||||
|
} catch (Exception e) { |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue