23 changed files with 559 additions and 109 deletions
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package apelet.tenantadmin.config; |
||||
|
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry; |
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
||||
|
||||
@Configuration |
||||
public class CorsConfig implements WebMvcConfigurer { |
||||
@Override |
||||
public void addCorsMappings(CorsRegistry registry) { |
||||
registry.addMapping("/**") |
||||
.allowedOrigins("*") // 允许所有源
|
||||
.allowedMethods("*") // 允许所有请求方法
|
||||
.allowedHeaders("*"); // 允许所有请求头
|
||||
} |
||||
} |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package apelet.association.config; |
||||
|
||||
import lombok.Data; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
@Configuration |
||||
@Data |
||||
public class FrontendConfig { |
||||
|
||||
// @Value("${frontend.address}")
|
||||
public String address; |
||||
|
||||
|
||||
} |
||||
|
||||
@ -0,0 +1,71 @@
@@ -0,0 +1,71 @@
|
||||
package apelet.association.controller; |
||||
|
||||
import apelet.common.core.object.ObjectCollection; |
||||
import apelet.common.core.object.ResponseResult; |
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.orm.impl.Filter; |
||||
import apelet.common.orm.impl.FilterItem; |
||||
import apelet.common.orm.impl.Selector; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.*; |
||||
import java.util.concurrent.atomic.AtomicInteger; |
||||
import java.util.stream.Collectors; |
||||
|
||||
|
||||
/** |
||||
* 课程管理 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/tenantadmin/home") |
||||
public class HomeController { |
||||
|
||||
@Autowired |
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
@PostMapping("/homeData") |
||||
public ResponseResult<?> homeData() { |
||||
HashMap<String, Integer> map = new HashMap<>(); |
||||
//报名审核
|
||||
map.put("ApplicationReview", 0); |
||||
|
||||
//会费逾期
|
||||
ObjectCollection feePay = ormGenDataSourceUtil.query("membership_fee_pay", new Filter(), new Selector()); |
||||
ArrayList<Map> objects = new ArrayList<>(); |
||||
for (int i = 0; i < feePay.size(); i++) { |
||||
objects.add(feePay.getObject(i).getValues()); |
||||
} |
||||
Map<Object, List<Map>> parentMap = objects.stream().collect(Collectors.groupingBy(m -> m.get("parent_id"))); |
||||
AtomicInteger OverdueMembershipFees = new AtomicInteger(); |
||||
parentMap.forEach((k, v) -> { |
||||
// 是否存在任意一条 end_time > 当前时间
|
||||
boolean anyAfterNow = v.stream() |
||||
.anyMatch(m2 -> { |
||||
Object endTimeObj = m2.get("end_time"); |
||||
if(endTimeObj == null){ |
||||
return false; |
||||
} |
||||
Date endTime = (Date) endTimeObj; |
||||
// end_time > 当前时间
|
||||
return endTime.after(new Date()); |
||||
}); |
||||
if(anyAfterNow){ |
||||
OverdueMembershipFees.getAndIncrement(); |
||||
} |
||||
|
||||
}); |
||||
map.put("OverdueMembershipFees", OverdueMembershipFees.get()); |
||||
|
||||
|
||||
// 入会申请
|
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem("billstatus", FilterItem.not_equals, "C")); |
||||
ObjectCollection membershipApply = ormGenDataSourceUtil.query("membership_apply", filter, new Selector()); |
||||
map.put("MembershipApplication", membershipApply.size()); |
||||
|
||||
return ResponseResult.success(map); |
||||
} |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,110 @@
@@ -0,0 +1,110 @@
|
||||
package apelet.association.plugin.active; |
||||
|
||||
import apelet.association.utils.MyFileUtil; |
||||
import apelet.association.utils.QRCodeUtil; |
||||
import apelet.common.core.exception.MyRuntimeException; |
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.core.upload.UploadResponseInfo; |
||||
import apelet.common.core.util.ApplicationContextHolder; |
||||
import apelet.common.core.util.RsaUtil; |
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.online.abstractplugin.ListPlugin; |
||||
import apelet.common.online.dto.OnlineEventPluginExecuteDto; |
||||
import apelet.common.online.model.OnlineDatasource; |
||||
import apelet.common.online.model.OnlineTable; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
import apelet.common.online.service.OnlineDatasourceService; |
||||
import apelet.common.online.service.OnlineTableService; |
||||
import apelet.common.orm.impl.FilterItem; |
||||
import apelet.common.orm.impl.Selector; |
||||
import apelet.common.orm.impl.SelectorItem; |
||||
import cn.hutool.core.bean.BeanUtil; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import org.apache.commons.io.FileUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 活动详情 |
||||
*/ |
||||
public class ActivityInfoDetailsPlugin extends ListPlugin { |
||||
|
||||
|
||||
private final OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
private final MyFileUtil myFileUtil; |
||||
private final QRCodeUtil qrCodeUtil; |
||||
private final OnlineDatasourceService onlineDatasourceService; |
||||
private final OnlineTableService onlineTableService; |
||||
|
||||
|
||||
public ActivityInfoDetailsPlugin() { |
||||
myFileUtil = ApplicationContextHolder.getBean(MyFileUtil.class); |
||||
qrCodeUtil = ApplicationContextHolder.getBean(QRCodeUtil.class); |
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||
onlineDatasourceService = ApplicationContextHolder.getBean(OnlineDatasourceService.class); |
||||
onlineTableService = ApplicationContextHolder.getBean(OnlineTableService.class); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void formCreated(String widgetVariableName, ObjectValue objectValue) { |
||||
this.setWidgetAttribute("id", AttributeEnum.SHOW, false); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void change(String widgetVariableName, ObjectValue objectValue) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue) { |
||||
if (widgetVariableName.equals("button1786587153460")) { |
||||
String registrationQr = objectValue.getString("registration_qr"); |
||||
if(StringUtils.isNotEmpty(registrationQr)){ |
||||
this.showErrorMessage("当前已存在报名二维码, 请勿重复生成!!!"); |
||||
return; |
||||
} |
||||
OnlineEventPluginExecuteDto dto = getDto(); |
||||
String savePath = System.getProperty("user.dir") + "\\zz-resource\\qrcode"; |
||||
File QRFile = null; |
||||
try { |
||||
OnlineDatasource onlineDatasource = onlineDatasourceService.getById(dto.getModel().getDatasourceId()); |
||||
OnlineTable table = onlineTableService.getOnlineTableFromCache(onlineDatasource.getMasterTableId()); |
||||
// 生成 报名二维码
|
||||
long id = objectValue.getLong("id"); |
||||
|
||||
String url = "http://58.48.135.5:8069" + "/#/?" + |
||||
"loginName=" + "admin" + |
||||
"&password=" + "123456" + |
||||
"&entryId=" + "2087413611113746432" + |
||||
"&bindType=" + "1" + |
||||
"&onlineFormId=" + "2087385700075835392" + |
||||
"&activeId=" + id; |
||||
|
||||
byte[] checkInQr = qrCodeUtil.generateQrCode(url, 350, 350); |
||||
QRFile = MyFileUtil.writeToFile(checkInQr, savePath, "qrcode-" + System.currentTimeMillis() + ".png"); |
||||
MultipartFile checkInMultipart = MyFileUtil.readFileAsMultipartFile(QRFile, "image/png"); |
||||
UploadResponseInfo registrationQR = myFileUtil.uploadMyFile(table, "registration_qr", true, checkInMultipart); |
||||
this.setWidgetAttribute("registrationQr", AttributeEnum.VALUE_CHANGE, registrationQR); |
||||
|
||||
objectValue.put("registration_qr", "["+new JSONObject(BeanUtil.beanToMap(registrationQR)).toJSONString()+"]"); |
||||
Selector selector = new Selector(); |
||||
selector.getList().add(new SelectorItem("registration_qr")); |
||||
ormGenDataSourceUtil.update(objectValue.getTableName(), objectValue, selector); |
||||
|
||||
} catch (Exception e) { |
||||
throw new MyRuntimeException(e.getMessage()); |
||||
} finally { |
||||
QRFile.delete(); |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package apelet.association.plugin.active; |
||||
|
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.online.plugin.EndOperationTransactionArgs; |
||||
import apelet.common.online.plugin.OperationServicePlugIn; |
||||
|
||||
public class ActivityRegistrationSavePlugin extends OperationServicePlugIn { |
||||
|
||||
|
||||
@Override |
||||
public void endOperationTransaction(EndOperationTransactionArgs e) { |
||||
ObjectValue objectValue = e.getModel(); |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,98 @@
@@ -0,0 +1,98 @@
|
||||
package apelet.association.plugin.active; |
||||
|
||||
import apelet.common.core.exception.MyRuntimeException; |
||||
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.dto.OnlineEventPluginExecuteDto; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
import apelet.common.online.plugin.EndOperationTransactionArgs; |
||||
import apelet.common.online.plugin.OperationServicePlugIn; |
||||
import apelet.common.orm.impl.Filter; |
||||
import apelet.common.orm.impl.FilterItem; |
||||
import apelet.common.orm.impl.Selector; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
|
||||
public class ActivityRegistrationUpdatePlugin extends ListPlugin { |
||||
|
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
public ActivityRegistrationUpdatePlugin() { |
||||
|
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||
} |
||||
|
||||
@Override |
||||
public void formCreated(String widgetVariableName, ObjectValue objectValue) { |
||||
|
||||
setWidgetAttribute("id", AttributeEnum.SHOW, false); |
||||
|
||||
JSONObject eventparams = JSONObject.parseObject(objectValue.getString("eventparams")); |
||||
JSONObject jsonObject = eventparams.getJSONObject("urlParams"); |
||||
String activeId = jsonObject.getString("activeId"); |
||||
if(activeId == null){ |
||||
throw new MyRuntimeException("活动id不能为空"); |
||||
} |
||||
ObjectValue active = ormGenDataSourceUtil.queryOne("association_activity", activeId); |
||||
|
||||
this.setWidgetAttribute("name", AttributeEnum.VALUE_CHANGE, active.get("name")); |
||||
this.setWidgetAttribute("startDate", AttributeEnum.VALUE_CHANGE, active.get("start_time")); |
||||
this.setWidgetAttribute("endDate", AttributeEnum.VALUE_CHANGE, active.get("end_time")); |
||||
|
||||
this.setWidgetAttribute("parentId", AttributeEnum.VALUE_CHANGE, active.get("id")); |
||||
this.setWidgetAttribute("parentId", AttributeEnum.SHOW, false); |
||||
|
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue) { |
||||
|
||||
String unitName = objectValue.getString("unit_name"); |
||||
String person = objectValue.getString("person"); |
||||
String phone = objectValue.getString("phone"); |
||||
String parentId = objectValue.getString("parent_id"); |
||||
|
||||
Filter filter1 = new Filter(); |
||||
filter1.add(new FilterItem("unit_name", FilterItem.equals, unitName)); |
||||
filter1.add(new FilterItem("person", FilterItem.equals, person)); |
||||
filter1.add(new FilterItem("phone", FilterItem.equals, phone)); |
||||
filter1.add(new FilterItem("parent_id", FilterItem.equals, parentId)); |
||||
ObjectCollection collection = ormGenDataSourceUtil.query("activity_register", filter1, new Selector()); |
||||
if(!collection.isEmpty()){ |
||||
this.showWarningMessage("当前单位联系人已报名成功, 请勿重复提交!!!"); |
||||
this.cancelOperate(); |
||||
return; |
||||
} |
||||
ObjectValue activityRegister = new ObjectValue("activity_register"); |
||||
activityRegister.put("unit_name", unitName); |
||||
activityRegister.put("person", person); |
||||
activityRegister.put("phone", phone); |
||||
activityRegister.put("parent_id", parentId); |
||||
|
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem("unit_name", FilterItem.equals, unitName)); |
||||
ObjectCollection membershipApplyList = ormGenDataSourceUtil.query("membership_apply", filter, new Selector()); |
||||
|
||||
filter = new Filter(); |
||||
filter.add(new FilterItem("name", FilterItem.equals, person)); |
||||
ObjectCollection expertManageList = ormGenDataSourceUtil.query("expert_manage", filter, new Selector()); |
||||
|
||||
if(membershipApplyList != null && !membershipApplyList.isEmpty()){ |
||||
ObjectValue object = membershipApplyList.getObject(0); |
||||
activityRegister.put("membership_apply_id", object); |
||||
}else if(expertManageList != null && !expertManageList.isEmpty()){ |
||||
ObjectValue object = expertManageList.getObject(0); |
||||
activityRegister.put("expert_manage_id", object); |
||||
} |
||||
try { |
||||
ormGenDataSourceUtil.addNew(activityRegister.getTableName(), activityRegister); |
||||
} catch (Exception e) { |
||||
throw new MyRuntimeException(e.getMessage()); |
||||
} |
||||
this.showMessage("保存成功"); |
||||
this.cancelOperate(); |
||||
} |
||||
} |
||||
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
package apelet.association.plugin.member; |
||||
|
||||
import apelet.common.core.exception.MyRuntimeException; |
||||
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.ExecutePluginParent; |
||||
import apelet.common.online.dto.OnlineEventPluginExecuteDto; |
||||
import apelet.common.online.model.ShowParameter; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
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 java.sql.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
|
||||
public class MembershipFeePayPlugin extends ExecutePluginParent { |
||||
|
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
public MembershipFeePayPlugin(){ |
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||
} |
||||
|
||||
@Override |
||||
public void formCreated(String widgetVariableName, ObjectValue objectValue) { |
||||
super.formCreated(widgetVariableName, objectValue); |
||||
OnlineEventPluginExecuteDto dto = getDto(); |
||||
Map eventParams = dto.getEventParams(); |
||||
if (eventParams != null) { |
||||
this.setWidgetAttribute("parentId", AttributeEnum.VALUE_CHANGE, eventParams.get("id")); |
||||
this.setWidgetAttribute("parentId", AttributeEnum.SHOW, false); |
||||
|
||||
this.setWidgetAttribute("membershipDate", AttributeEnum.VALUE_CHANGE, eventParams.get("create_time")); |
||||
this.setWidgetAttribute("membershipType", AttributeEnum.VALUE_CHANGE, eventParams.get("membership_type")); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue) { |
||||
if(widgetVariableName.equals("保存")){ |
||||
String parentId = objectValue.getString("parent_id"); |
||||
|
||||
Date startTime1= objectValue.getDate("membership_date"); |
||||
Date endTime1 = objectValue.getDate("end_time"); |
||||
|
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem("parent_id", FilterItem.equals, parentId)); |
||||
ObjectCollection collection = ormGenDataSourceUtil.query(objectValue.getTableName(), filter, new Selector()); |
||||
for (int i = 0; i < collection.size(); i++) { |
||||
ObjectValue object = collection.getObject(i); |
||||
|
||||
Date startTime2= object.getDate("membership_date"); |
||||
Date endTime2 = object.getDate("end_time"); |
||||
// 判断 startTime - endTime 和 startTime2 - endTime2 是否存在交集
|
||||
|
||||
if (startTime1.before(endTime2) && startTime2.before(endTime1)) { |
||||
// 存在交集,抛出异常
|
||||
throw new MyRuntimeException("会费已缴纳, 请勿重复缴纳!!!"); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
package apelet.association.task; |
||||
|
||||
|
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.orm.impl.Filter; |
||||
import apelet.msgnotice.service.SystemMessageService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.scheduling.annotation.Scheduled; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component |
||||
public class ContractPaymentReminderTask { |
||||
|
||||
// 提前 30 天提醒
|
||||
private static final int REMIND_BEFORE_DAYS = 7; |
||||
|
||||
@Autowired |
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
@Autowired |
||||
private SystemMessageService systemMessageService; |
||||
|
||||
@Scheduled(cron = "0 0 1 * * ?") |
||||
public void sendRemind() { |
||||
Filter filter = new Filter(); |
||||
|
||||
// ormGenDataSourceUtil.query("", )
|
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue