commit
This commit is contained in:
@@ -15,7 +15,7 @@ public class FlowFghzxAssignmentHandler implements AssignmentHandler {
|
||||
@Override
|
||||
public List<String> assign(TaskModel model, Execution execution) {
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
return List.of();
|
||||
return List.of("17a7f8ad3ee947b4a26175049a9c253d");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -78,17 +78,17 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
List<View_user> viewUsers = Daos.ext(dao(), fieldFilter).query(View_user.class, cnd);
|
||||
List<Sys_msg_user> list = new CopyOnWriteArrayList<>();
|
||||
for (View_user viewUser : viewUsers) {
|
||||
Sys_msg_user sys_msg_user = new Sys_msg_user();
|
||||
sys_msg_user.setId(R.UU32());
|
||||
sys_msg_user.setMsgId(sysMsg.getId());
|
||||
sys_msg_user.setStatus(0);
|
||||
sys_msg_user.setLoginname(viewUser.getLoginname());
|
||||
sys_msg_user.setUserName(viewUser.getUsername());
|
||||
sys_msg_user.setUnitId(viewUser.getUnitId());
|
||||
sys_msg_user.setUnitName(viewUser.getUnitName());
|
||||
sys_msg_user.setUnionId(viewUser.getUnionId());
|
||||
sys_msg_user.setUnionName(viewUser.getUnionName());
|
||||
list.add(sys_msg_user);
|
||||
Sys_msg_user sysMsgUser = new Sys_msg_user();
|
||||
sysMsgUser.setId(R.UU32());
|
||||
sysMsgUser.setMsgId(sysMsg.getId());
|
||||
sysMsgUser.setStatus(0);
|
||||
sysMsgUser.setLoginname(viewUser.getLoginname());
|
||||
sysMsgUser.setUserName(viewUser.getUsername());
|
||||
sysMsgUser.setUnitId(viewUser.getUnitId());
|
||||
sysMsgUser.setUnitName(viewUser.getUnitName());
|
||||
sysMsgUser.setUnionId(viewUser.getUnionId());
|
||||
sysMsgUser.setUnionName(viewUser.getUnionName());
|
||||
list.add(sysMsgUser);
|
||||
}
|
||||
dao().fastInsert(list);
|
||||
sysMsgUserService.clearCache();
|
||||
@@ -106,12 +106,13 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
// smsService.send(loginName, sysMsg.getTitle(), sysMsg.getNote());
|
||||
// }
|
||||
ThreadUtil.execute(() -> {
|
||||
smsService.massSend(loginNames, sysMsg.getTitle(), HtmlUtil.cleanHtmlTag(StrUtil.blankToDefault(sysMsg.getNote(),"")), sysMsg.getUrl());
|
||||
//smsService.massSend(loginNames, sysMsg.getTitle(), HtmlUtil.cleanHtmlTag(StrUtil.blankToDefault(sysMsg.getNote(),"")), sysMsg.getUrl());
|
||||
});
|
||||
|
||||
return sysMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void deleteMsg(String id) {
|
||||
this.delete(id);
|
||||
@@ -208,8 +209,10 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
public void innerMsg(String room, int size, List<NutMap> list) {
|
||||
NutMap map = new NutMap();
|
||||
map.put("action", "innerMsg");
|
||||
map.put("size", size);//未读消息数
|
||||
map.put("list", list);//最新5条消息列表 type--系统消息/用户消息 title--标题 time--时间戳
|
||||
//未读消息数
|
||||
map.put("size", size);
|
||||
//最新5条消息列表 type--系统消息/用户消息 title--标题 time--时间戳
|
||||
map.put("list", list);
|
||||
String msg = Json.toJson(map, JsonFormat.compact());
|
||||
log.debug("msg::::" + msg);
|
||||
if (jedisAgent.isClusterMode()) {
|
||||
|
||||
@@ -63,5 +63,8 @@ public class ActivityBasicSettings extends BaseModel implements Serializable {
|
||||
|
||||
private List<ActivityBasicSettings> child;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("服装项目")
|
||||
@Default("0")
|
||||
private Boolean clothing;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.zhgh.activity.family.constant;
|
||||
|
||||
import com.budwk.app.base.annotation.DictEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/11/18
|
||||
* @Description
|
||||
*/
|
||||
@Getter
|
||||
@DictEnum(key = "ColumnFormTypeEnum", name = "控件类型")
|
||||
@AllArgsConstructor
|
||||
public enum ColumnFormTypeEnum {
|
||||
|
||||
INPUT("INPUT", "输入框"),
|
||||
SELECT("SELECT", "选择框"),
|
||||
//RADIO("RADIO", "单选框"),//选项数组
|
||||
FILE("FILE", "文件");
|
||||
|
||||
private String code;
|
||||
private String description;
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyActivity;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyUser;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 新建活动
|
||||
* @createTime 2022年03月07日 10:16:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Api(tags = "新建亲子活动")
|
||||
@At("/platform/family/manage/activity")
|
||||
public class FamilyActivityAddController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FamilyActivityService familyActivityManageService;
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ApiOperation("亲子活动新增/修改")
|
||||
@SaCheckPermission("family.manage.activity")
|
||||
@SLog(type = "family", tag = "新增/修改活动", msg = "新增/修改活动")
|
||||
public Result doHandle(FamilyActivity activity) {
|
||||
if (StrUtil.isBlank(activity.getId())) {
|
||||
familyActivityManageService.add(activity, null);
|
||||
} else {
|
||||
familyActivityManageService.edit(activity);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ApiOperation("获取分工会人数限制")
|
||||
@SaCheckPermission("family.manage.activity")
|
||||
public Result getUnionLimit(@Param(value = "activityScopeId") String activityScopeId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.name,
|
||||
gh.unioncode,
|
||||
(select count(1) from `vw_user` where unionid = gh.id $cnd) as teacherCount,
|
||||
NULL as ratio,
|
||||
NULL as limitCount
|
||||
FROM
|
||||
sys_union gh
|
||||
order by gh.unioncode
|
||||
""");
|
||||
if (StrUtil.isNotBlank(activityScopeId)) {
|
||||
sql.setVar("cnd", "AND id in (select userId from activity_user_scope where groupId = '" + activityScopeId + "')");
|
||||
}
|
||||
List<NutMap> list = familyActivityManageService.listMap(sql);
|
||||
return Result.success().addData(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ApiOperation("获取报名人员数量")
|
||||
@SaCheckPermission("family.manage.activity")
|
||||
public Result getRegisterUserCount(@Param(value = "courseId") String courseId) {
|
||||
return Result.success().addData(dao.count(FamilyUser.class, Cnd.where("courseId", "=", courseId)));
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ApiOperation("获取历史活动列表")
|
||||
@SaCheckPermission("family.manage.activity")
|
||||
public Result getHistoricalActList() {
|
||||
List<FamilyActivity> query = dao.query(FamilyActivity.class, Cnd.NEW().desc("activityStartTime"));
|
||||
return Result.success().addData(query);
|
||||
}
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.family.models.*;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityService;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动报名")
|
||||
@At("/platform/family/manage/apply")
|
||||
public class FamilyActivityApplyController {
|
||||
|
||||
@Inject
|
||||
private FamilyActivityService familyActivityService;
|
||||
@Inject
|
||||
private SysDictService dictService;
|
||||
@Inject
|
||||
private FamilyActivityStatisticsService statisticsService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/apply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动查询")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
public Result activityData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("`year`", "=", year);
|
||||
//查询报名中
|
||||
if (activityType == 2) {
|
||||
cnd.and(new Static("now() > activitySignUpStartTime and now() < activitySignUpEndTime"));
|
||||
}//查询已结束的
|
||||
else if (activityType == 3) {
|
||||
cnd.and(new Static("now() > activityEndTime"));
|
||||
}
|
||||
|
||||
if (AuthUtil.hasRole("H04") && !AuthUtil.hasRoleOr("sysadmin, A06")) {
|
||||
cnd.and("activityMode", "=", 2).and("createdBy", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
Pagination pagination = familyActivityService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
List<FamilyActivity> familyActivities = pagination.getList();
|
||||
Map<String, String> familyTypeMap = dictService.getSubListByCode("FAMILY_SIGNUP_TYPE").stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
familyActivities.forEach(v -> v.setTrainType(familyTypeMap.get(v.getTrainType())));
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分活动查询")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "courseTypeId") String courseTypeId,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "assortTypes") String[] assortTypes) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.activityId,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseType,
|
||||
tsuc.courseLocationCoordinates,
|
||||
tsuc.courseReservedNumber,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.campus,
|
||||
tsuc.unionLimit,
|
||||
tsuc.isMobileSign,
|
||||
tsuc.signType,
|
||||
tsuc.isReceiveGift,
|
||||
tsuc.giftType,
|
||||
tsuc.reserveMode,
|
||||
tsuc.waitingNum,
|
||||
tsuc.assort,
|
||||
type.typeName,
|
||||
tsuc.courseIsLimitApply
|
||||
FROM
|
||||
`family_course` tsuc
|
||||
LEFT JOIN family_type type ON type.id = tsuc.courseType
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("type.id", "=", courseTypeId);
|
||||
cnd.and("tsuc.activityId", "=", activityId);
|
||||
if(Lang.isNotEmpty(assortTypes)) {
|
||||
cnd.and("tsuc.assort", "in", assortTypes);
|
||||
}
|
||||
|
||||
List<FamilyCourse> courseArray = familyActivityService.dao().query(FamilyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
courseArray = familyActivityService.filterCourseByHostUnion(courseArray);
|
||||
cnd.and("tsuc.id", "in", courseArray.stream().map(FamilyCourse::getId).toList());
|
||||
|
||||
cnd.asc("tsuc.orderNum");
|
||||
cnd.asc("type.code");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = familyActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
|
||||
courseList.forEach(c -> {
|
||||
c.put("hasRegisterNum", statisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
|
||||
c.put("hasWaitingNum", statisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
|
||||
//当前用户是否报过
|
||||
c.put("isSign", familyActivityService.isSignCourseByUser(c.getString("id"), SecurityUtil.getUserId()));
|
||||
|
||||
if(StrUtil.isNotBlank(c.getString("unionLimit"))) {
|
||||
List<NutMap> unionLimit = Json.fromJsonAsList(NutMap.class, c.getString("unionLimit"));
|
||||
if(Lang.isNotEmpty(unionLimit)) {
|
||||
NutMap nutMap = unionLimit.stream().filter(o -> o.getString("id").equals(SecurityUtil.getUnionId())).findFirst().orElse(null);
|
||||
if(nutMap != null) {
|
||||
c.put("coursePeopleNumber", nutMap.getInt("limitCount"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取分活动时间")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
public Result getCourseTime(String id) {
|
||||
List<FamilyActivityCourse> list = familyActivityService.dao().query(FamilyActivityCourse.class, Cnd.where("courseId", "=", id));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询分类标识集合")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
public Result queryCourseAssort(String activityId) {
|
||||
List<FamilyCourse> courseList = familyActivityService.dao().query(
|
||||
FamilyCourse.class,
|
||||
Cnd.where(FamilyCourse::getActivityId, "=", activityId).asc(FamilyCourse::getOrderNum)
|
||||
);
|
||||
if(Lang.isEmpty(courseList)) {
|
||||
return Result.success(new ArrayList<>());
|
||||
}
|
||||
List<String> assortList = courseList.stream().map(FamilyCourse::getAssort).filter(StrUtil::isNotBlank).toList();
|
||||
return Result.success(assortList);
|
||||
}
|
||||
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.zhgh.activity.family.models.*;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训报名 活动管理
|
||||
* @createTime 2022年02月23日 09:57:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动管理")
|
||||
@At("/platform/family/manage/activity")
|
||||
public class FamilyActivityController {
|
||||
|
||||
@Inject
|
||||
private FamilyActivityService familyActivityManageService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.manage.activity")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/manage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("family.manage.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityName") String activityName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
cnd.and(Cnd.likeEX("activityName", activityName));
|
||||
cnd.orderBy("createdAt", "desc");
|
||||
return Result.success().addData(familyActivityManageService.pageData(pageForm, cnd));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动删除")
|
||||
@SaCheckPermission("family.manage.activity")
|
||||
@SLog(type = "family", tag = "删除活动", msg = "删除活动")
|
||||
public Result onDelete(String id) {
|
||||
Trans.exec(() -> {
|
||||
familyActivityManageService.delete(id);
|
||||
dao.clear(FamilyCourse.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(FamilyActivityCourse.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(FamilyUser.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(FamilyUserCourse.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(FamilyActivity.class, Cnd.where("id", "=", id));
|
||||
dao.clear(FamilyTypeLimit.class, Cnd.where("activityId", "=", id));
|
||||
dao.delete(Sys_home_activity.class, id);
|
||||
});
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动状态变更")
|
||||
@SaCheckPermission("family.manage.activity")
|
||||
public Result activityStatusChange(FamilyActivity activity) {
|
||||
familyActivityManageService.updateActivityStatus(activity);
|
||||
dao.update(Sys_home_activity.class,
|
||||
Chain.make("enable", !activity.isDisabled()),
|
||||
Cnd.where("id", "=", activity.getId()));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询单个活动")
|
||||
@SaCheckPermission("family.manage.activity")
|
||||
public Result findOne(@Param("id") @NotNull String id) {
|
||||
NutMap dataMap = familyActivityManageService.findOne(id, null, "");
|
||||
String activityStartTime = dataMap.getString("activityStartTime");
|
||||
String activityEndTime = dataMap.getString("activityEndTime");
|
||||
if(StrUtil.isNotBlank(activityStartTime) && StrUtil.isNotBlank(activityEndTime)) {
|
||||
dataMap.put("activityTime", List.of(activityStartTime, activityEndTime));
|
||||
} else {
|
||||
dataMap.put("activityTime", new ArrayList<>());
|
||||
}
|
||||
|
||||
String activitySignUpStartTime = dataMap.getString("activitySignUpStartTime");
|
||||
String activitySignUpEndTime = dataMap.getString("activitySignUpEndTime");
|
||||
if(StrUtil.isNotBlank(activitySignUpStartTime) && StrUtil.isNotBlank(activitySignUpEndTime)) {
|
||||
dataMap.put("activitySignTime", List.of(activitySignUpStartTime, activitySignUpEndTime));
|
||||
} else {
|
||||
dataMap.put("activitySignTime", new ArrayList<>());
|
||||
}
|
||||
|
||||
List<NutMap> courseList = dataMap.getList("courseList", NutMap.class);
|
||||
|
||||
//查询所有的课程类型
|
||||
List<FamilyType> familyTypeList = dao.query(FamilyType.class, Cnd.NEW());
|
||||
Map<String, String> typeMap = familyTypeList.stream().collect(Collectors.toMap(FamilyType::getId, FamilyType::getTypeName));
|
||||
|
||||
courseList.forEach(v -> {
|
||||
|
||||
List<NutMap> courseTimeList = v.getList("courseTimeList", NutMap.class);
|
||||
//选择课程日期 下拉框
|
||||
List<String> setUpCourseData = courseTimeList.stream().map(cd -> cd.getString("courseDate")).distinct().collect(Collectors.toList());
|
||||
v.put("setUpCourseData", setUpCourseData);
|
||||
|
||||
courseTimeList.forEach(ct -> {
|
||||
String courseStartTime = DateUtil.format(ct.getTime("courseStartTime"), "HH:mm");
|
||||
String courseEndTime = DateUtil.format(ct.getTime("courseEndTime"), "HH:mm");
|
||||
ct.put("courseStartTime", courseStartTime);
|
||||
ct.put("courseEndTime", courseEndTime);
|
||||
});
|
||||
|
||||
v.put("courseTypeName", typeMap.get(v.getString("courseType")));
|
||||
});
|
||||
|
||||
return Result.success().addData(dataMap);
|
||||
}
|
||||
|
||||
}
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.annotation.ColType;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/9/22
|
||||
* @Description
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动类型管理")
|
||||
@At("/platform/family/manage/type")
|
||||
public class FamilyTypeController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/type/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "typeName") String typeName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
select * from family_type $condition
|
||||
""");
|
||||
if (Strings.isNotBlank(typeName)) {
|
||||
cnd.and("typeName", "like", "%" + typeName + "%");
|
||||
}
|
||||
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.asc("xh");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
Cnd c = Cnd.NEW();
|
||||
c.and("typeId", "=", item.getString("id"));
|
||||
c.asc("columnIndex");
|
||||
List<FamilyMobileSignColumn> signColumns = dao.query(FamilyMobileSignColumn.class, c);
|
||||
item.put("familyMobileSignColumnList", signColumns);
|
||||
|
||||
});
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型新增")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SLog(type = "family", tag = "活动类型新增", msg = "活动类型新增")
|
||||
public Result doAdd(@Param("data") String data) throws Exception {
|
||||
FamilyType type = Json.fromJson(FamilyType.class, data);
|
||||
int count = dao.count(FamilyType.class, Cnd.where("code", "=", type.getCode()));
|
||||
if (count > 0) {
|
||||
return Result.error("编码重复!");
|
||||
}
|
||||
int totalCount = dao.count(FamilyType.class);
|
||||
type.setXh(totalCount + 1);
|
||||
dao.insertWith(type, "familyMobileSignColumnList");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型修改")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SLog(type = "family", tag = "活动类型修改", msg = "活动类型修改")
|
||||
public Result doEdit(FamilyType type) {
|
||||
int count = dao.count(FamilyType.class, Cnd.where("code", "=", type.getCode()).and("id", "!=", type.getId()));
|
||||
if (count > 0) {
|
||||
return Result.error("编码重复!");
|
||||
}
|
||||
dao.update(type);
|
||||
dao.clear(FamilyMobileSignColumn.class, Cnd.where("typeId", "=", type.getId()));
|
||||
dao.insertLinks(type, "familyMobileSignColumnList");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型删除")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SLog(type = "family", tag = "活动类型删除", msg = "活动类型删除")
|
||||
public Object doDelete(@Param(value = "id") String id) {
|
||||
dao.clear(FamilyType.class, Cnd.where("id", "=", id));
|
||||
dao.clear(FamilyMobileSignColumn.class, Cnd.where("typeId", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("排序号变更")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
public Object xhChange(String id, Integer xh, boolean toDown) {
|
||||
if (toDown) {
|
||||
FamilyType next = dao.fetch(FamilyType.class, Cnd.where("xh", "=", xh + 1));
|
||||
next.setXh(next.getXh() - 1);
|
||||
dao.update(next);
|
||||
dao.update(FamilyType.class, Chain.make("xh", xh + 1), Cnd.where("id", "=", id));
|
||||
} else {
|
||||
FamilyType pre = dao.fetch(FamilyType.class, Cnd.where("xh", "=", xh - 1));
|
||||
pre.setXh(pre.getXh() + 1);
|
||||
dao.update(pre);
|
||||
dao.update(FamilyType.class, Chain.make("xh", xh - 1), Cnd.where("id", "=", id));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取所有类型")
|
||||
@SaCheckLogin
|
||||
public Result getAllType(@Param(value = "id") String id) {
|
||||
List<FamilyType> familyTypeList = dao.query(FamilyType.class, Cnd.NEW().andEX("id", "=", id).asc("xh"));
|
||||
dao.fetchLinks(familyTypeList, "familyMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
return Result.success().addData(familyTypeList);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("自定义表单字段类型")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
public Result getColumnType() {
|
||||
List<String> names = EnumUtil.getNames(ColType.class);
|
||||
names.add("JSON");
|
||||
return Result.success(names);
|
||||
}
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.family.models.*;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityService;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/9/21
|
||||
* @Description 人员调整
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "亲子活动人员调整")
|
||||
@At("/platform/family/manage/userAdjust")
|
||||
public class FamilyUserAdjustController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private FamilyActivityService familyActivityManageService;
|
||||
@Inject
|
||||
private FamilyActivityStatisticsService familyActivityStatisticsService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/userAdjust/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动list
|
||||
* @param year 年度
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("活动列表")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
public Result activityList(@Param(value = "year") Integer year) {
|
||||
List<FamilyActivity> activityList = dao.query(FamilyActivity.class, Cnd.NEW().andEX("year", "=", year).andEX("isDisabled", "=", false).desc("activityStartTime"));
|
||||
return Result.success(activityList);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Pagination pagination = familyActivityStatisticsService.pageData(pageForm, activityId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("子活动查询")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
public Result getCourse(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseType,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.courseReservedNumber,
|
||||
tsuc.waitingNum,
|
||||
tsuc.reserveMode
|
||||
FROM
|
||||
`family_course` tsuc
|
||||
WHERE
|
||||
tsuc.activityId = @activityId
|
||||
ORDER BY courseName asc
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
List<NutMap> courseList = baseService.listMap(sql);
|
||||
courseList.forEach(c -> {
|
||||
c.put("registerNum", familyActivityStatisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
|
||||
c.put("hasWaitingNum", familyActivityStatisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
|
||||
});
|
||||
return Result.success(courseList);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("报名用户列表")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
public Result registerUserList(@Param("courseId") String courseId,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "searchName") String searchName,
|
||||
@Param(value = "searchKeyword") String searchKeyword) {
|
||||
List<NutMap> list = familyActivityStatisticsService.registerUserList(courseId, unionId, unitId, searchName, searchKeyword);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("人员调整")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@SLog(type = "family", tag = "人员调整", msg = "人员调整")
|
||||
public Result adjust(String activityId, String oldCourseId, String newCourseId, String userId) {
|
||||
|
||||
Cnd oldCnd = Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", oldCourseId).and("userId", "=", userId);
|
||||
|
||||
Cnd newCnd = Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", newCourseId).and("userId", "=", userId);
|
||||
|
||||
//旧的报名信息
|
||||
FamilyUser oldfamilyUser = dao.fetch(FamilyUser.class, oldCnd);
|
||||
oldfamilyUser.setCourseId(newCourseId);
|
||||
oldfamilyUser.setSignUpTime(DateUtil.date());
|
||||
dao.update(oldfamilyUser);
|
||||
|
||||
//新的课程的信息,上课时间
|
||||
List<FamilyActivityCourse> activityCourseList = dao.query(FamilyActivityCourse.class, Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", newCourseId));
|
||||
//先清楚旧的信息
|
||||
dao.clear(FamilyUserCourse.class, oldCnd);
|
||||
//添加新的信息
|
||||
List<FamilyUserCourse> familyUserCourseList = new ArrayList<>();
|
||||
activityCourseList.forEach(item -> {
|
||||
FamilyUserCourse course = new FamilyUserCourse();
|
||||
course.setActivityCourseId(activityId);
|
||||
course.setCourseId(newCourseId);
|
||||
course.setUserId(userId);
|
||||
course.setCourseStartTime(item.getCourseStartTime());
|
||||
course.setCourseEndTime(item.getCourseEndTime());
|
||||
course.setActivityCourseId(item.getId());
|
||||
familyUserCourseList.add(course);
|
||||
});
|
||||
dao.insert(familyUserCourseList);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除报名人员")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@SLog(type = "family", tag = "删除报名人员", msg = "删除报名人员")
|
||||
public Result deleteSignUser(String activityId, String courseId, String userId) {
|
||||
|
||||
//删除
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("activityId", "=", activityId);
|
||||
cnd.and("courseId", "=", courseId);
|
||||
cnd.and("userId", "=", userId);
|
||||
|
||||
dao.clear(FamilyUser.class, cnd);
|
||||
dao.clear(FamilyUserCourse.class, cnd);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+349
@@ -0,0 +1,349 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.manage;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyActivity;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyCourse;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyUser;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyBlackListService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 人员管理
|
||||
* @createTime 2022年03月07日 14:27:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "亲子活动人员黑名单")
|
||||
@At("/platform/family/userManage")
|
||||
public class FamilyUserBlackListManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FamilyBlackListService familyBlackListService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/userManage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "courseId") String courseId,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "userKeyWord") String userKeyWord) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tsuu.activityId", "=", activityId);
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
cnd.andEX("act.year", "=", year);
|
||||
if (StrUtil.isNotBlank(userKeyWord)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
cnd.and(seg.andLike("u.username", userKeyWord).orLike("u.loginname", userKeyWord));
|
||||
}
|
||||
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
Pagination pagination = familyBlackListService.pageData(pageForm, cnd, activityId, courseId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("报名人员处理")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@SLog(type = "family", tag = "报名人员处理", msg = "报名人员处理")
|
||||
public Result doHandleUser(@Param("userId") String userId) {
|
||||
familyBlackListService.doHandleUser(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("根据活动Id获取子活动")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
public Result getCourseByActivityId(@Param("activityId") String activityId) {
|
||||
List<FamilyCourse> list = dao.query(FamilyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取子活动具体时间")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
public Result attendClassRecord(String userId) {
|
||||
familyBlackListService.attendClassRecord(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取候补人员")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
public Result getReserveUser(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.* ,
|
||||
(select signUpTime from family_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as signUpTime,
|
||||
(select state from family_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as state,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile,
|
||||
u.unitName,
|
||||
u.unionName
|
||||
FROM
|
||||
family_user_course uc LEFT JOIN `vw_user` u on uc.userId = u.id
|
||||
WHERE uc.courseId = @courseId and uc.isAttend = false HAVING state = 2 order by signUpTime desc
|
||||
""").setParam("courseId", courseId);
|
||||
return Result.success(familyBlackListService.listMap(sql));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("补充人员")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@SLog(type = "family", tag = "补充人员", msg = "补充人员")
|
||||
public Result reserveSingUp(String[] ids, String courseId) {
|
||||
//先查询这个课程有多少个未签到的人员
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.* ,
|
||||
(select signUpTime from family_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as signUpTime,
|
||||
(select state from family_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as state
|
||||
FROM
|
||||
family_user_course uc
|
||||
WHERE uc.courseId = @courseId and uc.isAttend = false HAVING state = 1 order by signUpTime desc
|
||||
""").setParam("courseId", courseId);
|
||||
List<NutMap> list = familyBlackListService.listMap(sql);
|
||||
if(ids.length > list.size()) {
|
||||
return Result.error("您选择了" + ids.length + "位,未签到人员只有" + list.size() + "位");
|
||||
}
|
||||
//ids的长度为几,就搞几个
|
||||
List<NutMap> mapList = list.subList(0, ids.length);
|
||||
List<String> idList = mapList.stream().map(o -> o.getString("userId")).collect(Collectors.toList());
|
||||
//将这几个没签到的设置为4
|
||||
dao.update(FamilyUser.class, Chain.make("state", 4), Cnd.where("courseId", "=", courseId)
|
||||
.and("userId", "in", idList));
|
||||
//将补充的设置为1
|
||||
dao.update(FamilyUser.class, Chain.make("state", 1), Cnd.where("courseId", "=", courseId)
|
||||
.and("userId", "in", ids));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出签到人员")
|
||||
public void exportSignPerson(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) {
|
||||
FamilyActivity activity = dao.fetch(FamilyActivity.class, activityId);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.*,
|
||||
DATE_FORMAT(uc.courseStartTime, '%Y-%m-%d %H:%i:%s') as courseStartTimeExcel,
|
||||
DATE_FORMAT(uc.courseEndTime, '%Y-%m-%d %H:%i:%s') as courseEndTimeExcel,
|
||||
DATE_FORMAT(uc.attendTime, '%Y-%m-%d %H:%i:%s') as attendTimeExcel,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
u.sex
|
||||
FROM
|
||||
family_user_course uc
|
||||
left join family_course course on uc.courseId = course.id
|
||||
left join `vw_user` u on u.id = uc.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("uc.activityId", "=", activityId);
|
||||
cnd.and("course.isMobileSign", "=", true);
|
||||
cnd.desc("isAttend").desc("attendTime");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> userList = familyBlackListService.listMap(sql);
|
||||
|
||||
List<FamilyCourse> courseList = dao.query(FamilyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("开始时间", "courseStartTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("结束时间", "courseEndTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("是否签到", "isAttend", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("签到时间", "attendTimeExcel", 22));
|
||||
|
||||
for (FamilyCourse c : courseList) {
|
||||
String courseId = c.getId();
|
||||
String courseName = c.getCourseName();
|
||||
List<NutMap> v = userList.stream().filter(x -> x.getString("courseId").equals(courseId)).collect(Collectors.toList());
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setSheetName(courseName);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>(excelCommonExportEntity);
|
||||
for (NutMap userSignData : v) {
|
||||
if(!userSignData.getBoolean("isAttend")) {
|
||||
userSignData.put("isAttend", "未签到");
|
||||
userSignData.put("attendTimeExcel", "未签到");
|
||||
}else {
|
||||
userSignData.put("isAttend", "已签到");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> userExportMap = new HashMap<>();
|
||||
userExportMap.put("name", courseName);
|
||||
userExportMap.put("title", userExportParams);
|
||||
userExportMap.put("entity", currentEntities);
|
||||
userExportMap.put("data", v);
|
||||
|
||||
sheetsList.add(userExportMap);
|
||||
}
|
||||
try {
|
||||
String fileName = activity.getActivityName() + "签到人员名单.xls";
|
||||
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", disposition);
|
||||
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
for (Map<String, Object> map : sheetsList) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
service.createSheetForMap(workbook,(ExportParams) map.get("title"),(List<ExcelExportEntity>) map.get("entity"),(Collection<?>) map.get("data"));
|
||||
}
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出领取人员")
|
||||
public void exportGiftPerson(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) {
|
||||
FamilyActivity activity = dao.fetch(FamilyActivity.class, activityId);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.*,
|
||||
DATE_FORMAT(uc.courseStartTime, '%Y-%m-%d %H:%i:%s') as courseStartTimeExcel,
|
||||
DATE_FORMAT(uc.courseEndTime, '%Y-%m-%d %H:%i:%s') as courseEndTimeExcel,
|
||||
DATE_FORMAT(uc.receiveTime, '%Y-%m-%d %H:%i:%s') as receiveTimeExcel,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
u.sex
|
||||
FROM
|
||||
family_user_course uc
|
||||
left join family_course course on uc.courseId = course.id
|
||||
left join `vw_user` u on u.id = uc.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("uc.activityId", "=", activityId);
|
||||
cnd.and("course.isReceiveGift", "=", true).and("course.giftType" ,"=", 1);
|
||||
cnd.desc("isReceive").desc("receiveTime");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> userList = familyBlackListService.listMap(sql);
|
||||
|
||||
List<FamilyCourse> courseList = dao.query(FamilyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("开始时间", "courseStartTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("结束时间", "courseEndTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("是否领取", "isReceive", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("领取时间", "receiveTimeExcel", 22));
|
||||
|
||||
for (FamilyCourse c : courseList) {
|
||||
String courseId = c.getId();
|
||||
String courseName = c.getCourseName();
|
||||
List<NutMap> v = userList.stream().filter(x -> x.getString("courseId").equals(courseId)).collect(Collectors.toList());
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setSheetName(courseName);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>(excelCommonExportEntity);
|
||||
for (NutMap userSignData : v) {
|
||||
if(!userSignData.getBoolean("isReceive")) {
|
||||
userSignData.put("isReceive", "未领取");
|
||||
userSignData.put("receiveTimeExcel", "未领取");
|
||||
}else {
|
||||
userSignData.put("isReceive", "已领取");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> userExportMap = new HashMap<>();
|
||||
userExportMap.put("name", courseName);
|
||||
userExportMap.put("title", userExportParams);
|
||||
userExportMap.put("entity", currentEntities);
|
||||
userExportMap.put("data", v);
|
||||
|
||||
sheetsList.add(userExportMap);
|
||||
}
|
||||
try {
|
||||
String fileName = activity.getActivityName() + "礼品领取人员名单.xls";
|
||||
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", disposition);
|
||||
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
for (Map<String, Object> map : sheetsList) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
service.createSheetForMap(workbook,(ExportParams) map.get("title"),(List<ExcelExportEntity>) map.get("entity"),(Collection<?>) map.get("data"));
|
||||
}
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+368
@@ -0,0 +1,368 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.mobile;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import com.budwk.app.zhgh.activity.family.models.*;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年02月25日 13:44:00
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "亲子活动移动端")
|
||||
@At("/platform/mobile/familyActivity")
|
||||
public class MFamilyActivityController {
|
||||
|
||||
private static final String REDIS_KEY_PREFIX = "m_family_activity";
|
||||
private final ReentrantLock lock = new ReentrantLock(true);
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FamilyActivityService familyActivityService;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
|
||||
@At("/familyList")
|
||||
@Ok("beetl:/platform/zhghh5/activity/family/familyList/index.html")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
public void familyList() {
|
||||
}
|
||||
|
||||
@At("/familyInfo")
|
||||
@Ok("beetl:/platform/zhghh5/activity/family/familyInfo/index.html")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
public void familyInfo() {
|
||||
}
|
||||
|
||||
@At("/activityInfo")
|
||||
@Ok("beetl:/platform/zhghh5/activity/family/activityInfo/index.html")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
public void activityInfo() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityStatus") int activityStatus,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType) {
|
||||
Pagination pagination = familyActivityService.mPageData(pageForm, year, activityStatus, activityType);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id 活动id
|
||||
* @param tabIndex 0全部 1我的
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("查询单个活动")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
public Result findOne(@Param("id") String id,
|
||||
@Param(value = "tabIndex") Integer tabIndex,
|
||||
@Param(value = "fromMode") String fromMode) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (tabIndex > 0) {
|
||||
List<FamilyUser> mySignCourseList = dao.query(FamilyUser.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("activityId", "=", id));
|
||||
List<String> mySignCourseIdList = mySignCourseList.stream().map(FamilyUser::getCourseId).collect(Collectors.toList());
|
||||
cnd.and("id", "in", mySignCourseIdList);
|
||||
}
|
||||
NutMap nutMap = familyActivityService.findOne(id, cnd, fromMode);
|
||||
List<FamilyCourse> courseList = nutMap.getAsList("courseList", FamilyCourse.class);
|
||||
courseList.forEach(v -> {
|
||||
if (v.getCourseIsLimitApply() != null && v.getCourseIsLimitApply() && v.getIsSign()) {
|
||||
FamilyActivityCourse course = dao.fetch(FamilyActivityCourse.class, Cnd.where("courseId", "=", v.getId()));
|
||||
v.setCourseTimeName(DateUtil.format(course.getCourseStartTime(), "HH:mm") + "至" + DateUtil.format(course.getCourseEndTime(), "HH:mm") + "段");
|
||||
}
|
||||
});
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询子活动时间段")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
public Object getCourseTimeSelectList(String courseId) {
|
||||
// 查课程的时间段
|
||||
List<FamilyActivityCourse> courseList = dao.query(FamilyActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
|
||||
// 查课程的报名人数
|
||||
List<FamilyUserCourse> applyUserList = dao.query(FamilyUserCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
// 按照课程下面时间段去分组
|
||||
Map<String, List<FamilyUserCourse>> collectMap = applyUserList.stream().collect(Collectors.groupingBy(FamilyUserCourse::getActivityCourseId));
|
||||
List<NutMap> list = courseList.stream().map(v -> {
|
||||
String id = v.getId();
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
List<FamilyUserCourse> familyUserCourses = collectMap.get(id);
|
||||
int remainingNum = v.getCourseLimitNum();
|
||||
if (Lang.isNotEmpty(familyUserCourses)) {
|
||||
remainingNum = v.getCourseLimitNum() - familyUserCourses.size();
|
||||
}
|
||||
nutMap.put("remainingNum", remainingNum);
|
||||
nutMap.put("text", DateUtil.format(v.getCourseStartTime(), "HH:mm") + "至" + DateUtil.format(v.getCourseEndTime(), "HH:mm") + "段(剩" + remainingNum + ")");
|
||||
nutMap.put("value", id);
|
||||
return nutMap;
|
||||
}).filter(v -> v.getInt("remainingNum") != 0).toList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报名")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
@SLog(type = "family", tag = "活动报名", msg = "活动报名")
|
||||
public Result doSignUp(FamilyUser familyUser) {
|
||||
try {
|
||||
lock.lock();
|
||||
boolean courseByUser = familyActivityService.isSignCourseByUser(familyUser.getCourseId(), SecurityUtil.getUserId());
|
||||
if(courseByUser) {
|
||||
return Result.error("您已报过该活动");
|
||||
}
|
||||
//判断人数
|
||||
int number = 0;
|
||||
FamilyCourse course = familyActivityService.dao().fetch(FamilyCourse.class, familyUser.getCourseId());
|
||||
FamilyType type = familyActivityService.dao().fetch(FamilyType.class, course.getCourseType());
|
||||
if(type != null) {
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<List<NutMap>> mobileColumnsValue = familyUser.getMobileColumnsValue();
|
||||
number = Lang.isNotEmpty(mobileColumnsValue) ? mobileColumnsValue.size() : 0;
|
||||
}
|
||||
}
|
||||
boolean signFull = familyActivityService.isSignFull(course, number);
|
||||
if(signFull) {
|
||||
return Result.error("当前报名人数已满");
|
||||
}
|
||||
boolean signFullByUnionId = familyActivityService.isSignFullByUnionId(course, number);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error("该活动您所在的分工会名额不足");
|
||||
}
|
||||
familyActivityService.doSignUp(familyUser);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.success("报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("取消报名")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
@SLog(type = "family", tag = "取消报名", msg = "取消报名")
|
||||
public Result cancelSignUp(@Param("activityId") String activityId, @Param("courseId") String courseId) {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
//取消分两种情况
|
||||
//第一种没有设置分工会人数限制,那么将候补的人按时间倒叙往上补
|
||||
//第二种如果设置了分工会人数限制,那么只将本分工会的候补人员按照时间倒叙往上补,如果本分工会没有候补人员,则名额空出来,由校工会手动调整
|
||||
FamilyActivity activity = dao.fetch(FamilyActivity.class, activityId);
|
||||
FamilyCourse course = dao.fetch(FamilyCourse.class, courseId);
|
||||
FamilyType type = dao.fetch(FamilyType.class, course.getCourseType());
|
||||
//如果是正常报名取消了,将候补报名的按时间倒叙第一个改为正常报名
|
||||
Cnd cnd = Cnd.where("activityId", "=", activityId).and("courseId", "=", courseId)
|
||||
.and("state", "=", 2);
|
||||
//如果设置了分工会报名人数限制,则只查本分工会
|
||||
if (Lang.isNotEmpty(course.getUnionLimit())) {
|
||||
cnd.and(new Static(" userId in (select id from user where unionid = '%s')".formatted(SecurityUtil.getUnionId())));
|
||||
}
|
||||
cnd.asc("signUpTime");
|
||||
if (!type.getIsBringFamily() && course.getReserveMode() == 2) {
|
||||
List<FamilyUser> signUpUsers = dao.query(FamilyUser.class, cnd);
|
||||
int thisSignUpUserCount = dao.count(FamilyUser.class,
|
||||
Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId)
|
||||
.and("state", "in", List.of(1, 3)));
|
||||
if (!signUpUsers.isEmpty() && thisSignUpUserCount > 0) {
|
||||
FamilyUser familyUser = signUpUsers.get(0);
|
||||
familyUser.setState(1);
|
||||
dao.update(familyUser);
|
||||
Sys_user user = dao.fetch(Sys_user.class, familyUser.getUserId());
|
||||
//msgApi.sendTextMsg("【" + activity.getActivityName() + "】已候补成功,请按时参加活动!", user.getLoginname());
|
||||
}
|
||||
}
|
||||
//删除报名记录
|
||||
dao.clear("family_user_course", Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId));
|
||||
|
||||
dao.clear("family_user", Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("签到")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
@SLog(type = "family", tag = "签到", msg = "签到")
|
||||
public Result doQd(@Param("id") String id, @Param("courseId") String courseId, @Param("point") Double[] points) {
|
||||
FamilyCourse course = dao.fetch(FamilyCourse.class, courseId);
|
||||
List<Double> coursePoints = course.getCourseLocationCoordinates();
|
||||
// if (Lang.isNotEmpty(coursePoints)) {
|
||||
// //需要签到
|
||||
// if (ArrayUtil.isEmpty(points) || ArrayUtil.hasNull(points)) {
|
||||
// return Result.error().addMsg("请获取当前的坐标信息");
|
||||
// }
|
||||
// Double[] coursePointArray = coursePoints.toArray(new Double[]{});
|
||||
// float distance = AMapUtils.calculateLineDistance(new LatLng(points[0], points[1]), new LatLng(coursePointArray[0], coursePointArray[1]));
|
||||
//
|
||||
// if (distance > 500) {
|
||||
// return Result.error().addMsg("请到签到点位附近签到");
|
||||
// }
|
||||
// }
|
||||
familyActivityService.doQd(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到信息
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("获取签到信息")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
public Result getQdInfoList(@Param("activityId") String activityId) {
|
||||
List<NutMap> list = familyActivityService.qdInfoByUserId(SecurityUtil.getUserId(), activityId);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("验证是否能报名")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
public Result validateSignUp(String courseId,
|
||||
@Param(value = "currentFamilyNumber") Integer currentFamilyNumber) {
|
||||
try {
|
||||
lock.lock();
|
||||
if(StrUtil.isBlank(courseId)) {
|
||||
return Result.error("报名信息为空");
|
||||
}
|
||||
|
||||
currentFamilyNumber = currentFamilyNumber != null ? currentFamilyNumber : 0;
|
||||
FamilyCourse course = dao.fetch(FamilyCourse.class, courseId);
|
||||
FamilyActivity activity = dao.fetch(FamilyActivity.class, course.getActivityId());
|
||||
|
||||
//判断时间
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpStartTime(), "yyyy-MM-dd HH:mm:ss") < 0) {
|
||||
return Result.error("报名未开始");
|
||||
}
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpEndTime(), "yyyy-MM-dd HH:mm:ss") > 0) {
|
||||
return Result.error("报名已结束");
|
||||
}
|
||||
|
||||
//判断活动组别
|
||||
int count = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", activity.getActivityGroupId()).and("userId", "=", SecurityUtil.getUserId()));
|
||||
if(count == 0) {
|
||||
return Result.error("抱歉,您没有此次活动的权限");
|
||||
}
|
||||
|
||||
//判断是否报名
|
||||
boolean courseByUser = familyActivityService.isSignCourseByUser(courseId, SecurityUtil.getUserId());
|
||||
if(courseByUser) {
|
||||
return Result.error("抱歉,您已经报名");
|
||||
}
|
||||
|
||||
//判断活动人数
|
||||
boolean signFull = familyActivityService.isSignFull(course, currentFamilyNumber);
|
||||
if(signFull) {
|
||||
return Result.error("名额剩余数量不足");
|
||||
}
|
||||
|
||||
//判断活动限制
|
||||
boolean signCourse = familyActivityService.isSignCourse(course, activity);
|
||||
if(!signCourse) {
|
||||
if(activity.getRestrictLimit() != 3) {
|
||||
return Result.error("您选择的类型已达上限,不能再报该类型的了");
|
||||
} else {
|
||||
return Result.error(activity.getActivityName() + "限制报" + activity.getLimitNum() + "个活动,已达上限");
|
||||
}
|
||||
}
|
||||
|
||||
//判断分工会人数限制
|
||||
boolean signFullByUnionId = familyActivityService.isSignFullByUnionId(course, currentFamilyNumber);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error("您所在的分工会名额不足");
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("验证子活动是否能报名")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
public Object validateSourceSignUp(String activityCourseId) {
|
||||
try {
|
||||
lock.lock();
|
||||
// 该时间段下已报名的人数
|
||||
int count = dao.count(FamilyUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId));
|
||||
// 获取改时间段下的活动课程限制报名人数
|
||||
FamilyActivityCourse course = dao.fetch(FamilyActivityCourse.class, activityCourseId);
|
||||
Integer courseLimitNum = course.getCourseLimitNum();
|
||||
// 报名加上自己,如果大于了限制人数,那就无法报名
|
||||
if (count + 1 > courseLimitNum) {
|
||||
return Result.error("该时间段名额已报满,请选择其他时段报名");
|
||||
} else {
|
||||
return Result.success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("二维码签到")
|
||||
@SaCheckPermission("h5.family.sign")
|
||||
@SLog(type = "family", tag = "二维码签到", msg = "二维码签到")
|
||||
public Result codeSign(String id, String codeCourseId, String clickCourseId) {
|
||||
if(StrUtil.isBlank(codeCourseId) || StrUtil.isBlank(clickCourseId)) {
|
||||
return Result.error("签到失败,没有获取到扫描信息");
|
||||
}
|
||||
if(!codeCourseId.equals(clickCourseId)) {
|
||||
return Result.error("签到失败,二维码与您当前签到信息不符");
|
||||
}
|
||||
dao.update(FamilyUserCourse.class, Chain.make("isAttend", true)
|
||||
.add("attendTime", new Date()), Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.mobile;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* 品牌活动扫码
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/mobile/familyActivityScannerQrCode")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MFamilyActivityScannerQrCodeController {
|
||||
|
||||
/*@Inject
|
||||
private WxTokenUtil;
|
||||
|
||||
@Inject
|
||||
private familyActivityService familyActivityService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/scannerQrCode.html")
|
||||
public void scannerQrCode() {
|
||||
|
||||
}
|
||||
|
||||
*//**
|
||||
* 微信js验证
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*//*
|
||||
@At("/auth/sign")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object wxAuthSign(String url) {
|
||||
String jsapi_ticket = wxTokenUtil.jsTicket();
|
||||
return sign(jsapi_ticket, url);
|
||||
}
|
||||
|
||||
*//**
|
||||
* 二维码信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param signId 签到记录id
|
||||
* @param activityId 活动id
|
||||
* @return
|
||||
*//*
|
||||
@At("/qrCodeInfo")
|
||||
@RequiresAuthentication
|
||||
public Object qrCodeInfo(@Param("userId") String userId, @Param("signId") String signId, @Param("activityId") String activityId) {
|
||||
if (StrUtil.isBlank(userId) || StrUtil.isBlank(signId) || StrUtil.isBlank(activityId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
try {
|
||||
// Sql activitySql = Sqls.create("select activityName,cover from family_activity where id = @activityId");
|
||||
// activitySql.setParam("activityId",activityId);
|
||||
// NutMap activityMap = (NutMap) Daos.query(dao, activitySql.toString(), Sqls.callback.map());
|
||||
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from family_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap attendInfo = (NutMap) Daos.query(dao, signSql.toString(), Sqls.callback.map());
|
||||
Sql userSql = Sqls.create("select id,username,loginname,unitname,unionname,sex from `user` where id = @userId");
|
||||
userSql.setParam("userId", userId);
|
||||
NutMap userMap = (NutMap) Daos.query(dao, userSql.toString(), Sqls.callback.map());
|
||||
return Result.success(Map.of("signInfo", attendInfo, "userInfo", userMap));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("获取信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
@At("/signInfo")
|
||||
@RequiresAuthentication
|
||||
public Object signInfo(@Param("signId") String signId) {
|
||||
if (StrUtil.isBlank(signId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
try {
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime from family_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap signInfo = familyActivityService.fetch(signSql);
|
||||
return Result.success(signInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("获取信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* 发放礼品
|
||||
*
|
||||
* @param signId
|
||||
* @return
|
||||
*//*
|
||||
@At("/grantGiftByQrCode")
|
||||
@RequiresAuthentication
|
||||
public Object grantGiftByQrCode(@Param("signId") String signId) {
|
||||
if (StrUtil.isBlank(signId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
try {
|
||||
Chain chain = Chain.make("isReceive", 1);
|
||||
chain.add("receiveTime", new Date());
|
||||
chain.add("giftScannerCodeUserId", ShiroUtil.getPrincipalProperty("id"));
|
||||
dao.update(familyUserCourse.class, chain, Cnd.where("id", "=", signId));
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from family_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap signInfo = familyActivityService.fetch(signSql);
|
||||
return Result.success(signInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("获取信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* 二维码扫描确认签到
|
||||
*
|
||||
* @param signId
|
||||
* @return
|
||||
*//*
|
||||
@At("/confirmSignByQrCode")
|
||||
@RequiresAuthentication
|
||||
public Object confirmSignByQrCode(@Param("signId") String signId) {
|
||||
if (StrUtil.isBlank(signId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
try {
|
||||
Chain chain = Chain.make("isAttend", 1);
|
||||
chain.add("attendTime", new Date());
|
||||
chain.add("signScannerCodeUserId", ShiroUtil.getPrincipalProperty("id"));
|
||||
dao.update(familyUserCourse.class, chain, Cnd.where("id", "=", signId));
|
||||
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from family_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap signInfo = familyActivityService.fetch(signSql);
|
||||
return Result.success(signInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("获取信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, String> sign(String jsapi_ticket, String url) {
|
||||
Map<String, String> ret = new HashMap<String, String>();
|
||||
String nonce_str = create_nonce_str();
|
||||
String timestamp = create_timestamp();
|
||||
String string1;
|
||||
String signature = "";
|
||||
|
||||
//注意这里参数名必须全部小写,且必须有序
|
||||
string1 = "jsapi_ticket=" + jsapi_ticket +
|
||||
"&noncestr=" + nonce_str +
|
||||
"×tamp=" + timestamp +
|
||||
"&url=" + url;
|
||||
System.out.println(string1);
|
||||
|
||||
try {
|
||||
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
|
||||
crypt.reset();
|
||||
crypt.update(string1.getBytes("UTF-8"));
|
||||
signature = byteToHex(crypt.digest());
|
||||
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ret.put("url", url);
|
||||
ret.put("jsapi_ticket", jsapi_ticket);
|
||||
ret.put("nonceStr", nonce_str);
|
||||
ret.put("timestamp", timestamp);
|
||||
ret.put("signature", signature);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static String byteToHex(final byte[] hash) {
|
||||
Formatter formatter = new Formatter();
|
||||
for (byte b : hash) {
|
||||
formatter.format("%02x", b);
|
||||
}
|
||||
String result = formatter.toString();
|
||||
formatter.close();
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String create_nonce_str() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
private static String create_timestamp() {
|
||||
return Long.toString(System.currentTimeMillis() / 1000);
|
||||
}*/
|
||||
|
||||
}
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.statistics;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import com.budwk.app.sys.utils.SysFileMinIoUtil;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyActivity;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyCourse;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyType;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityService;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityStatisticsService;
|
||||
import io.minio.GetObjectArgs;
|
||||
import io.minio.MinioClient;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Streams;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训报名 统计
|
||||
* @createTime 2022年02月23日 09:57:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "亲子活动统计")
|
||||
@At("/platform/family/statistics/activity")
|
||||
public class FamilyActivityStatisticsController {
|
||||
|
||||
@Inject
|
||||
private FamilyActivityService familyActivityManageService;
|
||||
@Inject
|
||||
private FamilyActivityStatisticsService familyActivityStatisticsService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/statistics/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Pagination pagination = familyActivityStatisticsService.pageData(pageForm, activityId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动list
|
||||
*
|
||||
* @param year 年度
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("活动列表")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
public Result activityList(@Param(value = "year") Integer year) {
|
||||
List<FamilyActivity> list = dao.query(FamilyActivity.class, Cnd.NEW().andEX("year", "=", year).desc("activityStartTime"));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班报名人员list
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("报名人员列表")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
public Result registerUserList(@Param(value = "courseId") String courseId) {
|
||||
return Result.success(familyActivityStatisticsService.registerUserList(courseId));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("报名动态列")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
public Object getTaleColumnInfo(@Param(value = "courseId") String courseId) {
|
||||
return Result.success(familyActivityStatisticsService.getTaleColumnInfo(courseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班上课签到信息
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("获取签到信息")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
public Result getSignInfo(@Param("courseId") String courseId) {
|
||||
return Result.success(familyActivityStatisticsService.getSignInfo(courseId));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("开放报名")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
public Result signChange(@Param("courseId") String courseId, @Param("openOtherUnion") Boolean openOtherUnion) {
|
||||
dao.update(FamilyCourse.class, Chain.make("openOtherUnion", openOtherUnion)
|
||||
, Cnd.where("id", "=", courseId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出签到名单")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
public void exportSignUser(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
FamilyActivity activity = dao.fetch(FamilyActivity.class, activityId);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ts.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
ifnull(u.mobile, ts.mobile) as newMobile,
|
||||
u.birthday,
|
||||
tsc.courseName
|
||||
FROM
|
||||
family_user ts
|
||||
left join `vw_user` u on u.id = ts. userId
|
||||
left join family_course tsc on tsc.id = ts.courseId
|
||||
WHERE
|
||||
ts.activityId = @activityId
|
||||
""").setParam("activityId", activityId);
|
||||
List<NutMap> userList = familyActivityManageService.listMap(sql);
|
||||
|
||||
List<FamilyCourse> courseList = dao.query(FamilyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
List<FamilyType> familyTypeList = dao.query(FamilyType.class, Cnd.NEW());
|
||||
dao.fetchLinks(familyTypeList, "familyMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
Map<String, FamilyType> typeMap = familyTypeList.stream().collect(Collectors.toMap(FamilyType::getId, o -> o));
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
|
||||
List<Map<String, String>> basicEntity = List.of(
|
||||
Map.of("name", "姓名", "key", "username"),
|
||||
Map.of("name", "工号", "key", "loginname"),
|
||||
Map.of("name", "单位", "key", "unitName"),
|
||||
Map.of("name", "分工会", "key", "unionName"),
|
||||
Map.of("name", "性别", "key", "sex"),
|
||||
Map.of("name", "手机号", "key", "newMobile")
|
||||
);
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = basicEntity.stream().map(entity -> {
|
||||
ExcelExportEntity excelExportEntity = new ExcelExportEntity();
|
||||
excelExportEntity.setKey(entity.get("key"));
|
||||
excelExportEntity.setName(entity.get("name"));
|
||||
excelExportEntity.setWidth(20);
|
||||
excelExportEntity.setNeedMerge(true);
|
||||
return excelExportEntity;
|
||||
}).collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
for (FamilyCourse c : courseList) {
|
||||
String k = c.getCourseName();
|
||||
List<NutMap> courseSignUsers = userList.stream().filter(x -> x.getString("courseName").equals(k)).collect(Collectors.toCollection(ArrayList::new));
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setSheetName(k);
|
||||
userExportParams.setType(ExcelType.HSSF);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>(excelCommonExportEntity);
|
||||
|
||||
FamilyType signUpType = typeMap.get(c.getCourseType());
|
||||
if (Lang.isNotEmpty(signUpType.getFamilyMobileSignColumnList())) {
|
||||
ExcelExportEntity familyEntity = new ExcelExportEntity("家属信息", "familyInfos", 20);
|
||||
List<ExcelExportEntity> signColumn = signUpType.getFamilyMobileSignColumnList().stream().map(column -> {
|
||||
ExcelExportEntity entity = new ExcelExportEntity();
|
||||
entity.setName(column.getColumnName());
|
||||
entity.setKey(column.getColumnCode());
|
||||
entity.setWidth(20);
|
||||
if ("FILE".equals(column.getColumnFormType())) {
|
||||
entity.setType(2);
|
||||
entity.setExportImageType(2);
|
||||
}
|
||||
return entity;
|
||||
}).collect(Collectors.toCollection(ArrayList::new));
|
||||
familyEntity.setList(signColumn);
|
||||
currentEntities.add(familyEntity);
|
||||
}
|
||||
for (NutMap userSignData : courseSignUsers) {
|
||||
String mobileColumnsValueStr = userSignData.getString("mobileColumnsValue");
|
||||
if (StrUtil.isNotBlank(mobileColumnsValueStr)) {
|
||||
JSONArray outerArray = JSONUtil.parseArray(mobileColumnsValueStr);
|
||||
List<List<JSONObject>> result = outerArray.stream()
|
||||
.map(item -> {
|
||||
// 每个 item 又是一个数组
|
||||
JSONArray innerArray = (JSONArray) item;
|
||||
return innerArray.toList(JSONObject.class);
|
||||
})
|
||||
.toList();
|
||||
List<NutMap> familyInfos = new ArrayList<>();
|
||||
for (List<JSONObject> list : result) {
|
||||
NutMap familyMap = new NutMap();
|
||||
for (JSONObject column : list) {
|
||||
if (!"FILE".equals(column.getStr("columnFormType"))) {
|
||||
familyMap.put(column.getStr("columnCode"), column.getStr("columnValue"));
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(column.getStr("columnValue"))) {
|
||||
List<JSONObject> columnValue = Json.fromJsonAsList(JSONObject.class, column.getStr("columnValue"));
|
||||
if (columnValue.size() == 1) {
|
||||
JSONObject sysFile = columnValue.get(0);
|
||||
Sys_file file = dao.fetch(Sys_file.class, Cnd.where(Sys_file::getDownloadPath, "=", sysFile.get("url")));
|
||||
byte[] imageBytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath());
|
||||
if (imageBytes.length > 0) {
|
||||
familyMap.put(column.getStr("columnCode"), imageBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
familyInfos.add(familyMap);
|
||||
}
|
||||
userSignData.put("familyInfos", familyInfos);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> userExportMap = new HashMap<>();
|
||||
userExportMap.put("name", k);
|
||||
userExportMap.put("title", userExportParams);
|
||||
userExportMap.put("entity", currentEntities);
|
||||
userExportMap.put("data", courseSignUsers);
|
||||
|
||||
sheetsList.add(userExportMap);
|
||||
}
|
||||
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
for (Map<String, Object> map : sheetsList) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
service.createSheetForMap(workbook, (ExportParams) map.get("title"), (List<ExcelExportEntity>) map.get("entity"), (Collection<?>) map.get("data"));
|
||||
}
|
||||
CommonDownloadUtil.download(activity.getActivityName() + "报名人员名单" + ".xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.budwk.app.zhgh.activity.family.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.services.SysHomeConvert;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Comment("亲子活动")
|
||||
@Table("family_activity")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FamilyActivity extends BaseModel implements Serializable, SysHomeConvert {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("活动名称")
|
||||
private String activityName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("年度")
|
||||
private Integer year;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动报名开始时间")
|
||||
private Date activitySignUpStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动报名开始时间")
|
||||
private Date activitySignUpEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动开始时间")
|
||||
private Date activityStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动结束时间")
|
||||
private Date activityEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否禁用")
|
||||
@Default("0")
|
||||
private boolean isDisabled;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "longtext")
|
||||
@Comment("活动介绍")
|
||||
private String introduce;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
@Comment("活动限制标识")
|
||||
private Integer restrictLimit;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
@Comment("活动限制报名个数")
|
||||
private Integer limitNum;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("活动封面")
|
||||
private String cover;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("微信群二维码")
|
||||
private String wechat;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("上课前是否通知")
|
||||
@Default("0")
|
||||
private boolean notice;
|
||||
|
||||
@Column
|
||||
@Comment("活动范围Id")
|
||||
@ColDefine(type = ColType.INT, width = 32)
|
||||
private Integer activityGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("活动范围名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 40)
|
||||
private String activityGroupName;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<FamilyCourse> courseList;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<FamilyTypeLimit> typeLimits;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String trainType;
|
||||
|
||||
@Override
|
||||
public Sys_home_activity covertToSysHomeActivity() {
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(this.getId());
|
||||
sysHomeActivity.setName(this.getActivityName());
|
||||
sysHomeActivity.setCover(this.getCover());
|
||||
sysHomeActivity.setUrl("/platform/family/manage/apply");
|
||||
sysHomeActivity.setH5Url("/platform/mobile/familyActivity/familyList");
|
||||
if (Lang.isNotEmpty(this.getActivitySignUpStartTime())) {
|
||||
sysHomeActivity.setStartDate(this.getActivitySignUpStartTime());
|
||||
sysHomeActivity.setEndDate(this.getActivitySignUpEndTime());
|
||||
}
|
||||
sysHomeActivity.setAllowUserGroupId(this.getActivityGroupId());
|
||||
sysHomeActivity.setEnable(!this.isDisabled());
|
||||
sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
|
||||
return sysHomeActivity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.budwk.app.zhgh.activity.family.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Comment("亲子活动下的子活动")
|
||||
@Table("family_activity_course")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FamilyActivityCourse {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程ID")
|
||||
private String courseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程开始时间")
|
||||
private Date courseStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程结束时间")
|
||||
private Date courseEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATE)
|
||||
@Comment("课程时间")
|
||||
private Date courseDate;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
@Comment("限制人数")
|
||||
private Integer courseLimitNum;
|
||||
|
||||
private Integer hasRegisterNum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.budwk.app.zhgh.activity.family.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Comment("亲子活动黑名单")
|
||||
@Table("family_black_list")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FamilyBlackList {
|
||||
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否禁用")
|
||||
private Boolean isDisabled;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.budwk.app.zhgh.activity.family.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Comment("亲子活动的子活动")
|
||||
@Table("family_course")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FamilyCourse extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("课程名称")
|
||||
private String courseName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("课程人数")
|
||||
private int coursePeopleNumber;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Default(value = "0")
|
||||
@Comment("预留名额")
|
||||
private int courseReservedNumber;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("课程地点")
|
||||
private String courseLocation;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程类型")
|
||||
private String courseType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("课程地点坐标")
|
||||
private List<Double> courseLocationCoordinates;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("课程讲师")
|
||||
private String courseInstructor;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("校区")
|
||||
private String campus;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("报名人数是否限制")
|
||||
private Boolean courseIsLimitApply;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("序号")
|
||||
private int orderNum;
|
||||
|
||||
@Many(field = "courseId")
|
||||
private List<FamilyActivityCourse> courseTimeList;
|
||||
|
||||
@Column
|
||||
@Comment("分工会人数限制")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> unionLimit;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("移动端是否签到")
|
||||
private boolean isMobileSign;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("签到方式 1.扫描二维码签到 2.被扫 3.gps签到")
|
||||
private Integer signType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("移动端是否签收礼品")
|
||||
private boolean isReceiveGift;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("领取礼品方式 1.扫描二维码 2.线下")
|
||||
private Integer giftType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("预留名额方式 1.报名人员减少模式 2.报名人数不变模式")
|
||||
private Integer reserveMode;
|
||||
|
||||
@Column
|
||||
@Comment("承办工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String hostUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("对内报名时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String interTime;
|
||||
|
||||
@Column
|
||||
@Comment("是否开放给其他工会")
|
||||
@ColDefine(type = ColType.BOOLEAN, width = 4)
|
||||
private Boolean openOtherUnion;
|
||||
|
||||
@Column
|
||||
@Comment("分类标识")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String assort;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Default(value = "0")
|
||||
@Comment("候补名额数")
|
||||
private Integer waitingNum;
|
||||
|
||||
private Integer hasWaitingNum;
|
||||
private String courseTimeName;
|
||||
private Integer hasRegisterNum;
|
||||
private Boolean isBringFamily;
|
||||
private Boolean isAddFamily;
|
||||
private Boolean isSign;
|
||||
private Boolean canSignThisCourseType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.budwk.app.zhgh.activity.family.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Comment("亲子活动移动端动态表单")
|
||||
@Table("family_mobile_sign_column")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FamilyMobileSignColumn implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("类型id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeId;
|
||||
|
||||
@Column
|
||||
@Comment("字段名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnName;
|
||||
|
||||
@Column
|
||||
@Comment("字段编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnCode;
|
||||
|
||||
@Column
|
||||
@Comment("字段值")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnValue;
|
||||
|
||||
@Column
|
||||
@Comment("字段类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnType;
|
||||
|
||||
@Column
|
||||
@Comment("下拉框的值")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> selectValues;
|
||||
|
||||
@Column
|
||||
@Comment("是否必填")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isRequired;
|
||||
|
||||
@Column
|
||||
@Comment("控件类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnFormType;
|
||||
|
||||
@Column
|
||||
@Comment("文件个数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer fileNumber;
|
||||
|
||||
@Column
|
||||
@Comment("文件类型")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> fileType;
|
||||
|
||||
@Column
|
||||
@Comment("序号")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer columnIndex;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.budwk.app.zhgh.activity.family.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Comment("亲子活动的子活动类型")
|
||||
@Table("family_type")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FamilyType extends BaseModel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("类型编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 80)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("类型名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 80)
|
||||
private String typeName;
|
||||
|
||||
@Column
|
||||
@Comment("序号")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer xh;
|
||||
|
||||
@Column
|
||||
@Comment("是否携带家属")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("1")
|
||||
private Boolean isBringFamily;
|
||||
|
||||
@Column
|
||||
@Comment("家属纳入总人数")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("1")
|
||||
private Boolean isAddFamily;
|
||||
|
||||
@Column
|
||||
@Comment("本人纳入总人数")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("1")
|
||||
private Boolean selfAddFamily;
|
||||
|
||||
@Many(field = "typeId")
|
||||
private List<FamilyMobileSignColumn> familyMobileSignColumnList;
|
||||
|
||||
@Column
|
||||
@Comment("家属最多数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer familyMaxCount;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.budwk.app.zhgh.activity.family.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Comment("子活动类型限制条件")
|
||||
@Table("family_type_limit")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FamilyTypeLimit implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeId;
|
||||
|
||||
@Column
|
||||
@Comment("限制个数")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private int limitNum;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.budwk.app.zhgh.activity.family.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Comment("亲子活动报名人员")
|
||||
@Table("family_user")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableIndexes({@Index(name = "INDEX_FAMILY_USER_COURSEID", fields = {"courseId"}, unique = false)})
|
||||
public class FamilyUser implements Serializable {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程ID")
|
||||
private String courseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户ID")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("工会ID")
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("单位ID")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("工会")
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("单位")
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("联系方式")
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("报名时间")
|
||||
private Date signUpTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("手机端报名字段和值")
|
||||
private List<List<NutMap>> mobileColumnsValue;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("用户报名状态(1.正常 2.待报名成功 3.也是正常,但是是从2变为1的 4.废弃[就是没签到的意思])")
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.budwk.app.zhgh.activity.family.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Comment("亲子活动报名人员子活动表")
|
||||
@Table("family_user_course")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableIndexes({
|
||||
@Index(name = "INDEX_FAMILY_USER_COURSE_USERID", fields = {"userId"}, unique = false),
|
||||
@Index(name = "INDEX_FAMILY_USER_COURSE_COURSEID", fields = {"courseId"}, unique = false)
|
||||
})
|
||||
public class FamilyUserCourse implements Serializable {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程ID")
|
||||
private String courseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户ID")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程开始时间")
|
||||
private Date courseStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程结束时间")
|
||||
private Date courseEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否上课")
|
||||
private boolean isAttend;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("上课打卡时间")
|
||||
private Date attendTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否领取礼品")
|
||||
private Boolean isReceive;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("领取礼品时间")
|
||||
private Date receiveTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("签到扫码人员id(二维码模式)")
|
||||
private String signScannerCodeUserId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("礼品扫码人员id(二维码模式)")
|
||||
private String giftScannerCodeUserId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("关联family_activity_course表的id")
|
||||
private String activityCourseId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.budwk.app.zhgh.activity.family.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyActivity;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyCourse;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyUser;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
public interface FamilyActivityService extends BaseService<FamilyActivity> {
|
||||
|
||||
/**
|
||||
* 添加活动
|
||||
* @param activity 活动信息
|
||||
* @param course 培训班信息
|
||||
*/
|
||||
void add(FamilyActivity activity, FamilyCourse course);
|
||||
|
||||
/**
|
||||
* 编辑活动
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void edit(FamilyActivity activity);
|
||||
|
||||
/**
|
||||
* 更新活动状态
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void updateActivityStatus(FamilyActivity activity);
|
||||
|
||||
/**
|
||||
* 查询单条活动信息
|
||||
* @param id 活动ID
|
||||
* @return 返回的数据与前端符合
|
||||
*/
|
||||
NutMap findOne(String id, Cnd cnd, String fromMode);
|
||||
|
||||
/**
|
||||
* pc分页查询
|
||||
* @param pageForm
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd);
|
||||
|
||||
|
||||
/**
|
||||
* 手机端分页查询
|
||||
* @param pageForm 分页
|
||||
* @param year 年度
|
||||
* @param activityStatus 报名状态 0全部 1进行中 2结束
|
||||
* @return
|
||||
*/
|
||||
Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType);
|
||||
|
||||
/**
|
||||
* 手机端报名
|
||||
* @param familyUser 活动ID
|
||||
*/
|
||||
void doSignUp(FamilyUser familyUser) throws Exception;
|
||||
|
||||
/**
|
||||
* 异步插入每个报名成功人员的课程数据
|
||||
* @param activityId
|
||||
* @param courseId
|
||||
* @param userId
|
||||
*/
|
||||
void asyncInsertUserCourse(String activityId, String courseId, String userId);
|
||||
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
* @return
|
||||
*/
|
||||
boolean isSignFullByUnionId(FamilyCourse course, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 该培训班是否报满
|
||||
*/
|
||||
boolean isSignFull(FamilyCourse course, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 还能报该类型的培训班吗 比如书画班最多报一项 健身班两项
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourse(FamilyCourse course, FamilyActivity activity);
|
||||
|
||||
/**
|
||||
* 当前用户是否已报过该培训班
|
||||
* @param courseId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourseByUser(String courseId, String userId);
|
||||
|
||||
/**
|
||||
* 手机端签到
|
||||
* @param id 每个培训班每节课每个用户的记录ID
|
||||
*/
|
||||
void doQd(String id);
|
||||
|
||||
/**
|
||||
* 某个用户的签到信息
|
||||
* @param userId 用户id
|
||||
* @param activityId 活动id
|
||||
*/
|
||||
List<NutMap> qdInfoByUserId(String userId, String activityId);
|
||||
|
||||
List<FamilyCourse> filterCourseByHostUnion(List<FamilyCourse> courseList);
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.budwk.app.zhgh.activity.family.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyUser;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
public interface FamilyActivityStatisticsService extends BaseService<FamilyUser> {
|
||||
|
||||
/**
|
||||
* 统计分页
|
||||
* @param pageForm
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, String activityId);
|
||||
|
||||
/**
|
||||
* 该课程下的报名人员信息
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> registerUserList(String courseId);
|
||||
|
||||
List<NutMap> getTaleColumnInfo(String courseId);
|
||||
|
||||
/**
|
||||
* 该课程下的报名人员信息
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> registerUserList(String courseId, String unionId, String unitId, String searchName, String searchKeyword);
|
||||
|
||||
/**
|
||||
* 获取每个课程的签到情况
|
||||
* @param courseId
|
||||
* @return k->每个培训班每节课的上课时间 v->上课记录list
|
||||
*/
|
||||
Map<String, List<NutMap>> getSignInfo(String courseId);
|
||||
|
||||
/**
|
||||
* 报名人员list 导出
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> baoMingUserList(String activityId);
|
||||
|
||||
int queryCourseCount(String courseId, String courseType);
|
||||
|
||||
int queryCourseWaitCount(String courseId, String courseType);
|
||||
|
||||
int queryCourseCount(String courseId, String courseType, String unionId);
|
||||
|
||||
int queryCourseWaitCount(String courseId, String courseType, String unionId);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.budwk.app.zhgh.activity.family.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyBlackList;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
public interface FamilyBlackListService extends BaseService<FamilyBlackList> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
* @param pageForm 分页
|
||||
* @return Pagination
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd, String activityId, String courseId);
|
||||
|
||||
/**
|
||||
* 拉黑、解封用户
|
||||
* @param userId
|
||||
*/
|
||||
void doHandleUser(String userId);
|
||||
|
||||
/**
|
||||
* 上课记录
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> attendClassRecord(String userId);
|
||||
|
||||
}
|
||||
+458
@@ -0,0 +1,458 @@
|
||||
package com.budwk.app.zhgh.activity.family.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.family.models.*;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityService;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityStatisticsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.async.Async;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author NINGMEI
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class FamilyActivityServiceImpl extends BaseServiceImpl<FamilyActivity> implements FamilyActivityService {
|
||||
|
||||
@Inject
|
||||
private FamilyActivityStatisticsService statisticsService;
|
||||
|
||||
public FamilyActivityServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void add(FamilyActivity activity, FamilyCourse course) {
|
||||
|
||||
dao().insert(activity);
|
||||
|
||||
//插入类型限制
|
||||
List<FamilyTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> v.setActivityId(activity.getId()));
|
||||
dao().insert(typeLimits);
|
||||
|
||||
List<FamilyCourse> courseList = activity.getCourseList();
|
||||
for (FamilyCourse v : courseList) {
|
||||
v.setActivityId(activity.getId());
|
||||
v.setOpenOtherUnion(false);
|
||||
dao().insert(v);
|
||||
this.setCourseTimeAndInsert(v);
|
||||
}
|
||||
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void edit(FamilyActivity activity) {
|
||||
|
||||
//修改活动
|
||||
update(activity);
|
||||
|
||||
//修改类型限制
|
||||
List<FamilyTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> v.setActivityId(activity.getId()));
|
||||
if(Lang.isNotEmpty(typeLimits)) {
|
||||
insertOrUpdate(typeLimits);
|
||||
}
|
||||
|
||||
List<FamilyCourse> courseList = activity.getCourseList();
|
||||
courseList.forEach(v -> {
|
||||
v.setActivityId(activity.getId());
|
||||
dao().insertOrUpdate(v);
|
||||
if (Lang.isNotEmpty(v.getCourseTimeList())) {
|
||||
this.setCourseTimeAndInsert(v);
|
||||
}
|
||||
});
|
||||
|
||||
//查询原来的活动
|
||||
List<FamilyCourse> oldCourseList = dao().query(FamilyCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
//原来的培训班id
|
||||
List<String> oldCourseIdList = oldCourseList.stream().map(FamilyCourse::getId).toList();
|
||||
|
||||
//原来的上课时间
|
||||
List<FamilyActivityCourse> oldActCourseTimeList = dao().query(FamilyActivityCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
|
||||
//现在的上课时间
|
||||
List<String> nowCourseTimeListId = new ArrayList<>();
|
||||
activity.getCourseList().forEach(v -> {
|
||||
if (v.getCourseTimeList() != null) {
|
||||
nowCourseTimeListId.addAll(v.getCourseTimeList().stream().map(FamilyActivityCourse::getId).toList());
|
||||
}
|
||||
});
|
||||
|
||||
List<String> deleteCourseTimeListId = oldActCourseTimeList.stream().map(FamilyActivityCourse::getId).filter(id -> !nowCourseTimeListId.contains(id)).collect(Collectors.toList());
|
||||
List<String> courseIdList = courseList.stream().map(FamilyCourse::getId).collect(Collectors.toList());
|
||||
|
||||
//删除关联的培训班
|
||||
List<String> deleteIdList = oldCourseIdList.stream().filter(v -> !courseIdList.contains(v)).collect(Collectors.toList());
|
||||
dao().clear(FamilyCourse.class, Cnd.where("id", "in", deleteIdList));
|
||||
|
||||
dao().clear(FamilyActivityCourse.class, Cnd.where("id", "in", deleteCourseTimeListId));
|
||||
dao().clear(FamilyUser.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
dao().clear(FamilyUserCourse.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
|
||||
//查询修改过培训时间的记录
|
||||
Sql tsuucSql = Sqls.create("""
|
||||
SELECT
|
||||
tsuuc.id,
|
||||
tsuac.courseStartTime,
|
||||
tsuac.courseEndTime
|
||||
FROM
|
||||
`family_user_course` tsuuc
|
||||
LEFT JOIN family_activity_course tsuac ON tsuac.id = tsuuc.activityCourseId
|
||||
where tsuuc.courseStartTime != tsuac.courseStartTime or tsuuc.courseEndTime != tsuac.courseEndTime
|
||||
""");
|
||||
List<NutMap> tsuucList = listMap(tsuucSql);
|
||||
tsuucList.forEach(v -> {
|
||||
Chain chain = Chain.make("courseStartTime", v.getTime("courseStartTime"));
|
||||
chain.add("courseEndTime", v.getTime("courseEndTime"));
|
||||
Cnd cnd = Cnd.where("id", "=", v.getString("id"));
|
||||
dao().update("family_user_course", chain, cnd);
|
||||
});
|
||||
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
} else {
|
||||
dao().delete(Sys_home_activity.class, activity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private void setCourseTimeAndInsert(FamilyCourse course) {
|
||||
course.getCourseTimeList().forEach(courseTime -> {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(courseTime.getCourseDate());
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH);
|
||||
int day = calendar.get(Calendar.DATE);
|
||||
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
startCalendar.setTime(courseTime.getCourseStartTime());
|
||||
startCalendar.set(year, month, day);
|
||||
courseTime.setCourseStartTime(startCalendar.getTime());
|
||||
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(courseTime.getCourseEndTime());
|
||||
endCalendar.set(year, month, day);
|
||||
courseTime.setCourseEndTime(endCalendar.getTime());
|
||||
|
||||
courseTime.setActivityId(course.getActivityId());
|
||||
courseTime.setCourseId(course.getId());
|
||||
dao().insertOrUpdate(courseTime);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void updateActivityStatus(FamilyActivity activity) {
|
||||
updateIgnoreNull(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap findOne(String id, Cnd cnd, String fromMode) {
|
||||
if (Lang.isEmpty(cnd)) {
|
||||
cnd = Cnd.NEW();
|
||||
}
|
||||
|
||||
cnd.asc("orderNum").asc("campus").desc("courseLocation").asc("courseType").asc("courseName");
|
||||
List<FamilyCourse> courseArray = dao().query(FamilyCourse.class, cnd.and("activityId", "=", id));
|
||||
|
||||
if (StrUtil.isNotBlank(fromMode) && "mobile".equals(fromMode)) {
|
||||
courseArray = this.filterCourseByHostUnion(courseArray);
|
||||
}
|
||||
|
||||
FamilyActivity activity = fetchLinks(dao().fetch(FamilyActivity.class, id), "^(conditionStructure|typeLimits)$");
|
||||
activity.setCourseList(courseArray);
|
||||
|
||||
List<FamilyCourse> courseList = activity.getCourseList();
|
||||
|
||||
courseList.forEach(c -> {
|
||||
if (StrUtil.isNotBlank(c.getCourseType())) {
|
||||
dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
int courseCount = statisticsService.queryCourseCount(c.getId(), c.getCourseType());
|
||||
c.setHasRegisterNum(courseCount);
|
||||
int courseWaitCount = statisticsService.queryCourseWaitCount(c.getId(), c.getCourseType());
|
||||
c.setHasWaitingNum(courseWaitCount);
|
||||
//当前用户是否报过
|
||||
c.setIsSign(isSignCourseByUser(c.getId(), SecurityUtil.getUserId()));
|
||||
}
|
||||
});
|
||||
return Lang.obj2nutmap(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd) {
|
||||
Pagination pagination = listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "^(courseList)$");
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
switch (activityStatus) {
|
||||
case 2 -> {
|
||||
cnd.and(new Static("activitySignUpStartTime < now()"));
|
||||
cnd.and(new Static("activitySignUpEndTime > now()"));
|
||||
}
|
||||
case 3 -> {
|
||||
cnd.and(new Static("activityStartTime < now()"));
|
||||
cnd.and(new Static("activityEndTime > now()"));
|
||||
}
|
||||
case 4 -> cnd.and(new Static("activityEndTime < now()"));
|
||||
case 5 -> cnd.and(new Static("activityStartTime < now()"));
|
||||
case 6 -> cnd.and(new Static("activityStartTime > now()"));
|
||||
}
|
||||
if (activityType != null && activityType == 1) {
|
||||
cnd.and(new Static("id in (select activityId from family_user where userId = '%s')".formatted(SecurityUtil.getUserId())));
|
||||
}
|
||||
cnd.and("isDisabled", "=", 0);
|
||||
cnd.orderBy("activityEndTime", "desc");
|
||||
cnd.orderBy("isDisabled", "desc");
|
||||
cnd.orderBy("createdAt", "desc");
|
||||
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doSignUp(FamilyUser familyUser) throws Exception {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
|
||||
//查询课程
|
||||
FamilyCourse course = dao().fetch(FamilyCourse.class, familyUser.getCourseId());
|
||||
FamilyType type = dao().fetch(FamilyType.class, course.getCourseType());
|
||||
//如果这个课程的预留名额方式为报名人数不变
|
||||
if (course.getReserveMode() == 2) {
|
||||
//如果当前报名+已报小于这个课程限制人数
|
||||
//课程已报人数
|
||||
int normalCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType());
|
||||
//+1是算自己
|
||||
int hasRegisterNum = type.getSelfAddFamily() ? normalCount + 1 : 0;
|
||||
familyUser.setState((hasRegisterNum + course.getCourseReservedNumber()) > course.getCoursePeopleNumber() ? 2 : 1);
|
||||
} else {
|
||||
familyUser.setState(1);
|
||||
}
|
||||
|
||||
View_user user = dao().fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
familyUser.setUnionId(SecurityUtil.getUnionId());
|
||||
familyUser.setUnionName(user.getUnionName());
|
||||
familyUser.setUnitId(SecurityUtil.getUnitId());
|
||||
familyUser.setUnitName(user.getUnitName());
|
||||
familyUser.setUserId(userId);
|
||||
familyUser.setSignUpTime(new Date());
|
||||
|
||||
dao().insert(familyUser);
|
||||
asyncInsertUserCourse(familyUser.getActivityId(), familyUser.getCourseId(), userId);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void asyncInsertUserCourse(String activityId, String courseId, String userId) {
|
||||
log.info("异步插入{}的上课信息,课程ID为{},活动ID为{}", userId, courseId, activityId);
|
||||
List<FamilyActivityCourse> courseList = dao().query(FamilyActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
List<FamilyUserCourse> list = new ArrayList<>();
|
||||
courseList.forEach(v -> {
|
||||
FamilyUserCourse userCourse = new FamilyUserCourse();
|
||||
userCourse.setActivityId(activityId);
|
||||
userCourse.setCourseId(courseId);
|
||||
userCourse.setUserId(userId);
|
||||
userCourse.setCourseStartTime(v.getCourseStartTime());
|
||||
userCourse.setCourseEndTime(v.getCourseEndTime());
|
||||
userCourse.setAttend(false);
|
||||
userCourse.setAttendTime(null);
|
||||
userCourse.setActivityCourseId(v.getId());
|
||||
list.add(userCourse);
|
||||
});
|
||||
dao().insert(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isSignFullByUnionId(FamilyCourse course, Integer currentFamilyNumber) {
|
||||
List<NutMap> unionLimit = course.getUnionLimit();
|
||||
if (Lang.isEmpty(unionLimit)) {
|
||||
return false;
|
||||
}
|
||||
String unionId = SecurityUtil.getUnionId();
|
||||
NutMap unionLimitMap = unionLimit.stream().filter(v -> v.getString("id").equals(unionId)).findAny().orElse(null);
|
||||
if (Lang.isEmpty(unionLimitMap)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
FamilyType type = dao().fetch(FamilyType.class, course.getCourseType());
|
||||
//分工会限制人数
|
||||
int limitCount = unionLimitMap.getInt("limitCount");
|
||||
|
||||
//该课程已经报名的总人数
|
||||
int hasSignCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType(), unionId);
|
||||
int hasWaitCount = statisticsService.queryCourseWaitCount(course.getId(), course.getCourseType());
|
||||
|
||||
//+1是算自己
|
||||
int current = type.getSelfAddFamily() ? 1 : 0;
|
||||
currentFamilyNumber = type.getIsBringFamily() && type.getIsAddFamily() ? currentFamilyNumber : 0;
|
||||
//如果还有正常名额
|
||||
if(limitCount - hasSignCount > 0) {
|
||||
return (hasSignCount + current + currentFamilyNumber) > limitCount;
|
||||
} else {
|
||||
return (hasWaitCount + current + currentFamilyNumber) > course.getWaitingNum();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignFull(FamilyCourse course, Integer currentFamilyNumber) {
|
||||
//课程限制人数
|
||||
int coursePeopleNumber = course.getCoursePeopleNumber();
|
||||
if (coursePeopleNumber == 0) {
|
||||
return true;
|
||||
}
|
||||
//查询课程对应的类型
|
||||
FamilyType type = dao().fetch(FamilyType.class, course.getCourseType());
|
||||
//课程已报人数
|
||||
int hasSignCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType());
|
||||
int hasWaitCount = statisticsService.queryCourseWaitCount(course.getId(), course.getCourseType());
|
||||
|
||||
//+1是算自己
|
||||
int current = type.getSelfAddFamily() ? 1 : 0;
|
||||
currentFamilyNumber = type.getIsBringFamily() && type.getIsAddFamily() ? currentFamilyNumber : 0;
|
||||
//如果还有正常名额
|
||||
if(coursePeopleNumber - hasSignCount > 0) {
|
||||
return (hasSignCount + current + currentFamilyNumber + course.getCourseReservedNumber()) > coursePeopleNumber;
|
||||
} else {
|
||||
return (hasWaitCount + current + currentFamilyNumber) > course.getWaitingNum();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignCourse(FamilyCourse course, FamilyActivity activity) {
|
||||
//培训班类型
|
||||
String courseType = course.getCourseType();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count( tsus.id )
|
||||
FROM
|
||||
`family_user` tsus
|
||||
LEFT JOIN family_course tsuc ON tsuc.id = tsus.courseId
|
||||
WHERE
|
||||
tsuc.courseType = @courseType
|
||||
AND tsus.userId = @userId
|
||||
AND tsus.activityId = @activityId
|
||||
""");
|
||||
sql.setParam("courseType", courseType);
|
||||
sql.setParam("activityId", activity.getId());
|
||||
sql.setParam("userId", SecurityUtil.getUserId());
|
||||
int hasRegisterNum = count(sql);
|
||||
|
||||
//第一种无限制报名
|
||||
if (activity.getRestrictLimit() == null || activity.getRestrictLimit() == 1) {
|
||||
return true;
|
||||
} else if (activity.getRestrictLimit() == 2) {
|
||||
FamilyTypeLimit familyTypeLimit = dao().fetch(FamilyTypeLimit.class, Cnd.where("typeId", "=", courseType).and("activityId", "=", activity.getId()));
|
||||
if (familyTypeLimit == null) {
|
||||
return true;
|
||||
}
|
||||
//此类型的班最多可报几项
|
||||
int personMaxRegisterNum = familyTypeLimit.getLimitNum();
|
||||
if (personMaxRegisterNum == 0) {
|
||||
return true;
|
||||
}
|
||||
return hasRegisterNum < personMaxRegisterNum;
|
||||
} else if (activity.getRestrictLimit() == 3) {
|
||||
//第三种,限制报几个,不跟类型挂钩
|
||||
int aCount = dao().count(FamilyUser.class, Cnd.where("activityId", "=", activity.getId()).and("userId", "=", SecurityUtil.getUserId()));
|
||||
return aCount < activity.getLimitNum();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignCourseByUser(String courseId, String userId) {
|
||||
return dao().count(FamilyUser.class, Cnd.where("courseId", "=", courseId).and("userId", "=", userId)) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doQd(String id) {
|
||||
NutMap updateMap = NutMap.NEW();
|
||||
updateMap.put("isAttend", true);
|
||||
updateMap.put("attendTime", new Date());
|
||||
dao().update(FamilyUserCourse.class, Chain.from(updateMap), Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> qdInfoByUserId(String userId, String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
t.courseLocationCoordinates,
|
||||
t.isMobileSign,
|
||||
t.signType,
|
||||
t.isReceiveGift,
|
||||
t.giftType,
|
||||
(select state from family_user su where su.activityId = c.activityId and su.courseId = c.courseId and su.userId = c.userId) as state
|
||||
FROM
|
||||
`family_user_course` c
|
||||
LEFT JOIN family_course t ON t.id = c.courseId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("c.activityId", "=", activityId);
|
||||
cnd.and("c.userId", "=", userId);
|
||||
cnd.asc("c.courseStartTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FamilyCourse> filterCourseByHostUnion(List<FamilyCourse> courseList) {
|
||||
if (Lang.isEmpty(courseList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return courseList.stream().filter(o -> {
|
||||
if (StrUtil.isBlank(o.getInterTime()) || o.getOpenOtherUnion() == null || o.getOpenOtherUnion()) {
|
||||
return true;
|
||||
} else {
|
||||
if (SecurityUtil.getUnionId().equals(o.getHostUnionId())) {
|
||||
return true;
|
||||
} else {
|
||||
int compare = cn.hutool.core.date.DateUtil.compare(cn.hutool.core.date.DateUtil.date(), cn.hutool.core.date.DateUtil.parse(o.getInterTime()), "yyyy-MM-dd HH:mm");
|
||||
return compare >= 0;
|
||||
}
|
||||
}
|
||||
}).toList();
|
||||
}
|
||||
}
|
||||
+269
@@ -0,0 +1,269 @@
|
||||
package com.budwk.app.zhgh.activity.family.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyCourse;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyType;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyUser;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityStatisticsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年03月03日 10:02:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class FamilyActivityStatisticsServiceImpl extends BaseServiceImpl<FamilyUser> implements FamilyActivityStatisticsService {
|
||||
|
||||
public FamilyActivityStatisticsServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseReservedNumber,
|
||||
type.typeName as courseType,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.reserveMode,
|
||||
tsuc.isMobileSign,
|
||||
tsuc.hostUnionId,
|
||||
tsuc.interTime,
|
||||
tsuc.waitingNum,
|
||||
tsuc.openOtherUnion,
|
||||
tsuc.courseType as cType
|
||||
FROM
|
||||
`family_course` tsuc
|
||||
LEFT JOIN
|
||||
family_type type on tsuc.courseType = type.id
|
||||
WHERE
|
||||
tsuc.activityId = @activityId
|
||||
ORDER BY tsuc.orderNum
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
courseList.forEach(c -> {
|
||||
c.put("registerNum", queryCourseCount(c.getString("id"), c.getString("cType")));
|
||||
c.put("hasWaitingNum", queryCourseWaitCount(c.getString("id"), c.getString("cType")));
|
||||
});
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> registerUserList(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
tsuu.unionId,
|
||||
tsuu.unionName,
|
||||
tsuu.unitId,
|
||||
tsuu.unitName,
|
||||
ifnull(tsuu.mobile, u.mobile) as mobile,
|
||||
tsuu.signUpTime,
|
||||
tsuu.state,
|
||||
tsuu.mobileColumnsValue
|
||||
FROM
|
||||
family_user tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
$condition
|
||||
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = listMap(sql);
|
||||
for (NutMap nutMap : listMap) {
|
||||
// 第一步:解析为 JSONArray(外层数组)
|
||||
JSONArray outerArray = JSONUtil.parseArray(nutMap.getString("mobileColumnsValue"));
|
||||
// 第二步:转换为 List<List<JSONObject>>
|
||||
List<List<JSONObject>> result = outerArray.stream()
|
||||
.map(item -> {
|
||||
// 每个 item 又是一个数组
|
||||
JSONArray innerArray = (JSONArray) item;
|
||||
return innerArray.toList(JSONObject.class);
|
||||
})
|
||||
.toList();
|
||||
nutMap.put("mobileColumnsValue", result);
|
||||
nutMap.put("familyCount", result.size());
|
||||
}
|
||||
return listMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getTaleColumnInfo(String courseId) {
|
||||
FamilyCourse course = dao().fetch(FamilyCourse.class, courseId);
|
||||
FamilyType upType = dao().fetch(FamilyType.class, course.getCourseType());
|
||||
dao().fetchLinks(upType, "familyMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
|
||||
List<FamilyMobileSignColumn> columnList = upType.getFamilyMobileSignColumnList();
|
||||
List<NutMap> columnTableList = columnList.stream().map(o -> NutMap.NEW().setv("label", o.getColumnName()).setv("prop", o.getColumnCode())).collect(Collectors.toList());
|
||||
return columnTableList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> registerUserList(String courseId, String unionId, String unitId, String searchName, String searchKeyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuu.id,
|
||||
u.id as userId,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
tsuu.signUpTime,
|
||||
tsuu.state
|
||||
FROM
|
||||
family_user tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
$condition
|
||||
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
if (StrUtil.isNotBlank(searchKeyword)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.andLike("username", searchKeyword).orLike("loginname", searchKeyword);
|
||||
cnd.and(group);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<NutMap>> getSignInfo(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuuc.courseStartTime,
|
||||
tsuuc.courseEndTime,
|
||||
tsuuc.isAttend,
|
||||
tsuuc.attendTime,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.unionname
|
||||
FROM
|
||||
`family_user_course` tsuuc
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuuc.userId
|
||||
WHERE
|
||||
tsuuc.courseId = @courseId
|
||||
""");
|
||||
sql.setParam("courseId", courseId);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
Map<String, List<NutMap>> courseTimeMap = list.stream().map(v -> {
|
||||
String courseTime = v.getString("courseStartTime") + " 至 " + v.getString("courseEndTime");
|
||||
v.put("courseTime", courseTime);
|
||||
return v;
|
||||
}).collect(Collectors.groupingBy(v -> v.getString("courseTime")));
|
||||
|
||||
// 使用Stream API进行降序排序
|
||||
Map<String, List<NutMap>> sortedDataMap = courseTimeMap.entrySet().stream()
|
||||
.sorted(Map.Entry.comparingByKey(Comparator.reverseOrder()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
|
||||
|
||||
return sortedDataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> baoMingUserList(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
uc.courseName,
|
||||
uc.campus
|
||||
FROM
|
||||
`family_user` uu
|
||||
RIGHT JOIN family_course uc ON uc.id = uu.courseId
|
||||
LEFT JOIN `vw_user` u ON u.id = uu.userId
|
||||
WHERE
|
||||
uc.activityId = @activityId
|
||||
ORDER BY u.unitCode,u.unioncode,u.sex
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseCount(String courseId, String courseType) {
|
||||
return this.queryCourseCount(courseId, courseType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseWaitCount(String courseId, String courseType) {
|
||||
return this.queryCourseWaitCount(courseId, courseType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseCount(String courseId, String courseType, String unionId) {
|
||||
return this.calcSignCount(courseId, courseType, unionId, List.of(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseWaitCount(String courseId, String courseType, String unionId) {
|
||||
return this.calcSignCount(courseId, courseType, unionId, List.of(2));
|
||||
}
|
||||
|
||||
private int calcSignCount(String courseId, String courseType, String unionId, List<Integer> stateList) {
|
||||
if(StrUtil.isBlank(courseId) || StrUtil.isBlank(courseType)) {
|
||||
return 0;
|
||||
}
|
||||
FamilyType type = dao().fetch(FamilyType.class, courseType);
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<FamilyUser> signUpUsers = dao().query(FamilyUser.class, Cnd.where("courseId", "=", courseId)
|
||||
.and("state", "in", stateList)
|
||||
.andEX("unionId", "=", unionId));
|
||||
signUpUsers.forEach(item -> {
|
||||
if (type.getSelfAddFamily()) {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
}
|
||||
if (type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<List<NutMap>> mapList = item.getMobileColumnsValue();
|
||||
if (Lang.isNotEmpty(mapList)) {
|
||||
hasRegisterNum.addAndGet(mapList.size());
|
||||
}
|
||||
}
|
||||
});
|
||||
return hasRegisterNum.get();
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.budwk.app.zhgh.activity.family.service.impl;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyBlackList;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyBlackListService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Criteria;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年03月07日 14:29:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class FamilyUserServiceImpl extends BaseServiceImpl<FamilyBlackList> implements FamilyBlackListService {
|
||||
|
||||
public FamilyUserServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd, String activityId, String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id AS userId,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
tsuc.courseName,
|
||||
tsuu.state,
|
||||
( SELECT count( 1 ) FROM family_user_course WHERE userId = tsuu.userId $var) tourseTotal,
|
||||
( SELECT count( 1 ) FROM family_user_course WHERE userId = tsuu.userId AND isAttend = 0 and tsuu.state!=2 AND now()> courseEndTime $var) AS absentCount,
|
||||
if(tsubl.isDisabled=1,true,false) isDisabled,
|
||||
group_CONCAT( tsuc.courseName ) AS courseNames
|
||||
FROM
|
||||
`family_user` tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
LEFT JOIN family_activity act on act.id = tsuu.activityId
|
||||
LEFT JOIN family_course tsuc ON tsuc.id = tsuu.courseId
|
||||
LEFT JOIN family_black_list tsubl on tsubl.userId = tsuu.userId
|
||||
$condition
|
||||
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 )
|
||||
""");
|
||||
cnd.groupBy("tsuu.userId");
|
||||
Criteria varCnd = Cnd.cri();
|
||||
varCnd.where().setTop(false);
|
||||
varCnd.where().andEX("activityId", "=", activityId);
|
||||
varCnd.where().andEX("courseId", "=", courseId);
|
||||
if (!varCnd.where().isEmpty()) {
|
||||
sql.vars().set("var", "and " + varCnd.toSql(null));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doHandleUser(String userId) {
|
||||
FamilyBlackList blackRecord = dao().fetch(FamilyBlackList.class, Cnd.where("userId", "=", userId));
|
||||
if (Lang.isEmpty(blackRecord)) {
|
||||
FamilyBlackList blackList = new FamilyBlackList();
|
||||
blackList.setUserId(userId);
|
||||
blackList.setIsDisabled(true);
|
||||
dao().insert(blackList);
|
||||
} else {
|
||||
// blackRecord.setIsDisabled(!blackRecord.getIsDisabled());
|
||||
// dao().update(blackRecord);
|
||||
dao().delete(blackRecord);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> attendClassRecord(String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.courseName,
|
||||
uc.courseStartTime,
|
||||
courseEndTime,
|
||||
uc.isAttend,
|
||||
uc.attendTime
|
||||
FROM
|
||||
`family_user_course` uc
|
||||
LEFT JOIN family_course c ON c.id = uc.courseId
|
||||
WHERE
|
||||
uc.userId = @userId
|
||||
""");
|
||||
sql.setParam("userId", userId);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
package com.budwk.app.zhgh.activity.planSummary.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicSettings;
|
||||
import com.budwk.app.zhgh.activity.planSummary.model.YearPlan;
|
||||
import com.budwk.app.zhgh.activity.planSummary.service.YearPlanService;
|
||||
import com.budwk.app.zhgh.club.model.SysClub;
|
||||
import com.budwk.app.zhgh.club.service.SysClubService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName YearPlanController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 16:15
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "年度计划")
|
||||
@At("/platform/yearPlan/manage")
|
||||
public class YearPlanController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private YearPlanService yearPlanService;
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("planSummary.yearPlan.manage")
|
||||
@Ok("beetl:/platform/zhgh/activity/planSummary/yearPlan/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("planSummary.yearPlan.manage")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "tissueIdByUnion") String tissueIdByUnion,
|
||||
@Param(value = "tissueIdByClub") String tissueIdByClub,
|
||||
@Param(value = "planName") String planName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.andEX("YEAR(yp.planTime)", "=", year);
|
||||
cnd.andEX("yp.tissueId", "=", tissueIdByUnion);
|
||||
cnd.andEX("yp.tissueId", "=", tissueIdByClub);
|
||||
cnd.and(Cnd.likeEX("yp.planName", planName));
|
||||
|
||||
Pagination pagination = yearPlanService.pageData(pageForm, cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询活动类型")
|
||||
@SaCheckPermission("planSummary.yearPlan.manage")
|
||||
public Result queryActivityType() {
|
||||
List<ActivityBasicSettings> list = dao.query(ActivityBasicSettings.class, Cnd.where("parentId", "=", "b3b6bafe6dd74aa8b69691b6b75b50fd").asc("code"));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询单个年度计划")
|
||||
@SaCheckPermission("planSummary.yearPlan.manage")
|
||||
public Result fetchOne(String id) {
|
||||
YearPlan plan = yearPlanService.fetch(id);
|
||||
ActivityBasicSettings settings = dao.fetch(ActivityBasicSettings.class, Cnd.where("id", "=", plan.getActivityType()));
|
||||
NutMap nutMap = Lang.obj2nutmap(plan);
|
||||
nutMap.put("activityTypeName", settings.getName());
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改年度计划")
|
||||
@SaCheckPermission("planSummary.yearPlan.manage")
|
||||
@SLog(type = "yearPlan", tag = "新增/修改年度计划", msg = "新增/修改年度计划")
|
||||
public Object onSubmit(YearPlan yearPlan) {
|
||||
yearPlanService.insertOrUpdate(yearPlan);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除年度计划")
|
||||
@SaCheckPermission("planSummary.yearPlan.manage")
|
||||
@SLog(type = "yearPlan", tag = "删除年度计划", msg = "删除年度计划")
|
||||
public Object onDelete(String id) {
|
||||
yearPlanService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取工会")
|
||||
@SaCheckPermission("planSummary.yearPlan.manage")
|
||||
public Result queryUnion() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name()) && AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and(Sys_union::getId, "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
cnd.asc(Sys_union::getUnionCode);
|
||||
List<Sys_union> list = dao.query(Sys_union.class, cnd);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取协会")
|
||||
@SaCheckPermission("planSummary.yearPlan.manage")
|
||||
public Result queryClub() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name()) && AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name())) {
|
||||
List<SysClub> clubList = sysClubService.getMyManageClub();
|
||||
List<String> list = clubList.stream().map(SysClub::getId).toList();
|
||||
cnd.and(SysClub::getId, "in", list);
|
||||
}
|
||||
cnd.asc(SysClub::getClubCode);
|
||||
List<SysClub> list = dao.query(SysClub.class, cnd);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
package com.budwk.app.zhgh.activity.planSummary.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicSettings;
|
||||
import com.budwk.app.zhgh.activity.planSummary.model.YearPlan;
|
||||
import com.budwk.app.zhgh.activity.planSummary.model.YearSummary;
|
||||
import com.budwk.app.zhgh.activity.planSummary.service.YearPlanService;
|
||||
import com.budwk.app.zhgh.activity.planSummary.service.YearSummaryService;
|
||||
import com.budwk.app.zhgh.club.model.SysClub;
|
||||
import com.budwk.app.zhgh.club.service.SysClubService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName YearSummaryController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 16:15
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "年度总结")
|
||||
@At("/platform/yearSummary/manage")
|
||||
public class YearSummaryController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private YearSummaryService yearSummaryService;
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("planSummary.yearSummary.manage")
|
||||
@Ok("beetl:/platform/zhgh/activity/planSummary/yearSummary/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("planSummary.yearSummary.manage")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "tissueIdByUnion") String tissueIdByUnion,
|
||||
@Param(value = "tissueIdByClub") String tissueIdByClub,
|
||||
@Param(value = "summaryType") String summaryType,
|
||||
@Param(value = "summaryFrom") String summaryFrom) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.andEX("YEAR(ys.cTime)", "=", year);
|
||||
cnd.andEX("ys.tissueId", "=", tissueIdByUnion);
|
||||
cnd.andEX("ys.tissueId", "=", tissueIdByClub);
|
||||
cnd.andEX("ys.summaryType", "=", summaryType);
|
||||
cnd.andEX("ys.summaryFrom", "=", summaryFrom);
|
||||
|
||||
Pagination pagination = yearSummaryService.pageData(pageForm, cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询单个年度总结")
|
||||
@SaCheckPermission("planSummary.yearSummary.manage")
|
||||
public Result fetchOne(String id) {
|
||||
YearSummary summary = yearSummaryService.fetch(id);
|
||||
Sys_dict dict = dao.fetch(Sys_dict.class, Cnd.where("code", "=", summary.getSummaryType()));
|
||||
NutMap nutMap = Lang.obj2nutmap(summary);
|
||||
nutMap.put("summaryTypeName", dict.getName());
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改年度总结")
|
||||
@SaCheckPermission("planSummary.yearSummary.manage")
|
||||
@SLog(type = "yearSummary", tag = "新增/修改年度总结", msg = "新增/修改年度总结")
|
||||
public Object onSubmit(YearSummary yearSummary) {
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
|
||||
yearSummary.setUserId(SecurityUtil.getUserId());
|
||||
yearSummary.setCTime(DateUtil.now());
|
||||
yearSummary.setLoginName(user.getLoginname());
|
||||
yearSummary.setUserName(user.getUsername());
|
||||
yearSummary.setUnitId(user.getUnitId());
|
||||
yearSummary.setUnitName(user.getUnitName());
|
||||
yearSummary.setUnionId(user.getUnionId());
|
||||
yearSummary.setUnionName(user.getUnionName());
|
||||
yearSummaryService.insertOrUpdate(yearSummary);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除年度总结")
|
||||
@SaCheckPermission("planSummary.yearSummary.manage")
|
||||
@SLog(type = "yearSummary", tag = "删除年度总结", msg = "删除年度总结")
|
||||
public Object onDelete(String id) {
|
||||
yearSummaryService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.budwk.app.zhgh.activity.planSummary.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @ClassName Plan
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 13:53
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("年度计划")
|
||||
@Accessors(chain = true)
|
||||
@Table("year_plan")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class YearPlan extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("计划名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String planName;
|
||||
|
||||
@Column
|
||||
@Comment("计划时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String planTime;
|
||||
|
||||
@Column
|
||||
@Comment("计划内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String content;
|
||||
|
||||
@Column
|
||||
@Comment("预算费用")
|
||||
@ColDefine(type = ColType.FLOAT)
|
||||
private Double money;
|
||||
|
||||
@Column
|
||||
@Comment("计划类型(40001-校活动、40002-分工会活动、40003-协会社团活动)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 7)
|
||||
private String planType;
|
||||
|
||||
@Column
|
||||
@Comment("分工会ID或社团ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String tissueId;
|
||||
|
||||
@Column
|
||||
@Comment("分工会或社团")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String tissueName;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityType;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.budwk.app.zhgh.activity.planSummary.model;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName Summary
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 13:53
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("年度总结")
|
||||
@Accessors(chain = true)
|
||||
@Table("year_summary")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class YearSummary extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("提交人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("提交人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("提交人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("提交人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("提交人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("提交人工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("提交人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("提交时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String cTime;
|
||||
|
||||
@Column
|
||||
@Comment("工会/协会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String tissueId;
|
||||
|
||||
@Column
|
||||
@Comment("分工会或社团")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String tissueName;
|
||||
|
||||
@Column
|
||||
@Comment("总结类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String summaryType;
|
||||
|
||||
@Column
|
||||
@Comment("总结来源(1-校活动、2-分工会活动、3协会社团活动)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String summaryFrom;
|
||||
|
||||
@Column
|
||||
@Comment("文件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> files;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.budwk.app.zhgh.activity.planSummary.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.planSummary.model.YearPlan;
|
||||
import org.nutz.dao.Cnd;
|
||||
|
||||
/**
|
||||
* @ClassName YearPlanService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 16:16
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface YearPlanService extends BaseService<YearPlan> {
|
||||
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.budwk.app.zhgh.activity.planSummary.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.planSummary.model.YearSummary;
|
||||
import org.nutz.dao.Cnd;
|
||||
|
||||
/**
|
||||
* @ClassName YearSummaryService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 16:17
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface YearSummaryService extends BaseService<YearSummary> {
|
||||
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd);
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.budwk.app.zhgh.activity.planSummary.service.impl;
|
||||
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.planSummary.model.YearPlan;
|
||||
import com.budwk.app.zhgh.activity.planSummary.service.YearPlanService;
|
||||
import com.budwk.app.zhgh.club.model.SysClub;
|
||||
import com.budwk.app.zhgh.club.service.SysClubService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName YearPlanServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 16:16
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class YearPlanServiceImpl extends BaseServiceImpl<YearPlan> implements YearPlanService {
|
||||
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
public YearPlanServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
yp.*,
|
||||
ab.name as activityTypeName,
|
||||
year(yp.planTime) as `year`,
|
||||
((SELECT COUNT(1) FROM activity_school acs WHERE acs.planId = yp.id) >0 ) carryOut
|
||||
FROM
|
||||
year_plan yp
|
||||
left join activity_basic_settings ab on ab.id = yp.activityType
|
||||
$condition
|
||||
""");
|
||||
if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
if(AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
group.or("yp.tissueId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
if(AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name())) {
|
||||
List<SysClub> clubList = sysClubService.getMyManageClub();
|
||||
List<String> list = clubList.stream().map(SysClub::getId).toList();
|
||||
group.or("yp.tissueId", "in", list);
|
||||
}
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.desc("yp.planTime");
|
||||
sql.setCondition(cnd);
|
||||
return this.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package com.budwk.app.zhgh.activity.planSummary.service.impl;
|
||||
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.planSummary.model.YearSummary;
|
||||
import com.budwk.app.zhgh.activity.planSummary.service.YearSummaryService;
|
||||
import com.budwk.app.zhgh.club.model.SysClub;
|
||||
import com.budwk.app.zhgh.club.model.SysClubUser;
|
||||
import com.budwk.app.zhgh.club.service.SysClubService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName YearSummaryServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 16:17
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class YearSummaryServiceImpl extends BaseServiceImpl<YearSummary> implements YearSummaryService {
|
||||
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
public YearSummaryServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ys.*,
|
||||
d.name as summaryTypeName,
|
||||
year(ys.cTime) as `year`
|
||||
FROM
|
||||
year_summary ys
|
||||
left join sys_dict d on d.code = ys.summaryType
|
||||
$condition
|
||||
""");
|
||||
if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
if(AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
group.or("ys.tissueId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
if(AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name())) {
|
||||
List<SysClub> clubList = sysClubService.getMyManageClub();
|
||||
List<String> list = clubList.stream().map(SysClub::getId).toList();
|
||||
group.or("ys.tissueId", "in", list);
|
||||
}
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.desc("ys.cTime");
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -15,9 +15,9 @@ import lombok.Getter;
|
||||
public enum ColumnFormTypeEnum {
|
||||
|
||||
INPUT("INPUT", "输入框"),
|
||||
SELECT("SELECT", "选择框"),//选项数组,
|
||||
SELECT("SELECT", "选择框"),
|
||||
//RADIO("RADIO", "单选框"),//选项数组
|
||||
FILE("FILE", "文件");//上传个数,格式
|
||||
FILE("FILE", "文件");
|
||||
|
||||
private String code;
|
||||
private String description;
|
||||
|
||||
+16
-18
@@ -2,10 +2,13 @@ package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
@@ -29,27 +32,21 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Api(tags = "新建品牌活动")
|
||||
@At("/platform/trainSingUp/manage/activity")
|
||||
public class TrainSignUpActivityAddController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("/add")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/add/index.html")
|
||||
public void add() {
|
||||
}
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@POST
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
public Result doHandle(@Param(value = "data") String data) {
|
||||
TrainSignUpActivity activity = Json.fromJson(TrainSignUpActivity.class, data);
|
||||
@ApiOperation("品牌活动新增/修改")
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
@SLog(type = "trainSignUp", tag = "新增/修改活动", msg = "新增/修改活动")
|
||||
public Result doHandle(TrainSignUpActivity activity) {
|
||||
if (StrUtil.isBlank(activity.getId())) {
|
||||
trainSignUpActivityManageService.add(activity, null);
|
||||
} else {
|
||||
@@ -60,7 +57,8 @@ public class TrainSignUpActivityAddController {
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
@ApiOperation("获取分工会人数限制")
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result getUnionLimit(@Param(value = "activityScopeId") String activityScopeId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -83,18 +81,18 @@ public class TrainSignUpActivityAddController {
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
@ApiOperation("获取报名人员数量")
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result getRegisterUserCount(@Param(value = "courseId") String courseId) {
|
||||
//已报人数
|
||||
return Result.success().addData(dao.count(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId)));
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
@ApiOperation("获取历史活动列表")
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result getHistoricalActList() {
|
||||
List<TrainSignUpActivity> query = dao.query(TrainSignUpActivity.class, Cnd.NEW().desc("activityStartTime"));
|
||||
return Result.success().addData(query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+129
-97
@@ -1,6 +1,7 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
@@ -8,11 +9,13 @@ import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivityCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpType;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyCourse;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityStatisticsService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -20,12 +23,14 @@ import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -34,112 +39,139 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动报名")
|
||||
@At("/platform/trainSingUp/manage/apply")
|
||||
public class TrainSignUpActivityApplyController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityService;
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityService;
|
||||
@Inject
|
||||
private SysDictService dictService;
|
||||
@Inject
|
||||
private TrainSignUpActivityStatisticsService statisticsService;
|
||||
|
||||
@Inject
|
||||
private SysDictService dictService;
|
||||
@At("")
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/apply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/apply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
@At
|
||||
@ApiOperation("活动查询")
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result activityData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("`year`", "=", year);
|
||||
//查询报名中
|
||||
if (activityType == 2) {
|
||||
cnd.and(new Static("now() > activitySignUpStartTime and now() < activitySignUpEndTime"));
|
||||
}//查询已结束的
|
||||
else if (activityType == 3) {
|
||||
cnd.and(new Static("now() > activityEndTime"));
|
||||
}
|
||||
|
||||
if (AuthUtil.hasRole("H04") && !AuthUtil.hasRoleOr("sysadmin, A06")) {
|
||||
cnd.and("activityMode", "=", 2).and("createdBy", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result activityData(@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("`year`", "=", year);
|
||||
//查询报名中
|
||||
if (activityType == 2) {
|
||||
cnd.and(new Static("now() > activitySignUpStartTime and now() < activitySignUpEndTime"));
|
||||
}//查询已结束的
|
||||
else if (activityType == 3) {
|
||||
cnd.and(new Static("now() > activityEndTime"));
|
||||
}
|
||||
Pagination pagination = trainSignUpActivityService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
List<TrainSignUpActivity> trainSignUpActivities = pagination.getList();
|
||||
Map<String, String> trainSignUpTypeMap = dictService.getSubListByCode("TRAIN_SIGNUP_TYPE").stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
trainSignUpActivities.forEach(v -> v.setTrainType(trainSignUpTypeMap.get(v.getTrainType())));
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
if(AuthUtil.hasRole("H04") && !AuthUtil.hasRoleOr("sysadmin, A06")) {
|
||||
cnd.and("activityMode", "=", 2).and("createdBy", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
@At
|
||||
@ApiOperation("分活动查询")
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "courseTypeId") String courseTypeId,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "assortTypes") String[] assortTypes) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.activityId,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseType,
|
||||
tsuc.courseLocationCoordinates,
|
||||
tsuc.courseReservedNumber,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.campus,
|
||||
tsuc.unionLimit,
|
||||
tsuc.isMobileSign,
|
||||
tsuc.signType,
|
||||
tsuc.isReceiveGift,
|
||||
tsuc.giftType,
|
||||
tsuc.reserveMode,
|
||||
tsuc.waitingNum,
|
||||
tsuc.assort,
|
||||
type.typeName,
|
||||
tsuc.courseIsLimitApply
|
||||
FROM
|
||||
`train_sign_up_course` tsuc
|
||||
LEFT JOIN train_sign_up_type type ON type.id = tsuc.courseType
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("type.id", "=", courseTypeId);
|
||||
cnd.and("tsuc.activityId", "=", activityId);
|
||||
if(Lang.isNotEmpty(assortTypes)) {
|
||||
cnd.and("tsuc.assort", "in", assortTypes);
|
||||
}
|
||||
|
||||
List<TrainSignUpActivity> trainSignUpActivities = trainSignUpActivityService.query(cnd);
|
||||
Map<String, String> trainSignUpTypeMap = dictService.getSubListByCode("TRAIN_SIGNUP_TYPE").stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
trainSignUpActivities.forEach(v->v.setTrainType(trainSignUpTypeMap.get(v.getTrainType())));
|
||||
return Result.success(trainSignUpActivities);
|
||||
}
|
||||
List<TrainSignUpCourse> courseArray = trainSignUpActivityService.dao().query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
courseArray = trainSignUpActivityService.filterCourseByHostUnion(courseArray);
|
||||
cnd.and("tsuc.id", "in", courseArray.stream().map(TrainSignUpCourse::getId).toList());
|
||||
|
||||
cnd.asc("tsuc.orderNum");
|
||||
cnd.asc("type.code");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "courseTypeId") String courseTypeId,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.activityId,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseType,
|
||||
tsuc.courseLocationCoordinates,
|
||||
tsuc.courseReservedNumber,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.campus,
|
||||
tsuc.unionLimit,
|
||||
tsuc.isMobileSign,
|
||||
tsuc.signType,
|
||||
tsuc.isReceiveGift,
|
||||
tsuc.giftType,
|
||||
tsuc.reserveMode,
|
||||
type.lxname
|
||||
FROM
|
||||
`train_sign_up_course` tsuc
|
||||
LEFT JOIN train_sign_up_type type ON type.id = tsuc.courseType
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("type.id","=",courseTypeId);
|
||||
cnd.and("tsuc.activityId","=",activityId);
|
||||
cnd.asc("type.code");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = trainSignUpActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
|
||||
Pagination pagination = trainSignUpActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
courseList.forEach(c -> {
|
||||
c.put("hasRegisterNum", statisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
|
||||
c.put("hasWaitingNum", statisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
|
||||
//当前用户是否报过
|
||||
c.put("isSign", trainSignUpActivityService.isSignCourseByUser(c.getString("id"), SecurityUtil.getUserId()));
|
||||
|
||||
courseList.forEach(c -> {
|
||||
TrainSignUpType type = trainSignUpActivityService.dao().fetch(TrainSignUpType.class, c.getString("courseType"));
|
||||
// trainSignUpActivityService.dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
//已报人数
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<TrainSignUpUser> signUpUsers = trainSignUpActivityService.dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", c.getString("id")));
|
||||
signUpUsers.forEach(item -> {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().ifPresent(nutMap -> hasRegisterNum.addAndGet(nutMap.getInt("columnValue")));
|
||||
}
|
||||
}
|
||||
});
|
||||
c.put("hasRegisterNum",hasRegisterNum.get());
|
||||
//当前用户是否报过
|
||||
c.put("isSign",trainSignUpActivityService.isSignCourseByUser(c.getString("id"), SecurityUtil.getUserId()));
|
||||
});
|
||||
return Result.success(pagination);
|
||||
}
|
||||
if(StrUtil.isNotBlank(c.getString("unionLimit"))) {
|
||||
List<NutMap> unionLimit = Json.fromJsonAsList(NutMap.class, c.getString("unionLimit"));
|
||||
if(Lang.isNotEmpty(unionLimit)) {
|
||||
NutMap nutMap = unionLimit.stream().filter(o -> o.getString("id").equals(SecurityUtil.getUnionId())).findFirst().orElse(null);
|
||||
if(nutMap != null) {
|
||||
c.put("coursePeopleNumber", nutMap.getInt("limitCount"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result getCourseTime(String id){
|
||||
List<TrainSignUpActivityCourse> list = trainSignUpActivityService.dao().query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", id));
|
||||
return Result.success(list);
|
||||
}
|
||||
@At
|
||||
@ApiOperation("获取分活动时间")
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result getCourseTime(String id) {
|
||||
List<TrainSignUpActivityCourse> list = trainSignUpActivityService.dao().query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", id));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询分类标识集合")
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result queryCourseAssort(String activityId) {
|
||||
List<TrainSignUpCourse> courseList = trainSignUpActivityService.dao().query(TrainSignUpCourse.class, Cnd.where(TrainSignUpCourse::getActivityId, "=", activityId).asc(TrainSignUpCourse::getOrderNum));
|
||||
if(Lang.isEmpty(courseList)) {
|
||||
return Result.success(new ArrayList<>());
|
||||
}
|
||||
List<String> assortList = courseList.stream().map(TrainSignUpCourse::getAssort).filter(StrUtil::isNotBlank).toList();
|
||||
return Result.success(assortList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+11
-16
@@ -3,11 +3,14 @@ package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -27,7 +30,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训报名 活动管理
|
||||
@@ -36,12 +38,12 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动管理")
|
||||
@At("/platform/trainSingUp/manage/activity")
|
||||
public class TrainSignUpActivityController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@@ -52,6 +54,7 @@ public class TrainSignUpActivityController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@@ -64,8 +67,10 @@ public class TrainSignUpActivityController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动删除")
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result doDelete(String id) {
|
||||
@SLog(type = "trainSignUp", tag = "删除活动", msg = "删除活动")
|
||||
public Result onDelete(String id) {
|
||||
Trans.exec(() -> {
|
||||
trainSignUpActivityManageService.delete(id);
|
||||
dao.clear(TrainSignUpCourse.class, Cnd.where("activityId", "=", id));
|
||||
@@ -80,18 +85,7 @@ public class TrainSignUpActivityController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result doHandle(@Param("data") String data) {
|
||||
TrainSignUpActivity activity = Json.fromJson(TrainSignUpActivity.class, data);
|
||||
if (StrUtil.isBlank(activity.getId())) {
|
||||
trainSignUpActivityManageService.add(activity, null);
|
||||
} else {
|
||||
trainSignUpActivityManageService.edit(activity);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动状态变更")
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result activityStatusChange(TrainSignUpActivity activity) {
|
||||
trainSignUpActivityManageService.updateActivityStatus(activity);
|
||||
@@ -102,6 +96,7 @@ public class TrainSignUpActivityController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询单个活动")
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result findOne(@Param("id") @NotNull String id) {
|
||||
NutMap dataMap = trainSignUpActivityManageService.findOne(id, null, "");
|
||||
@@ -125,7 +120,7 @@ public class TrainSignUpActivityController {
|
||||
|
||||
//查询所有的课程类型
|
||||
List<TrainSignUpType> trainSignUpTypeList = dao.query(TrainSignUpType.class, Cnd.NEW());
|
||||
Map<String, String> typeMap = trainSignUpTypeList.stream().collect(Collectors.toMap(TrainSignUpType::getId, TrainSignUpType::getLxname));
|
||||
Map<String, String> typeMap = trainSignUpTypeList.stream().collect(Collectors.toMap(TrainSignUpType::getId, TrainSignUpType::getTypeName));
|
||||
|
||||
courseList.forEach(v -> {
|
||||
|
||||
|
||||
+20
-5
@@ -1,7 +1,9 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
@@ -9,6 +11,8 @@ import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
@@ -37,12 +41,12 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动类型管理")
|
||||
@At("/platform/trainSingUp/manage/type")
|
||||
public class TrainSignUpTypeController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@@ -53,15 +57,16 @@ public class TrainSignUpTypeController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "lxname") String lxname) {
|
||||
@Param(value = "typeName") String typeName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
select * from train_sign_up_type $condition
|
||||
""");
|
||||
if (Strings.isNotBlank(lxname)) {
|
||||
cnd.and("lxname", "like", "%" + lxname + "%");
|
||||
if (Strings.isNotBlank(typeName)) {
|
||||
cnd.and("typeName", "like", "%" + typeName + "%");
|
||||
}
|
||||
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
@@ -71,7 +76,7 @@ public class TrainSignUpTypeController {
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.stream().forEach(item -> {
|
||||
list.forEach(item -> {
|
||||
Cnd c = Cnd.NEW();
|
||||
c.and("typeId", "=", item.getString("id"));
|
||||
c.asc("columnIndex");
|
||||
@@ -83,7 +88,9 @@ public class TrainSignUpTypeController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型新增")
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
@SLog(type = "trainSignUp", tag = "活动类型新增", msg = "活动类型新增")
|
||||
public Result doAdd(@Param("data") String data) throws Exception {
|
||||
TrainSignUpType type = Json.fromJson(TrainSignUpType.class, data);
|
||||
int count = dao.count(TrainSignUpType.class, Cnd.where("code", "=", type.getCode()));
|
||||
@@ -97,7 +104,9 @@ public class TrainSignUpTypeController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型修改")
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
@SLog(type = "trainSignUp", tag = "活动类型修改", msg = "活动类型修改")
|
||||
public Result doEdit(TrainSignUpType type) {
|
||||
int count = dao.count(TrainSignUpType.class, Cnd.where("code", "=", type.getCode()).and("id", "!=", type.getId()));
|
||||
if (count > 0) {
|
||||
@@ -110,7 +119,9 @@ public class TrainSignUpTypeController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型删除")
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
@SLog(type = "trainSignUp", tag = "活动类型删除", msg = "活动类型删除")
|
||||
public Object doDelete(@Param(value = "id") String id) {
|
||||
dao.clear(TrainSignUpType.class, Cnd.where("id", "=", id));
|
||||
dao.clear(TrainMobileSignColumn.class, Cnd.where("typeId", "=", id));
|
||||
@@ -119,6 +130,7 @@ public class TrainSignUpTypeController {
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("排序号变更")
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
public Object xhChange(String id, Integer xh, boolean toDown) {
|
||||
if (toDown) {
|
||||
@@ -136,6 +148,8 @@ public class TrainSignUpTypeController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取所有类型")
|
||||
@SaCheckLogin
|
||||
public Result getAllType(@Param(value = "id") String id) {
|
||||
List<TrainSignUpType> trainSignUpTypeList = dao.query(TrainSignUpType.class, Cnd.NEW().andEX("id", "=", id).asc("xh"));
|
||||
dao.fetchLinks(trainSignUpTypeList, "trainMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
@@ -143,6 +157,7 @@ public class TrainSignUpTypeController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("自定义表单字段类型")
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
public Result getColumnType() {
|
||||
List<String> names = EnumUtil.getNames(ColType.class);
|
||||
|
||||
+31
-23
@@ -2,16 +2,18 @@ package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivityCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUserCourse;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyType;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
@@ -19,6 +21,7 @@ import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
@@ -26,29 +29,28 @@ import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/9/21
|
||||
* @Description 人员调整
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/trainSingUp/manage/userAdjust")
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "品牌活动人员调整")
|
||||
@At("/platform/trainSingUp/manage/userAdjust")
|
||||
public class TrainSignUpUserAdjustController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityStatisticsService trainSignUpActivityStatisticsService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
@Inject
|
||||
private TrainSignUpActivityStatisticsService trainSignUpActivityStatisticsService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
@@ -58,11 +60,11 @@ public class TrainSignUpUserAdjustController {
|
||||
|
||||
/**
|
||||
* 活动list
|
||||
*
|
||||
* @param year 年度
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("活动列表")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result activityList(@Param(value = "year") Integer year) {
|
||||
List<TrainSignUpActivity> activityList = dao.query(TrainSignUpActivity.class, Cnd.NEW().andEX("year", "=", year).andEX("isDisabled", "=", false).desc("activityStartTime"));
|
||||
@@ -70,6 +72,7 @@ public class TrainSignUpUserAdjustController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
@@ -78,6 +81,7 @@ public class TrainSignUpUserAdjustController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("子活动查询")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result getCourse(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
@@ -89,7 +93,8 @@ public class TrainSignUpUserAdjustController {
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.courseReservedNumber,
|
||||
( SELECT count( 1 ) FROM train_sign_up_user WHERE courseId = tsuc.id ) registerNum
|
||||
tsuc.waitingNum,
|
||||
tsuc.reserveMode
|
||||
FROM
|
||||
`train_sign_up_course` tsuc
|
||||
WHERE
|
||||
@@ -97,16 +102,16 @@ public class TrainSignUpUserAdjustController {
|
||||
ORDER BY courseName asc
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
return Result.success(baseService.listMap(sql));
|
||||
List<NutMap> courseList = baseService.listMap(sql);
|
||||
courseList.forEach(c -> {
|
||||
c.put("registerNum", trainSignUpActivityStatisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
|
||||
c.put("hasWaitingNum", trainSignUpActivityStatisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
|
||||
});
|
||||
return Result.success(courseList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班报名人员list
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("报名用户列表")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result registerUserList(@Param("courseId") String courseId,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@@ -118,7 +123,9 @@ public class TrainSignUpUserAdjustController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("人员调整")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
@SLog(type = "trainSingUp", tag = "人员调整", msg = "人员调整")
|
||||
public Result adjust(String activityId, String oldCourseId, String newCourseId, String userId) {
|
||||
|
||||
Cnd oldCnd = Cnd.where("activityId", "=", activityId)
|
||||
@@ -151,12 +158,13 @@ public class TrainSignUpUserAdjustController {
|
||||
trainSignUpUserCourseList.add(course);
|
||||
});
|
||||
dao.insert(trainSignUpUserCourseList);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除报名人员")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
@SLog(type = "trainSingUp", tag = "删除报名人员", msg = "删除报名人员")
|
||||
public Result deleteSignUser(String activityId, String courseId, String userId) {
|
||||
|
||||
//删除
|
||||
|
||||
+14
-1
@@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
@@ -13,6 +14,8 @@ import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpBlackListService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Chain;
|
||||
@@ -41,12 +44,12 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "亲子活动人员黑名单")
|
||||
@At("/platform/trainSingUp/userManage")
|
||||
public class TrainSignUpUserBlackListManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private TrainSignUpBlackListService trainSignUpBlackListService;
|
||||
|
||||
@@ -57,6 +60,7 @@ public class TrainSignUpUserBlackListManageController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@@ -80,13 +84,16 @@ public class TrainSignUpUserBlackListManageController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("报名人员处理")
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
@SLog(type = "trainSingUp", tag = "报名人员处理", msg = "报名人员处理")
|
||||
public Result doHandleUser(@Param("userId") String userId) {
|
||||
trainSignUpBlackListService.doHandleUser(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("根据活动Id获取子活动")
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result getCourseByActivityId(@Param("activityId") String activityId) {
|
||||
List<TrainSignUpCourse> list = dao.query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
@@ -94,6 +101,7 @@ public class TrainSignUpUserBlackListManageController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取子活动具体时间")
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result attendClassRecord(String userId) {
|
||||
trainSignUpBlackListService.attendClassRecord(userId);
|
||||
@@ -101,6 +109,7 @@ public class TrainSignUpUserBlackListManageController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取候补人员")
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result getReserveUser(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
@@ -121,7 +130,9 @@ public class TrainSignUpUserBlackListManageController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("补充人员")
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
@SLog(type = "trainSingUp", tag = "补充人员", msg = "补充人员")
|
||||
public Result reserveSingUp(String[] ids, String courseId) {
|
||||
//先查询这个课程有多少个未签到的人员
|
||||
Sql sql = Sqls.create("""
|
||||
@@ -151,6 +162,7 @@ public class TrainSignUpUserBlackListManageController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出签到人员")
|
||||
public void exportSignPerson(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) {
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, activityId);
|
||||
@@ -242,6 +254,7 @@ public class TrainSignUpUserBlackListManageController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出领取人员")
|
||||
public void exportGiftPerson(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) {
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, activityId);
|
||||
|
||||
+133
-29
@@ -3,23 +3,34 @@ package com.budwk.app.zhgh.activity.trainSignUp.controller.mobile;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyActivity;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyCourse;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -30,6 +41,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "亲子活动移动端")
|
||||
@At("/platform/mobile/trainSignUpActivity")
|
||||
public class MTrainSignUpActivityController {
|
||||
|
||||
@@ -61,6 +73,7 @@ public class MTrainSignUpActivityController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityStatus") int activityStatus,
|
||||
@@ -76,6 +89,7 @@ public class MTrainSignUpActivityController {
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("查询单个活动")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result findOne(@Param("id") String id,
|
||||
@Param(value = "tabIndex") Integer tabIndex,
|
||||
@@ -86,10 +100,46 @@ public class MTrainSignUpActivityController {
|
||||
List<String> mySignCourseIdList = mySignCourseList.stream().map(TrainSignUpUser::getCourseId).collect(Collectors.toList());
|
||||
cnd.and("id", "in", mySignCourseIdList);
|
||||
}
|
||||
return Result.success(trainSignUpActivityService.findOne(id, cnd, fromMode));
|
||||
NutMap nutMap = trainSignUpActivityService.findOne(id, cnd, fromMode);
|
||||
List<TrainSignUpCourse> courseList = nutMap.getAsList("courseList", TrainSignUpCourse.class);
|
||||
courseList.forEach(v -> {
|
||||
if (v.getCourseIsLimitApply() != null && v.getCourseIsLimitApply() && v.getIsSign()) {
|
||||
TrainSignUpActivityCourse course = dao.fetch(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", v.getId()));
|
||||
v.setCourseTimeName(DateUtil.format(course.getCourseStartTime(), "HH:mm") + "至" + DateUtil.format(course.getCourseEndTime(), "HH:mm") + "段");
|
||||
}
|
||||
});
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询子活动时间段")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Object getCourseTimeSelectList(String courseId) {
|
||||
// 查课程的时间段
|
||||
List<TrainSignUpActivityCourse> courseList = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
|
||||
// 查课程的报名人数
|
||||
List<TrainSignUpUserCourse> applyUserList = dao.query(TrainSignUpUserCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
// 按照课程下面时间段去分组
|
||||
Map<String, List<TrainSignUpUserCourse>> collectMap = applyUserList.stream().collect(Collectors.groupingBy(TrainSignUpUserCourse::getActivityCourseId));
|
||||
List<NutMap> list = courseList.stream().map(v -> {
|
||||
String id = v.getId();
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
List<TrainSignUpUserCourse> trainSignUpUserCourses = collectMap.get(id);
|
||||
int remainingNum = v.getCourseLimitNum();
|
||||
if (Lang.isNotEmpty(trainSignUpUserCourses)) {
|
||||
remainingNum = v.getCourseLimitNum() - trainSignUpUserCourses.size();
|
||||
}
|
||||
nutMap.put("remainingNum", remainingNum);
|
||||
nutMap.put("text", DateUtil.format(v.getCourseStartTime(), "HH:mm") + "至" + DateUtil.format(v.getCourseEndTime(), "HH:mm") + "段(剩" + remainingNum + ")");
|
||||
nutMap.put("value", id);
|
||||
return nutMap;
|
||||
}).filter(v-> v.getInt("remainingNum") != 0).toList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报名")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result doSignUp(TrainSignUpUser trainSignUpUser) {
|
||||
try {
|
||||
@@ -109,13 +159,13 @@ public class MTrainSignUpActivityController {
|
||||
number = map != null ? map.getInt("columnValue") : 0;
|
||||
}
|
||||
}
|
||||
boolean signFull = trainSignUpActivityService.isSignFull(trainSignUpUser.getCourseId(), number);
|
||||
boolean signFull = trainSignUpActivityService.isSignFull(course, number);
|
||||
if(signFull) {
|
||||
return Result.error("当前报名人数已满");
|
||||
}
|
||||
boolean signFullByUnionId = trainSignUpActivityService.isSignFullByUnionId(trainSignUpUser.getCourseId(), number);
|
||||
boolean signFullByUnionId = trainSignUpActivityService.isSignFullByUnionId(course, number);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error("该活动您所在的分工会名额已报满");
|
||||
return Result.error("该活动您所在的分工会名额不足");
|
||||
}
|
||||
trainSignUpActivityService.doSignUp(trainSignUpUser);
|
||||
return Result.success("报名成功");
|
||||
@@ -128,19 +178,36 @@ public class MTrainSignUpActivityController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("取消报名")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result cancelSignUp(@Param("activityId") String activityId, @Param("courseId") String courseId) {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
//如果是正常报名取消了,将候补报名的按时间倒叙第一个改为正常报名
|
||||
//取消分两种情况
|
||||
//第一种没有设置分工会人数限制,那么将候补的人按时间倒叙往上补
|
||||
//第二种如果设置了分工会人数限制,那么只将本分工会的候补人员按照时间倒叙往上补,如果本分工会没有候补人员,则名额空出来,由校工会手动调整
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, activityId);
|
||||
TrainSignUpCourse course = dao.fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpType type = dao.fetch(TrainSignUpType.class, course.getCourseType());
|
||||
if(!type.getIsBringFamily() && course.getReserveMode() == 2) {
|
||||
List<TrainSignUpUser> signUpUsers = dao.query(TrainSignUpUser.class, Cnd.where("activityId", "=", activityId).and("courseId", "=", courseId)
|
||||
.and("state", "=", 2).desc("signUpTime"));
|
||||
if(!signUpUsers.isEmpty()) {
|
||||
//如果是正常报名取消了,将候补报名的按时间倒叙第一个改为正常报名
|
||||
Cnd cnd = Cnd.where("activityId", "=", activityId).and("courseId", "=", courseId)
|
||||
.and("state", "=", 2);
|
||||
//如果设置了分工会报名人数限制,则只查本分工会
|
||||
if (Lang.isNotEmpty(course.getUnionLimit())) {
|
||||
cnd.and(new Static(" userId in (select id from user where unionid = '%s')".formatted(SecurityUtil.getUnionId())));
|
||||
}
|
||||
cnd.asc("signUpTime");
|
||||
if (!type.getIsBringFamily() && course.getReserveMode() == 2) {
|
||||
List<TrainSignUpUser> signUpUsers = dao.query(TrainSignUpUser.class, cnd);
|
||||
int thisSignUpUserCount = dao.count(TrainSignUpUser.class,
|
||||
Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId)
|
||||
.and("state", "in", List.of(1, 3)));
|
||||
if (!signUpUsers.isEmpty() && thisSignUpUserCount > 0) {
|
||||
TrainSignUpUser trainSignUpUser = signUpUsers.get(0);
|
||||
trainSignUpUser.setState(1);
|
||||
dao.update(trainSignUpUser);
|
||||
Sys_user user = dao.fetch(Sys_user.class, trainSignUpUser.getUserId());
|
||||
//msgApi.sendTextMsg("【" + activity.getActivityName() + "】已候补成功,请按时参加活动!", user.getLoginname());
|
||||
}
|
||||
}
|
||||
//删除报名记录
|
||||
@@ -149,12 +216,13 @@ public class MTrainSignUpActivityController {
|
||||
|
||||
dao.clear("train_sign_up_user", Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId));
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("签到")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
@SLog(type = "family", tag = "签到", msg = "签到")
|
||||
public Result doQd(@Param("id") String id, @Param("courseId") String courseId, @Param("point") Double[] points) {
|
||||
TrainSignUpCourse course = dao.fetch(TrainSignUpCourse.class, courseId);
|
||||
List<Double> coursePoints = course.getCourseLocationCoordinates();
|
||||
@@ -181,6 +249,7 @@ public class MTrainSignUpActivityController {
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("获取签到信息")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result getQdInfoList(@Param("activityId") String activityId) {
|
||||
List<NutMap> list = trainSignUpActivityService.qdInfoByUserId(SecurityUtil.getUserId(), activityId);
|
||||
@@ -188,17 +257,21 @@ public class MTrainSignUpActivityController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("验证是否能报名")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result validateSignUp(String courseId,
|
||||
@Param(value = "cndId") String cndId,
|
||||
@Param(value = "currentFamilyNumber") Integer currentFamilyNumber) {
|
||||
try {
|
||||
lock.lock();
|
||||
if(StrUtil.isBlank(courseId)) {
|
||||
return Result.error("缺少参数");
|
||||
return Result.error("报名信息为空");
|
||||
}
|
||||
|
||||
currentFamilyNumber = currentFamilyNumber != null ? currentFamilyNumber : 0;
|
||||
TrainSignUpCourse course = dao.fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, course.getActivityId());
|
||||
|
||||
//判断时间
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpStartTime(), "yyyy-MM-dd HH:mm:ss") < 0) {
|
||||
return Result.error("报名未开始");
|
||||
}
|
||||
@@ -206,36 +279,40 @@ public class MTrainSignUpActivityController {
|
||||
return Result.error("报名已结束");
|
||||
}
|
||||
|
||||
//判断活动组别
|
||||
int count = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", activity.getActivityGroupId()).and("userId", "=", SecurityUtil.getUserId()));
|
||||
if(count == 0) {
|
||||
return Result.error("抱歉,您没有此次活动的权限");
|
||||
}
|
||||
|
||||
//判断是否报名
|
||||
boolean courseByUser = trainSignUpActivityService.isSignCourseByUser(courseId, SecurityUtil.getUserId());
|
||||
if(courseByUser) {
|
||||
return Result.error("您已报过该活动");
|
||||
return Result.error("抱歉,您已经报名");
|
||||
}
|
||||
//判断人数
|
||||
boolean signFull = trainSignUpActivityService.isSignFull(courseId, currentFamilyNumber);
|
||||
|
||||
//判断活动人数
|
||||
boolean signFull = trainSignUpActivityService.isSignFull(course, currentFamilyNumber);
|
||||
if(signFull) {
|
||||
return Result.error("当前报名人数已满");
|
||||
return Result.error("名额剩余数量不足");
|
||||
}
|
||||
boolean signCourse = trainSignUpActivityService.isSignCourse(courseId, activity.getId());
|
||||
|
||||
//判断活动限制
|
||||
boolean signCourse = trainSignUpActivityService.isSignCourse(course, activity);
|
||||
if(!signCourse) {
|
||||
if(activity.getRestrictLimit() != 3) {
|
||||
return Result.error("您选择的类型的培训班已达上限,不能再报该类型的培训班了");
|
||||
return Result.error("您选择的类型已达上限,不能再报该类型的了");
|
||||
} else {
|
||||
return Result.error(activity.getActivityName() + "限制报" + activity.getLimitNum() + "个活动,已达上限");
|
||||
}
|
||||
}
|
||||
boolean signFullByUnionId = trainSignUpActivityService.isSignFullByUnionId(courseId, currentFamilyNumber);
|
||||
|
||||
//判断分工会人数限制
|
||||
boolean signFullByUnionId = trainSignUpActivityService.isSignFullByUnionId(course, currentFamilyNumber);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error("该活动您所在的分工会名额已报满");
|
||||
}
|
||||
if(course.getReserveMode() == 2 && currentFamilyNumber == null) {
|
||||
//课程已报人数
|
||||
List<TrainSignUpUser> signUpUsers = dao.query(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId)
|
||||
.and("state", "!=", 2));
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
if(hasRegisterNum > course.getCoursePeopleNumber()) {
|
||||
return Result.error(3, "您当前的报名为候补报名状态");
|
||||
}
|
||||
return Result.error("您所在的分工会名额不足");
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -246,7 +323,34 @@ public class MTrainSignUpActivityController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("验证子活动是否能报名")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Object validateSourceSignUp(String activityCourseId) {
|
||||
try {
|
||||
lock.lock();
|
||||
// 该时间段下已报名的人数
|
||||
int count = dao.count(TrainSignUpUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId));
|
||||
// 获取改时间段下的活动课程限制报名人数
|
||||
TrainSignUpActivityCourse course = dao.fetch(TrainSignUpActivityCourse.class, activityCourseId);
|
||||
Integer courseLimitNum = course.getCourseLimitNum();
|
||||
// 报名加上自己,如果大于了限制人数,那就无法报名
|
||||
if (count + 1 > courseLimitNum) {
|
||||
return Result.error("该时间段名额已报满,请选择其他时段报名");
|
||||
} else {
|
||||
return Result.success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("二维码签到")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
@SLog(type = "family", tag = "二维码签到", msg = "二维码签到")
|
||||
public Result codeSign(String id, String codeCourseId, String clickCourseId) {
|
||||
if(StrUtil.isBlank(codeCourseId) || StrUtil.isBlank(clickCourseId)) {
|
||||
return Result.error("签到失败,没有获取到扫描信息");
|
||||
|
||||
+114
-93
@@ -6,16 +6,23 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import com.budwk.app.sys.utils.SysFileMinIoUtil;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpType;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.nutz.dao.Chain;
|
||||
@@ -26,6 +33,7 @@ import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
@@ -33,12 +41,11 @@ import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
@@ -49,18 +56,17 @@ import java.util.zip.ZipOutputStream;
|
||||
* @Description 培训报名 统计
|
||||
* @createTime 2022年02月23日 09:57:00
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/trainSingUp/statistics/activity")
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "品牌活动统计")
|
||||
@At("/platform/trainSingUp/statistics/activity")
|
||||
public class TrainSignUpActivityStatisticsController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityStatisticsService trainSignUpActivityStatisticsService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@@ -71,6 +77,7 @@ public class TrainSignUpActivityStatisticsController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
@@ -85,6 +92,7 @@ public class TrainSignUpActivityStatisticsController {
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("活动列表")
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result activityList(@Param(value = "year") Integer year) {
|
||||
List<TrainSignUpActivity> list = dao.query(TrainSignUpActivity.class, Cnd.NEW().andEX("year", "=", year).desc("activityStartTime"));
|
||||
@@ -98,11 +106,19 @@ public class TrainSignUpActivityStatisticsController {
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("报名人员列表")
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result registerUserList(@Param(value = "courseId") String courseId) {
|
||||
return Result.success(trainSignUpActivityStatisticsService.registerUserList(courseId));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("报名动态列")
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Object getTaleColumnInfo(@Param(value = "courseId") String courseId) {
|
||||
return Result.success(trainSignUpActivityStatisticsService.getTaleColumnInfo(courseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班上课签到信息
|
||||
*
|
||||
@@ -110,12 +126,14 @@ public class TrainSignUpActivityStatisticsController {
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("获取签到信息")
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result getSignInfo(@Param("courseId") String courseId) {
|
||||
return Result.success(trainSignUpActivityStatisticsService.getSignInfo(courseId));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("开放报名")
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result signChange(@Param("courseId") String courseId, @Param("openOtherUnion") Boolean openOtherUnion) {
|
||||
dao.update(TrainSignUpCourse.class, Chain.make("openOtherUnion", openOtherUnion)
|
||||
@@ -125,115 +143,118 @@ public class TrainSignUpActivityStatisticsController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出签到名单")
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public void exportSignUser(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode("报名人员.zip", StandardCharsets.UTF_8));
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ts.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
u.sex,
|
||||
if(ts.mobile is null, u.mobile, ts.mobile) as mobile,
|
||||
u.birthday,
|
||||
tsc.courseName,
|
||||
tsc.campus,
|
||||
ts.state
|
||||
FROM
|
||||
train_sign_up_user ts
|
||||
left join `vw_user` u on u.id = ts. userId
|
||||
left join train_sign_up_course tsc on tsc.id = ts.courseId
|
||||
WHERE
|
||||
ts.activityId = @activityId
|
||||
ORDER BY FIELD( ts.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
|
||||
""").setParam("activityId", activityId);
|
||||
List<NutMap> userList = trainSignUpActivityManageService.listMap(sql);
|
||||
userList.forEach(item -> {
|
||||
if (item.getInt("state") == 1) {
|
||||
item.setv("stateName", "正常报名");
|
||||
} else if (item.getInt("state") == 2) {
|
||||
item.setv("stateName", "候补报名");
|
||||
} else if (item.getInt("state") == 3) {
|
||||
item.setv("stateName", "正常报名(候补)");
|
||||
} else if (item.getInt("state") == 4) {
|
||||
item.setv("stateName", "无效报名(缺席)");
|
||||
}
|
||||
});
|
||||
try {
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, activityId);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ts.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.birthday,
|
||||
tsc.courseName
|
||||
FROM
|
||||
train_sign_up_user ts
|
||||
left join `vw_user` u on u.id = ts. userId
|
||||
left join train_sign_up_course tsc on tsc.id = ts.courseId
|
||||
WHERE
|
||||
ts.activityId = @activityId
|
||||
""").setParam("activityId", activityId);
|
||||
List<NutMap> userList = trainSignUpActivityManageService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("手机号", "mobile", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("生日", "birthday", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("报名状态", "stateName", 20));
|
||||
List<TrainSignUpCourse> courseList = dao.query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
List<TrainSignUpCourse> courseList = dao.query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
Map<String, TrainSignUpCourse> courseMap = courseList.stream().collect(Collectors.toMap(o -> o.getId(), o -> o));
|
||||
List<TrainSignUpType> trainSignUpTypeList = dao.query(TrainSignUpType.class, Cnd.NEW());
|
||||
dao.fetchLinks(trainSignUpTypeList, "trainMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
Map<String, TrainSignUpType> typeMap = trainSignUpTypeList.stream().collect(Collectors.toMap(TrainSignUpType::getId, o -> o));
|
||||
|
||||
//按校区分组
|
||||
Map<String, List<NutMap>> campus = userList.stream().collect(Collectors.groupingBy(o -> o.getString("campus")));
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("手机号", "mobile", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("生日", "birthday", 20));
|
||||
|
||||
campus.forEach((key, value) -> {
|
||||
Map<String, List<NutMap>> userListMap = value.stream().collect(Collectors.groupingBy(v -> v.getString("courseId")));
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
userListMap.forEach((k, v) -> {
|
||||
|
||||
//查询课程
|
||||
TrainSignUpCourse course = courseMap.get(k);
|
||||
//查询课程类型
|
||||
TrainSignUpType trainSignUpType = dao.fetch(TrainSignUpType.class, Cnd.where("id", "=", course.getCourseType()));
|
||||
dao.fetchLinks(trainSignUpType, "^trainMobileSignColumnList$");
|
||||
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
for (TrainSignUpCourse c : courseList) {
|
||||
String k = c.getCourseName();
|
||||
List<NutMap> v = userList.stream().filter(x -> x.getString("courseName").equals(k)).collect(Collectors.toList());
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setTitle(course.getCourseName());
|
||||
userExportParams.setSheetName(course.getCourseName());
|
||||
userExportParams.setType(ExcelType.XSSF);
|
||||
userExportParams.setSheetName(k);
|
||||
userExportParams.setType(ExcelType.HSSF);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>();
|
||||
currentEntities.addAll(excelCommonExportEntity);
|
||||
//将课程类型配置的移动端动态字段添加到excel列中
|
||||
List<TrainMobileSignColumn> trainMobileSignColumnList = trainSignUpType.getTrainMobileSignColumnList();
|
||||
if (trainMobileSignColumnList != null && trainMobileSignColumnList.size() > 0) {
|
||||
trainMobileSignColumnList.forEach(item -> {
|
||||
currentEntities.add(new ExcelExportEntity(item.getColumnName(), item.getColumnCode(), 20));
|
||||
});
|
||||
}
|
||||
|
||||
TrainSignUpType signUpType = typeMap.get(c.getCourseType());
|
||||
if (Lang.isNotEmpty(signUpType.getTrainMobileSignColumnList())) {
|
||||
for (TrainMobileSignColumn column : signUpType.getTrainMobileSignColumnList()) {
|
||||
ExcelExportEntity entity = new ExcelExportEntity();
|
||||
entity.setName(column.getColumnName());
|
||||
entity.setKey(column.getColumnCode());
|
||||
entity.setWidth(20);
|
||||
if (column.getColumnFormType().equals("FILE")) {
|
||||
entity.setType(2);
|
||||
entity.setExportImageType(2);
|
||||
}
|
||||
currentEntities.add(entity);
|
||||
}
|
||||
}
|
||||
for (NutMap userSignData : v) {
|
||||
String mobileColumnsValueStr = userSignData.getString("mobileColumnsValue");
|
||||
if (StrUtil.isNotBlank(mobileColumnsValueStr)) {
|
||||
List<NutMap> mobileColumnsValue = Json.fromJsonAsList(NutMap.class, mobileColumnsValueStr);
|
||||
for (NutMap cv : mobileColumnsValue) {
|
||||
if (cv.getString("columnFormType") != null && !cv.getString("columnFormType").equals("FILE")) {
|
||||
userSignData.addv(cv.getString("columnCode"), cv.getString("columnValue"));
|
||||
if (!"FILE".equals(cv.getString("columnFormType"))) {
|
||||
userSignData.put(cv.getString("columnCode"), cv.getString("columnValue"));
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(cv.getString("columnValue"))) {
|
||||
List<JSONObject> columnValue = Json.fromJsonAsList(JSONObject.class, cv.getString("columnValue"));
|
||||
if (columnValue.size() == 1) {
|
||||
JSONObject sysFile = columnValue.get(0);
|
||||
Sys_file file = dao.fetch(Sys_file.class, Cnd.where(Sys_file::getDownloadPath, "=", sysFile.get("url")));
|
||||
byte[] imageBytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath());
|
||||
if (imageBytes.length > 0) {
|
||||
userSignData.put(cv.getString("columnCode"), imageBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
service.createSheetForMap(workbook, userExportParams, currentEntities, v);
|
||||
});
|
||||
try {
|
||||
zipOutputStream.putNextEntry(new ZipEntry(key + "报名人员.xlsx"));
|
||||
workbook.write(zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
response.flushBuffer();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Map<String, Object> userExportMap = new HashMap<>();
|
||||
userExportMap.put("name", k);
|
||||
userExportMap.put("title", userExportParams);
|
||||
userExportMap.put("entity", currentEntities);
|
||||
userExportMap.put("data", v);
|
||||
|
||||
sheetsList.add(userExportMap);
|
||||
}
|
||||
});
|
||||
zipOutputStream.flush();
|
||||
zipOutputStream.close();
|
||||
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
for (Map<String, Object> map : sheetsList) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
service.createSheetForMap(workbook, (ExportParams) map.get("title"), (List<ExcelExportEntity>) map.get("entity"), (Collection<?>) map.get("data"));
|
||||
}
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
|
||||
CommonDownloadUtil.download(activity.getActivityName() + "报名人员名单" + ".xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -46,5 +46,11 @@ public class TrainSignUpActivityCourse {
|
||||
@Comment("课程时间")
|
||||
private Date courseDate;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
@Comment("限制人数")
|
||||
private Integer courseLimitNum;
|
||||
|
||||
private Integer hasRegisterNum;
|
||||
|
||||
}
|
||||
|
||||
+16
-5
@@ -70,6 +70,11 @@ public class TrainSignUpCourse extends BaseModel implements Serializable {
|
||||
@Comment("校区")
|
||||
private String campus;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("报名人数是否限制")
|
||||
private Boolean courseIsLimitApply;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("序号")
|
||||
@@ -81,15 +86,10 @@ public class TrainSignUpCourse extends BaseModel implements Serializable {
|
||||
//已报人数
|
||||
private Integer hasRegisterNum;
|
||||
|
||||
//已报家属人数
|
||||
private Integer hasFmailyNum;
|
||||
|
||||
private Boolean isBringFamily;
|
||||
|
||||
private Boolean isAddFamily;
|
||||
|
||||
private Integer waitingNum;
|
||||
|
||||
//是否报过该课程
|
||||
private Boolean isSign;
|
||||
|
||||
@@ -146,4 +146,15 @@ public class TrainSignUpCourse extends BaseModel implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String assort;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Default(value = "0")
|
||||
@Comment("候补名额数")
|
||||
private Integer waitingNum;
|
||||
|
||||
//候补已报人数
|
||||
private Integer hasWaitingNum;
|
||||
|
||||
private String courseTimeName;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,9 +16,12 @@ import java.util.List;
|
||||
* @author 赵欣雨
|
||||
* @date 2020/8/18 9:16
|
||||
*/
|
||||
@Table("train_sign_up_type")
|
||||
@Data
|
||||
@Table("train_sign_up_type")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TrainSignUpType extends BaseModel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@@ -33,7 +38,7 @@ public class TrainSignUpType extends BaseModel implements Serializable {
|
||||
@Column
|
||||
@Comment("类型名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 80)
|
||||
private String lxname;
|
||||
private String typeName;
|
||||
|
||||
@Column
|
||||
@Comment("序号")
|
||||
@@ -43,13 +48,21 @@ public class TrainSignUpType extends BaseModel implements Serializable {
|
||||
@Column
|
||||
@Comment("是否携带家属")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isBringFamily;
|
||||
|
||||
@Column
|
||||
@Comment("家属纳入总人数")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isAddFamily;
|
||||
|
||||
@Column
|
||||
@Comment("本人纳入总人数")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("1")
|
||||
private Boolean selfAddFamily;
|
||||
|
||||
@Many(field = "typeId")
|
||||
private List<TrainMobileSignColumn> trainMobileSignColumnList;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,26 @@ public class TrainSignUpUser implements Serializable {
|
||||
@Comment("用户ID")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("工会ID")
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("单位ID")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("工会")
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("单位")
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("联系方式")
|
||||
|
||||
+5
-9
@@ -5,6 +5,7 @@ import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpType;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -87,26 +88,20 @@ public interface TrainSignUpActivityService extends BaseService<TrainSignUpActiv
|
||||
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
boolean isSignFullByUnionId(String courseId, Integer currentFamilyNumber);
|
||||
boolean isSignFullByUnionId(TrainSignUpCourse course, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 该培训班是否报满
|
||||
*
|
||||
* @param courseId
|
||||
*/
|
||||
boolean isSignFull(String courseId, Integer currentFamilyNumber);
|
||||
boolean isSignFull(TrainSignUpCourse course, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 还能报该类型的培训班吗 比如书画班最多报一项 健身班两项
|
||||
*
|
||||
* @param courseId
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourse(String courseId, String activityId);
|
||||
boolean isSignCourse(TrainSignUpCourse course, TrainSignUpActivity activity);
|
||||
|
||||
/**
|
||||
* 当前用户是否已报过该培训班
|
||||
@@ -132,4 +127,5 @@ public interface TrainSignUpActivityService extends BaseService<TrainSignUpActiv
|
||||
*/
|
||||
List<NutMap> qdInfoByUserId(String userId, String activityId);
|
||||
|
||||
List<TrainSignUpCourse> filterCourseByHostUnion(List<TrainSignUpCourse> courseList);
|
||||
}
|
||||
|
||||
+9
@@ -33,6 +33,8 @@ public interface TrainSignUpActivityStatisticsService extends BaseService<TrainS
|
||||
*/
|
||||
List<NutMap> registerUserList(String courseId);
|
||||
|
||||
List<NutMap> getTaleColumnInfo(String courseId);
|
||||
|
||||
/**
|
||||
* 该课程下的报名人员信息
|
||||
*
|
||||
@@ -56,4 +58,11 @@ public interface TrainSignUpActivityStatisticsService extends BaseService<TrainS
|
||||
*/
|
||||
List<NutMap> baoMingUserList(String activityId);
|
||||
|
||||
int queryCourseCount(String courseId, String courseType);
|
||||
|
||||
int queryCourseWaitCount(String courseId, String courseType);
|
||||
|
||||
int queryCourseCount(String courseId, String courseType, String unionId);
|
||||
|
||||
int queryCourseWaitCount(String courseId, String courseType, String unionId);
|
||||
}
|
||||
|
||||
+373
-446
@@ -5,9 +5,15 @@ import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyActivity;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyCourse;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyType;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityStatisticsService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.async.Async;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
@@ -18,6 +24,7 @@ import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -34,503 +41,423 @@ import java.util.stream.Collectors;
|
||||
* @Description TODO
|
||||
* @createTime 2022年02月23日 17:14:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class TrainSignUpActivityServiceImpl extends BaseServiceImpl<TrainSignUpActivity> implements TrainSignUpActivityService {
|
||||
|
||||
public TrainSignUpActivityServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
@Inject
|
||||
private TrainSignUpActivityStatisticsService statisticsService;
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void add(TrainSignUpActivity activity, TrainSignUpCourse course) {
|
||||
public TrainSignUpActivityServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
dao().insert(activity);
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
courseList.forEach(v -> {
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void add(TrainSignUpActivity activity, TrainSignUpCourse course) {
|
||||
|
||||
v.setActivityId(activity.getId());
|
||||
v.setOpenOtherUnion(false);
|
||||
dao().insert(v);
|
||||
dao().insert(activity);
|
||||
|
||||
List<TrainSignUpActivityCourse> courseTimeList = v.getCourseTimeList();
|
||||
courseTimeList.forEach(x -> {
|
||||
x.setActivityId(activity.getId());
|
||||
x.setCourseId(v.getId());
|
||||
//插入类型限制
|
||||
List<TrainSignUpTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> v.setActivityId(activity.getId()));
|
||||
dao().insert(typeLimits);
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(x.getCourseDate());
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH);
|
||||
int day = calendar.get(Calendar.DATE);
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
for (TrainSignUpCourse v : courseList) {
|
||||
v.setActivityId(activity.getId());
|
||||
v.setOpenOtherUnion(false);
|
||||
dao().insert(v);
|
||||
this.setCourseTimeAndInsert(v);
|
||||
}
|
||||
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
startCalendar.setTime(x.getCourseStartTime());
|
||||
startCalendar.set(year, month, day);
|
||||
x.setCourseStartTime(startCalendar.getTime());
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
}
|
||||
}
|
||||
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(x.getCourseEndTime());
|
||||
endCalendar.set(year, month, day);
|
||||
x.setCourseEndTime(endCalendar.getTime());
|
||||
dao().insert(x);
|
||||
});
|
||||
});
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void edit(TrainSignUpActivity activity) {
|
||||
|
||||
List<TrainSignUpTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> {
|
||||
v.setActivityId(activity.getId());
|
||||
dao().insert(v);
|
||||
});
|
||||
//修改活动
|
||||
update(activity);
|
||||
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
}
|
||||
}
|
||||
//修改类型限制
|
||||
List<TrainSignUpTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> v.setActivityId(activity.getId()));
|
||||
if(Lang.isNotEmpty(typeLimits)) {
|
||||
insertOrUpdate(typeLimits);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void edit(TrainSignUpActivity activity) {
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
courseList.forEach(v -> {
|
||||
v.setActivityId(activity.getId());
|
||||
dao().insertOrUpdate(v);
|
||||
if (Lang.isNotEmpty(v.getCourseTimeList())) {
|
||||
this.setCourseTimeAndInsert(v);
|
||||
}
|
||||
});
|
||||
|
||||
List<TrainSignUpCourse> oldCourseList = dao().query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
//原来的培训班id
|
||||
List<String> oldCourseIdList = oldCourseList.stream().map(TrainSignUpCourse::getId).toList();
|
||||
//查询原来的活动
|
||||
List<TrainSignUpCourse> oldCourseList = dao().query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
//原来的培训班id
|
||||
List<String> oldCourseIdList = oldCourseList.stream().map(TrainSignUpCourse::getId).toList();
|
||||
|
||||
//原来的上课时间
|
||||
List<TrainSignUpActivityCourse> oldActCourseTimeList = dao().query(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
//原来的上课时间
|
||||
List<TrainSignUpActivityCourse> oldActCourseTimeList = dao().query(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
|
||||
//现在的上课时间
|
||||
List<String> nowCourseTimeListId = new ArrayList<>();
|
||||
activity.getCourseList().forEach(v -> {
|
||||
if (v.getCourseTimeList() != null) {
|
||||
nowCourseTimeListId.addAll(v.getCourseTimeList().stream().map(TrainSignUpActivityCourse::getId).toList());
|
||||
}
|
||||
});
|
||||
|
||||
update(activity);
|
||||
List<String> deleteCourseTimeListId = oldActCourseTimeList.stream().map(TrainSignUpActivityCourse::getId).filter(id -> !nowCourseTimeListId.contains(id)).collect(Collectors.toList());
|
||||
List<String> courseIdList = courseList.stream().map(TrainSignUpCourse::getId).collect(Collectors.toList());
|
||||
|
||||
List<TrainSignUpTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> {
|
||||
v.setActivityId(activity.getId());
|
||||
insertOrUpdate(v);
|
||||
});
|
||||
//删除关联的培训班
|
||||
List<String> deleteIdList = oldCourseIdList.stream().filter(v -> !courseIdList.contains(v)).collect(Collectors.toList());
|
||||
dao().clear(TrainSignUpCourse.class, Cnd.where("id", "in", deleteIdList));
|
||||
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
courseList.forEach(v -> {
|
||||
dao().clear(TrainSignUpActivityCourse.class, Cnd.where("id", "in", deleteCourseTimeListId));
|
||||
dao().clear(TrainSignUpUser.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
dao().clear(TrainSignUpUserCourse.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
|
||||
v.setActivityId(activity.getId());
|
||||
dao().insertOrUpdate(v);
|
||||
//查询修改过培训时间的记录
|
||||
Sql tsuucSql = Sqls.create("""
|
||||
SELECT
|
||||
tsuuc.id,
|
||||
tsuac.courseStartTime,
|
||||
tsuac.courseEndTime
|
||||
FROM
|
||||
`train_sign_up_user_course` tsuuc
|
||||
LEFT JOIN train_sign_up_activity_course tsuac ON tsuac.id = tsuuc.activityCourseId
|
||||
where tsuuc.courseStartTime != tsuac.courseStartTime or tsuuc.courseEndTime != tsuac.courseEndTime
|
||||
""");
|
||||
List<NutMap> tsuucList = listMap(tsuucSql);
|
||||
tsuucList.forEach(v -> {
|
||||
Chain chain = Chain.make("courseStartTime", v.getTime("courseStartTime"));
|
||||
chain.add("courseEndTime", v.getTime("courseEndTime"));
|
||||
Cnd cnd = Cnd.where("id", "=", v.getString("id"));
|
||||
dao().update("train_sign_up_user_course", chain, cnd);
|
||||
});
|
||||
|
||||
List<TrainSignUpActivityCourse> courseTimeList = v.getCourseTimeList();
|
||||
if(courseTimeList != null) {
|
||||
courseTimeList.forEach(x -> {
|
||||
x.setActivityId(activity.getId());
|
||||
x.setCourseId(v.getId());
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
} else {
|
||||
dao().delete(Sys_home_activity.class, activity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(x.getCourseDate());
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH);
|
||||
int day = calendar.get(Calendar.DATE);
|
||||
private void setCourseTimeAndInsert(TrainSignUpCourse course) {
|
||||
course.getCourseTimeList().forEach(courseTime -> {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(courseTime.getCourseDate());
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH);
|
||||
int day = calendar.get(Calendar.DATE);
|
||||
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
startCalendar.setTime(x.getCourseStartTime());
|
||||
startCalendar.set(year, month, day);
|
||||
x.setCourseStartTime(startCalendar.getTime());
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
startCalendar.setTime(courseTime.getCourseStartTime());
|
||||
startCalendar.set(year, month, day);
|
||||
courseTime.setCourseStartTime(startCalendar.getTime());
|
||||
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(x.getCourseEndTime());
|
||||
endCalendar.set(year, month, day);
|
||||
x.setCourseEndTime(endCalendar.getTime());
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(courseTime.getCourseEndTime());
|
||||
endCalendar.set(year, month, day);
|
||||
courseTime.setCourseEndTime(endCalendar.getTime());
|
||||
|
||||
dao().insertOrUpdate(x);
|
||||
courseTime.setActivityId(course.getActivityId());
|
||||
courseTime.setCourseId(course.getId());
|
||||
dao().insertOrUpdate(courseTime);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void updateActivityStatus(TrainSignUpActivity activity) {
|
||||
updateIgnoreNull(activity);
|
||||
}
|
||||
|
||||
//现在的上课时间
|
||||
List<String> nowCourseTimeListId = new ArrayList<>();
|
||||
activity.getCourseList().stream().forEach(v -> {
|
||||
if(v.getCourseTimeList() != null) {
|
||||
nowCourseTimeListId.addAll(v.getCourseTimeList().stream().map(x -> x.getId()).collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public NutMap findOne(String id, Cnd cnd, String fromMode) {
|
||||
if (Lang.isEmpty(cnd)) {
|
||||
cnd = Cnd.NEW();
|
||||
}
|
||||
|
||||
List<String> deleteCourseTimeListId = oldActCourseTimeList.stream().filter(x -> !nowCourseTimeListId.contains(x.getId())).map(x -> x.getId()).collect(Collectors.toList());
|
||||
cnd.asc("orderNum").asc("campus").desc("courseLocation").asc("courseType").asc("courseName");
|
||||
List<TrainSignUpCourse> courseArray = dao().query(TrainSignUpCourse.class, cnd.and("activityId", "=", id));
|
||||
|
||||
if (StrUtil.isNotBlank(fromMode) && "mobile".equals(fromMode)) {
|
||||
courseArray = this.filterCourseByHostUnion(courseArray);
|
||||
}
|
||||
|
||||
List<String> courseIdList = courseList.stream().map(v -> v.getId()).collect(Collectors.toList());
|
||||
TrainSignUpActivity activity = fetchLinks(dao().fetch(TrainSignUpActivity.class, id), "^(conditionStructure|typeLimits)$");
|
||||
activity.setCourseList(courseArray);
|
||||
|
||||
//删除关联的培训班
|
||||
List<String> deleteIdList = oldCourseIdList.stream().filter(v -> !courseIdList.contains(v)).collect(Collectors.toList());
|
||||
dao().clear(TrainSignUpCourse.class, Cnd.where("id", "in", deleteIdList));
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
|
||||
courseList.forEach(c -> {
|
||||
if (StrUtil.isNotBlank(c.getCourseType())) {
|
||||
dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
int courseCount = statisticsService.queryCourseCount(c.getId(), c.getCourseType());
|
||||
c.setHasRegisterNum(courseCount);
|
||||
int courseWaitCount = statisticsService.queryCourseWaitCount(c.getId(), c.getCourseType());
|
||||
c.setHasWaitingNum(courseWaitCount);
|
||||
//当前用户是否报过
|
||||
c.setIsSign(isSignCourseByUser(c.getId(), SecurityUtil.getUserId()));
|
||||
}
|
||||
});
|
||||
return Lang.obj2nutmap(activity);
|
||||
}
|
||||
|
||||
dao().clear(TrainSignUpActivityCourse.class, Cnd.where("id", "in", deleteCourseTimeListId));
|
||||
dao().clear(TrainSignUpUser.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
dao().clear(TrainSignUpUserCourse.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd) {
|
||||
Pagination pagination = listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "^(courseList)$");
|
||||
return pagination;
|
||||
}
|
||||
|
||||
//修改train_sign_up_user_course的数据 如果上课时间发生变化
|
||||
@Override
|
||||
public Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
switch (activityStatus) {
|
||||
case 2 -> {
|
||||
cnd.and(new Static("activitySignUpStartTime < now()"));
|
||||
cnd.and(new Static("activitySignUpEndTime > now()"));
|
||||
}
|
||||
case 3 -> {
|
||||
cnd.and(new Static("activityStartTime < now()"));
|
||||
cnd.and(new Static("activityEndTime > now()"));
|
||||
}
|
||||
case 4 -> cnd.and(new Static("activityEndTime < now()"));
|
||||
case 5 -> cnd.and(new Static("activityStartTime < now()"));
|
||||
case 6 -> cnd.and(new Static("activityStartTime > now()"));
|
||||
}
|
||||
if (activityType != null && activityType == 1) {
|
||||
cnd.and(new Static("id in (select activityId from train_sign_up_user where userId = '%s')".formatted(SecurityUtil.getUserId())));
|
||||
}
|
||||
cnd.and("isDisabled", "=", 0);
|
||||
cnd.orderBy("activityEndTime", "desc");
|
||||
cnd.orderBy("isDisabled", "desc");
|
||||
cnd.orderBy("createdAt", "desc");
|
||||
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
}
|
||||
|
||||
//查询修改过培训时间的记录
|
||||
Sql tsuucSql = Sqls.create("""
|
||||
SELECT
|
||||
tsuuc.id,
|
||||
tsuac.courseStartTime,
|
||||
tsuac.courseEndTime
|
||||
FROM
|
||||
`train_sign_up_user_course` tsuuc
|
||||
LEFT JOIN train_sign_up_activity_course tsuac ON tsuac.id = tsuuc.activityCourseId
|
||||
where tsuuc.courseStartTime != tsuac.courseStartTime or tsuuc.courseEndTime != tsuac.courseEndTime
|
||||
""");
|
||||
List<NutMap> tsuucList = listMap(tsuucSql);
|
||||
tsuucList.forEach(v -> {
|
||||
Chain chain = Chain.make("courseStartTime", v.getTime("courseStartTime"));
|
||||
chain.add("courseEndTime", v.getTime("courseEndTime"));
|
||||
Cnd cnd = Cnd.where("id", "=", v.getString("id"));
|
||||
dao().update("train_sign_up_user_course", chain, cnd);
|
||||
});
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doSignUp(TrainSignUpUser trainSignUpUser) throws Exception {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
} else {
|
||||
dao().delete(Sys_home_activity.class, activity.getId());
|
||||
}
|
||||
//查询课程
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, trainSignUpUser.getCourseId());
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
//如果这个课程的预留名额方式为报名人数不变
|
||||
if (course.getReserveMode() == 2) {
|
||||
//如果当前报名+已报小于这个课程限制人数
|
||||
//课程已报人数
|
||||
int normalCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType());
|
||||
//+1是算自己
|
||||
int hasRegisterNum = type.getSelfAddFamily() ? normalCount + 1 : 0;
|
||||
trainSignUpUser.setState((hasRegisterNum + course.getCourseReservedNumber()) > course.getCoursePeopleNumber() ? 2 : 1);
|
||||
} else {
|
||||
trainSignUpUser.setState(1);
|
||||
}
|
||||
|
||||
}
|
||||
View_user user = dao().fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
trainSignUpUser.setUnionId(SecurityUtil.getUnionId());
|
||||
trainSignUpUser.setUnionName(user.getUnionName());
|
||||
trainSignUpUser.setUnitId(SecurityUtil.getUnitId());
|
||||
trainSignUpUser.setUnitName(user.getUnitName());
|
||||
trainSignUpUser.setUserId(userId);
|
||||
trainSignUpUser.setSignUpTime(new Date());
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void updateActivityStatus(TrainSignUpActivity activity) {
|
||||
updateIgnoreNull(activity);
|
||||
}
|
||||
dao().insert(trainSignUpUser);
|
||||
asyncInsertUserCourse(trainSignUpUser.getActivityId(), trainSignUpUser.getCourseId(), userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap findOne(String id, Cnd cnd, String fromMode) {
|
||||
if (Lang.isEmpty(cnd)) {
|
||||
cnd = Cnd.NEW();
|
||||
}
|
||||
@Async
|
||||
@Override
|
||||
public void asyncInsertUserCourse(String activityId, String courseId, String userId) {
|
||||
log.info("异步插入{}的上课信息,课程ID为{},活动ID为{}", userId, courseId, activityId);
|
||||
List<TrainSignUpActivityCourse> courseList = dao().query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
List<TrainSignUpUserCourse> list = new ArrayList<>();
|
||||
courseList.forEach(v -> {
|
||||
TrainSignUpUserCourse userCourse = new TrainSignUpUserCourse();
|
||||
userCourse.setActivityId(activityId);
|
||||
userCourse.setCourseId(courseId);
|
||||
userCourse.setUserId(userId);
|
||||
userCourse.setCourseStartTime(v.getCourseStartTime());
|
||||
userCourse.setCourseEndTime(v.getCourseEndTime());
|
||||
userCourse.setAttend(false);
|
||||
userCourse.setAttendTime(null);
|
||||
userCourse.setActivityCourseId(v.getId());
|
||||
list.add(userCourse);
|
||||
});
|
||||
dao().insert(list);
|
||||
}
|
||||
|
||||
cnd.asc("orderNum").asc("campus").desc("courseLocation").asc("courseType").asc("courseName");
|
||||
List<TrainSignUpCourse> courseArray = dao().query(TrainSignUpCourse.class, cnd.and("activityId", "=", id));
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isSignFullByUnionId(TrainSignUpCourse course, Integer currentFamilyNumber) {
|
||||
List<NutMap> unionLimit = course.getUnionLimit();
|
||||
if (Lang.isEmpty(unionLimit)) {
|
||||
return false;
|
||||
}
|
||||
String unionId = SecurityUtil.getUnionId();
|
||||
NutMap unionLimitMap = unionLimit.stream().filter(v -> v.getString("id").equals(unionId)).findAny().orElse(null);
|
||||
if (Lang.isEmpty(unionLimitMap)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(StrUtil.isNotBlank(fromMode) && "mobile".equals(fromMode)) {
|
||||
courseArray = courseArray.stream().filter(o -> {
|
||||
if(StrUtil.isBlank(o.getInterTime()) || o.getOpenOtherUnion() == null || o.getOpenOtherUnion()) {
|
||||
return true;
|
||||
} else {
|
||||
if(SecurityUtil.getUnionId().equals(o.getHostUnionId())) {
|
||||
return true;
|
||||
} else {
|
||||
int compare = cn.hutool.core.date.DateUtil.compare(cn.hutool.core.date.DateUtil.date(), cn.hutool.core.date.DateUtil.parse(o.getInterTime()), "yyyy-MM-dd HH:mm");
|
||||
if(compare >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
//分工会限制人数
|
||||
int limitCount = unionLimitMap.getInt("limitCount");
|
||||
|
||||
TrainSignUpActivity activity = fetchLinks(dao().fetch(TrainSignUpActivity.class, id), "^(conditionStructure|typeLimits)$");
|
||||
activity.setCourseList(courseArray);
|
||||
//该课程已经报名的总人数
|
||||
int hasSignCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType(), unionId);
|
||||
int hasWaitCount = statisticsService.queryCourseWaitCount(course.getId(), course.getCourseType());
|
||||
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
//+1是算自己
|
||||
int current = type.getSelfAddFamily() ? 1 : 0;
|
||||
currentFamilyNumber = type.getIsBringFamily() && type.getIsAddFamily() ? currentFamilyNumber : 0;
|
||||
//如果还有正常名额
|
||||
if(limitCount - hasSignCount > 0) {
|
||||
return (hasSignCount + current + currentFamilyNumber) > limitCount;
|
||||
} else {
|
||||
return (hasWaitCount + current + currentFamilyNumber) > course.getWaitingNum();
|
||||
}
|
||||
}
|
||||
|
||||
courseList.forEach(c -> {
|
||||
if(StrUtil.isNotBlank(c.getCourseType())) {
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, c.getCourseType());
|
||||
dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
//已报人数
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", c.getId()));
|
||||
signUpUsers.forEach(item -> {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if(nutMap != null) {
|
||||
hasRegisterNum.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
c.setHasRegisterNum(hasRegisterNum.get());
|
||||
//候补报名人数
|
||||
int count = dao().count(TrainSignUpUser.class, Cnd.where("activityId", "=", activity.getId()).and("courseId", "=", c.getId())
|
||||
.and("state", "=", 2));
|
||||
c.setWaitingNum(count);
|
||||
//当前用户是否报过
|
||||
c.setIsSign(isSignCourseByUser(c.getId(), SecurityUtil.getUserId()));
|
||||
}
|
||||
});
|
||||
return Lang.obj2nutmap(activity);
|
||||
}
|
||||
@Override
|
||||
public boolean isSignFull(TrainSignUpCourse course, Integer currentFamilyNumber) {
|
||||
//课程限制人数
|
||||
int coursePeopleNumber = course.getCoursePeopleNumber();
|
||||
if (coursePeopleNumber == 0) {
|
||||
return true;
|
||||
}
|
||||
//查询课程对应的类型
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
//课程已报人数
|
||||
int hasSignCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType());
|
||||
int hasWaitCount = statisticsService.queryCourseWaitCount(course.getId(), course.getCourseType());
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd) {
|
||||
Pagination pagination = listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "^(courseList)$");
|
||||
return pagination;
|
||||
}
|
||||
//+1是算自己
|
||||
int current = type.getSelfAddFamily() ? 1 : 0;
|
||||
currentFamilyNumber = type.getIsBringFamily() && type.getIsAddFamily() ? currentFamilyNumber : 0;
|
||||
//如果还有正常名额
|
||||
if(coursePeopleNumber - hasSignCount > 0) {
|
||||
return (hasSignCount + current + currentFamilyNumber + course.getCourseReservedNumber()) > coursePeopleNumber;
|
||||
} else {
|
||||
return (hasWaitCount + current + currentFamilyNumber) > course.getWaitingNum();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
switch (activityStatus) {
|
||||
case 2 -> {
|
||||
cnd.and(new Static("activitySignUpStartTime < now()"));
|
||||
cnd.and(new Static("activitySignUpEndTime > now()"));
|
||||
}
|
||||
case 3 -> {
|
||||
cnd.and(new Static("activityStartTime < now()"));
|
||||
cnd.and(new Static("activityEndTime > now()"));
|
||||
}
|
||||
case 4 -> cnd.and(new Static("activityEndTime < now()"));
|
||||
case 5 -> cnd.and(new Static("activityStartTime < now()"));
|
||||
case 6 -> cnd.and(new Static("activityStartTime > now()"));
|
||||
}
|
||||
if(activityType != null && activityType == 1) {
|
||||
cnd.and(new Static("id in (select activityId from train_sign_up_user where userId = '%s')".formatted(SecurityUtil.getUserId())));
|
||||
}
|
||||
cnd.and("isDisabled", "=", 0);
|
||||
cnd.orderBy("activityEndTime", "desc");
|
||||
cnd.orderBy("isDisabled", "desc");
|
||||
cnd.orderBy("createdAt", "desc");
|
||||
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
}
|
||||
@Override
|
||||
public boolean isSignCourse(TrainSignUpCourse course, TrainSignUpActivity activity) {
|
||||
//培训班类型
|
||||
String courseType = course.getCourseType();
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doSignUp(TrainSignUpUser trainSignUpUser) throws Exception {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count( tsus.id )
|
||||
FROM
|
||||
`train_sign_up_user` tsus
|
||||
LEFT JOIN train_sign_up_course tsuc ON tsuc.id = tsus.courseId
|
||||
WHERE
|
||||
tsuc.courseType = @courseType
|
||||
AND tsus.userId = @userId
|
||||
AND tsus.activityId = @activityId
|
||||
""");
|
||||
sql.setParam("courseType", courseType);
|
||||
sql.setParam("activityId", activity.getId());
|
||||
sql.setParam("userId", SecurityUtil.getUserId());
|
||||
int hasRegisterNum = count(sql);
|
||||
|
||||
//查询课程
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, trainSignUpUser.getCourseId());
|
||||
//如果这个课程的预留名额方式为报名人数不变
|
||||
if(course.getReserveMode() == 2) {
|
||||
//如果当前报名+已报小于这个课程限制人数
|
||||
//课程已报人数
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", trainSignUpUser.getCourseId())
|
||||
.and("state", "!=", 2));
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
if(hasRegisterNum > course.getCoursePeopleNumber()) {
|
||||
trainSignUpUser.setState(2);
|
||||
} else {
|
||||
trainSignUpUser.setState(1);
|
||||
}
|
||||
} else {
|
||||
trainSignUpUser.setState(1);
|
||||
}
|
||||
//第一种无限制报名
|
||||
if (activity.getRestrictLimit() == null || activity.getRestrictLimit() == 1) {
|
||||
return true;
|
||||
} else if (activity.getRestrictLimit() == 2) {
|
||||
TrainSignUpTypeLimit trainSignUpTypeLimit = dao().fetch(TrainSignUpTypeLimit.class, Cnd.where("typeId", "=", courseType).and("activityId", "=", activity.getId()));
|
||||
if (trainSignUpTypeLimit == null) {
|
||||
return true;
|
||||
}
|
||||
//此类型的班最多可报几项
|
||||
int personMaxRegisterNum = trainSignUpTypeLimit.getLimitNum();
|
||||
if (personMaxRegisterNum == 0) {
|
||||
return true;
|
||||
}
|
||||
return hasRegisterNum < personMaxRegisterNum;
|
||||
} else if (activity.getRestrictLimit() == 3) {
|
||||
//第三种,限制报几个,不跟类型挂钩
|
||||
int aCount = dao().count(TrainSignUpUser.class, Cnd.where("activityId", "=", activity.getId()).and("userId", "=", SecurityUtil.getUserId()));
|
||||
return aCount < activity.getLimitNum();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
trainSignUpUser.setUserId(userId);
|
||||
trainSignUpUser.setSignUpTime(new Date());
|
||||
@Override
|
||||
public boolean isSignCourseByUser(String courseId, String userId) {
|
||||
return dao().count(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId).and("userId", "=", userId)) > 0;
|
||||
}
|
||||
|
||||
dao().insert(trainSignUpUser);
|
||||
asyncInsertUserCourse(trainSignUpUser.getActivityId(), trainSignUpUser.getCourseId(), userId);
|
||||
}
|
||||
@Override
|
||||
public void doQd(String id) {
|
||||
NutMap updateMap = NutMap.NEW();
|
||||
updateMap.put("isAttend", true);
|
||||
updateMap.put("attendTime", new Date());
|
||||
dao().update(TrainSignUpUserCourse.class, Chain.from(updateMap), Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void asyncInsertUserCourse(String activityId, String courseId, String userId) {
|
||||
log.info("异步插入{}的上课信息,课程ID为{},活动ID为{}", userId, courseId, activityId);
|
||||
List<TrainSignUpActivityCourse> courseList = dao().query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
List<TrainSignUpUserCourse> list = new ArrayList<>();
|
||||
courseList.forEach(v -> {
|
||||
TrainSignUpUserCourse userCourse = new TrainSignUpUserCourse();
|
||||
userCourse.setActivityId(activityId);
|
||||
userCourse.setCourseId(courseId);
|
||||
userCourse.setUserId(userId);
|
||||
userCourse.setCourseStartTime(v.getCourseStartTime());
|
||||
userCourse.setCourseEndTime(v.getCourseEndTime());
|
||||
userCourse.setAttend(false);
|
||||
userCourse.setAttendTime(null);
|
||||
userCourse.setActivityCourseId(v.getId());
|
||||
list.add(userCourse);
|
||||
});
|
||||
dao().insert(list);
|
||||
}
|
||||
@Override
|
||||
public List<NutMap> qdInfoByUserId(String userId, String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
t.courseLocationCoordinates,
|
||||
t.isMobileSign,
|
||||
t.signType,
|
||||
t.isReceiveGift,
|
||||
t.giftType,
|
||||
(select state from train_sign_up_user su where su.activityId = c.activityId and su.courseId = c.courseId and su.userId = c.userId) as state
|
||||
FROM
|
||||
`train_sign_up_user_course` c
|
||||
LEFT JOIN train_sign_up_course t ON t.id = c.courseId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("c.activityId", "=", activityId);
|
||||
cnd.and("c.userId", "=", userId);
|
||||
cnd.asc("c.courseStartTime");
|
||||
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isSignFullByUnionId(String courseId, Integer currentFamilyNumber) {
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpType signUpType = dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
List<NutMap> unionLimit = course.getUnionLimit();
|
||||
if (Lang.isEmpty(unionLimit)) {
|
||||
return false;
|
||||
}
|
||||
String unionId = SecurityUtil.getUnionId();
|
||||
NutMap unionLimitMap = unionLimit.stream().filter(v -> v.getString("id").equals(unionId)).findAny().orElse(null);
|
||||
if (Lang.isEmpty(unionLimitMap)) {
|
||||
return true;
|
||||
}
|
||||
//分工会限制人数
|
||||
int limitCount = unionLimitMap.getInt("limitCount");
|
||||
|
||||
//查询该课程已经报了多少人
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
fu.*
|
||||
FROM
|
||||
`train_sign_up_user` fu
|
||||
LEFT JOIN `user` u ON fu.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("courseId", "=", courseId);
|
||||
sql.setCondition(cnd);
|
||||
//已经报名人数,这是教职工的
|
||||
List<NutMap> signUpUsers = listMap(sql);
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
//课程已报人数(携带的家属)
|
||||
int hasFamilyNum = 0;
|
||||
//如果携带家属,并且纳入人数,则mdzz
|
||||
if(signUpType.getIsAddFamily() && signUpType.getIsBringFamily()) {
|
||||
//如果携带家属,已报人数=教职工+每个教职工携带的家属
|
||||
AtomicInteger num = new AtomicInteger();
|
||||
signUpUsers.forEach(item -> {
|
||||
List<NutMap> mapList = item.getAsList("", NutMap.class);
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if(nutMap != null) {
|
||||
num.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
}
|
||||
});
|
||||
hasFamilyNum = num.get() + (currentFamilyNumber != null ? currentFamilyNumber : 0);//currentFamilyNumber是当前报名时填的家属人数
|
||||
}
|
||||
//如果已报人数+当前报名(自己)+家属 > 分工会限制人数
|
||||
return (hasRegisterNum + hasFamilyNum) > limitCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignFull(String courseId, Integer currentFamilyNumber) {
|
||||
//查询课程
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, courseId);
|
||||
//课程限制人数
|
||||
int coursePeopleNumber = course.getCoursePeopleNumber();
|
||||
if(coursePeopleNumber == 0) {
|
||||
return false;
|
||||
}
|
||||
//查询课程对应的类型
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
//课程已报人数
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId));
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
//课程已报人数(携带的家属)
|
||||
int hasFamilyNum = 0;
|
||||
//如果这个类型携带家属并且计入总人数
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
AtomicInteger num = new AtomicInteger();
|
||||
signUpUsers.forEach(item -> {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if(nutMap != null) {
|
||||
num.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
}
|
||||
});
|
||||
hasFamilyNum = num.get() + (currentFamilyNumber != null ? currentFamilyNumber : 0);//currentFamilyNumber是当前报名时填的家属人数
|
||||
}
|
||||
//如果预留名额模式是报名人数减少
|
||||
if(course.getReserveMode() == 1) {
|
||||
//如果已报人数+预留人数+当前报名(自己)+家属 > 总人数
|
||||
return (hasRegisterNum + course.getCourseReservedNumber() + hasFamilyNum) > coursePeopleNumber;
|
||||
}else {//如果预留名额模式是报名人数不变
|
||||
//如果已报人数+当前报名(自己)+家属 > 总人数+预留人数
|
||||
return (hasRegisterNum + hasFamilyNum) > (coursePeopleNumber + course.getCourseReservedNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignCourse(String courseId, String activityId) {
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpActivity activity = dao().fetch(TrainSignUpActivity.class, activityId);
|
||||
//培训班类型
|
||||
String courseType = course.getCourseType();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count( tsus.id )
|
||||
FROM
|
||||
`train_sign_up_user` tsus
|
||||
LEFT JOIN train_sign_up_course tsuc ON tsuc.id = tsus.courseId
|
||||
WHERE
|
||||
tsuc.courseType = @courseType
|
||||
AND tsus.userId = @userId
|
||||
AND tsus.activityId = @activityId
|
||||
""");
|
||||
sql.setParam("courseType", courseType);
|
||||
sql.setParam("activityId", activityId);
|
||||
sql.setParam("userId", SecurityUtil.getUserId());
|
||||
int hasRegisterNum = count(sql);
|
||||
|
||||
//第一种无限制报名
|
||||
if (activity.getRestrictLimit() == null || activity.getRestrictLimit() == 1) {
|
||||
return true;
|
||||
} else if (activity.getRestrictLimit() == 2) {
|
||||
TrainSignUpTypeLimit trainSignUpTypeLimit = dao().fetch(TrainSignUpTypeLimit.class, Cnd.where("typeId", "=", courseType).and("activityId", "=", activityId));
|
||||
if(trainSignUpTypeLimit == null) {
|
||||
return true;
|
||||
}
|
||||
//此类型的班最多可报几项
|
||||
int personMaxRegisterNum = trainSignUpTypeLimit.getLimitNum();
|
||||
if (personMaxRegisterNum == 0) {
|
||||
return true;
|
||||
}
|
||||
return hasRegisterNum < personMaxRegisterNum;
|
||||
} else if (activity.getRestrictLimit() == 3) {
|
||||
//第三种,限制报几个,不跟类型挂钩
|
||||
int aCount = dao().count(TrainSignUpUser.class, Cnd.where("activityId", "=", activityId).and("userId", "=", SecurityUtil.getUserId()));
|
||||
return aCount < activity.getLimitNum();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignCourseByUser(String courseId, String userId) {
|
||||
int count = dao().count(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId).and("userId", "=", userId));
|
||||
return dao().count(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId).and("userId", "=", userId)) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doQd(String id) {
|
||||
NutMap updateMap = NutMap.NEW();
|
||||
updateMap.put("isAttend", true);
|
||||
updateMap.put("attendTime", new Date());
|
||||
dao().update(TrainSignUpUserCourse.class, Chain.from(updateMap), Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> qdInfoByUserId(String userId, String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
t.courseLocationCoordinates,
|
||||
t.isMobileSign,
|
||||
t.signType,
|
||||
t.isReceiveGift,
|
||||
t.giftType,
|
||||
(select state from train_sign_up_user su where su.activityId = c.activityId and su.courseId = c.courseId and su.userId = c.userId) as state
|
||||
FROM
|
||||
`train_sign_up_user_course` c
|
||||
LEFT JOIN train_sign_up_course t ON t.id = c.courseId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("c.activityId", "=", activityId);
|
||||
cnd.and("c.userId", "=", userId);
|
||||
cnd.asc("c.courseStartTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TrainSignUpCourse> filterCourseByHostUnion(List<TrainSignUpCourse> courseList) {
|
||||
if (Lang.isEmpty(courseList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return courseList.stream().filter(o -> {
|
||||
if (StrUtil.isBlank(o.getInterTime()) || o.getOpenOtherUnion() == null || o.getOpenOtherUnion()) {
|
||||
return true;
|
||||
} else {
|
||||
if (SecurityUtil.getUnionId().equals(o.getHostUnionId())) {
|
||||
return true;
|
||||
} else {
|
||||
int compare = cn.hutool.core.date.DateUtil.compare(cn.hutool.core.date.DateUtil.date(), cn.hutool.core.date.DateUtil.parse(o.getInterTime()), "yyyy-MM-dd HH:mm");
|
||||
return compare >= 0;
|
||||
}
|
||||
}
|
||||
}).toList();
|
||||
}
|
||||
}
|
||||
|
||||
+80
-10
@@ -4,6 +4,11 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyType;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpType;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -13,12 +18,14 @@ import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -42,15 +49,16 @@ public class TrainSignUpActivityStatisticsServiceImpl extends BaseServiceImpl<Tr
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseReservedNumber,
|
||||
type.lxname as courseType,
|
||||
type.typeName as courseType,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.reserveMode,
|
||||
tsuc.isMobileSign,
|
||||
tsuc.hostUnionId,
|
||||
tsuc.interTime,
|
||||
tsuc.waitingNum,
|
||||
tsuc.openOtherUnion,
|
||||
( SELECT count( 1 ) FROM train_sign_up_user WHERE courseId = tsuc.id ) registerNum
|
||||
tsuc.courseType as cType
|
||||
FROM
|
||||
`train_sign_up_course` tsuc
|
||||
LEFT JOIN
|
||||
@@ -60,7 +68,13 @@ public class TrainSignUpActivityStatisticsServiceImpl extends BaseServiceImpl<Tr
|
||||
ORDER BY tsuc.orderNum
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
courseList.forEach(c -> {
|
||||
c.put("registerNum", queryCourseCount(c.getString("id"), c.getString("cType")));
|
||||
c.put("hasWaitingNum", queryCourseWaitCount(c.getString("id"), c.getString("cType")));
|
||||
});
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,13 +82,15 @@ public class TrainSignUpActivityStatisticsServiceImpl extends BaseServiceImpl<Tr
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
tsuu.signUpTime,
|
||||
tsuu.state
|
||||
u.username,
|
||||
u.sex,
|
||||
tsuu.unionId,
|
||||
tsuu.unionName,
|
||||
tsuu.unitId,
|
||||
tsuu.unitName,
|
||||
ifnull(tsuu.mobile, u.mobile) as mobile,
|
||||
tsuu.signUpTime,
|
||||
tsuu.state
|
||||
FROM
|
||||
train_sign_up_user tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
@@ -87,6 +103,17 @@ public class TrainSignUpActivityStatisticsServiceImpl extends BaseServiceImpl<Tr
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getTaleColumnInfo(String courseId) {
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpType upType = dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
dao().fetchLinks(upType, "trainMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
|
||||
List<TrainMobileSignColumn> columnList = upType.getTrainMobileSignColumnList();
|
||||
List<NutMap> columnTableList = columnList.stream().map(o -> NutMap.NEW().setv("label", o.getColumnName()).setv("prop", o.getColumnCode())).collect(Collectors.toList());
|
||||
return columnTableList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> registerUserList(String courseId, String unionId, String unitId, String searchName, String searchKeyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
@@ -178,4 +205,47 @@ public class TrainSignUpActivityStatisticsServiceImpl extends BaseServiceImpl<Tr
|
||||
sql.setParam("activityId", activityId);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseCount(String courseId, String courseType) {
|
||||
return this.queryCourseCount(courseId, courseType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseWaitCount(String courseId, String courseType) {
|
||||
return this.queryCourseWaitCount(courseId, courseType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseCount(String courseId, String courseType, String unionId) {
|
||||
return this.calcSignCount(courseId, courseType, unionId, List.of(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseWaitCount(String courseId, String courseType, String unionId) {
|
||||
return this.calcSignCount(courseId, courseType, unionId, List.of(2));
|
||||
}
|
||||
|
||||
private int calcSignCount(String courseId, String courseType, String unionId, List<Integer> stateList) {
|
||||
if(StrUtil.isBlank(courseId) || StrUtil.isBlank(courseType)) {
|
||||
return 0;
|
||||
}
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, courseType);
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId)
|
||||
.and("state", "in", stateList)
|
||||
.andEX("unionId", "=", unionId));
|
||||
signUpUsers.forEach(item -> {
|
||||
if (type.getSelfAddFamily()) {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
}
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mobileColumnsValue = item.getMobileColumnsValue();
|
||||
NutMap map = mobileColumnsValue.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
int number = map != null ? map.getInt("columnValue") : 0;
|
||||
hasRegisterNum.addAndGet(number);
|
||||
}
|
||||
});
|
||||
return hasRegisterNum.get();
|
||||
}
|
||||
}
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.budwk.app.zhgh.dayofficework.clothing.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.dayofficework.clothing.service.ClothingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @ClassName ClothingAccountController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 8:46
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "服装登记台账")
|
||||
@At("/platform/clothing/account")
|
||||
public class ClothingAccountController {
|
||||
|
||||
@Inject
|
||||
private ClothingService clothingService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("clothing.account")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/clothing/account/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("clothing.account")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") String year,
|
||||
@Param(value = "projectId") String projectId,
|
||||
@Param(value = "unionId") String unionId) {
|
||||
Pagination pagination = clothingService.pageData(pageForm, projectId, year, unionId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.budwk.app.zhgh.dayofficework.clothing.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicSettings;
|
||||
import com.budwk.app.zhgh.dayofficework.clothing.service.ClothingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ClothingApplyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 8:46
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "服装登记")
|
||||
@At("/platform/clothing/apply")
|
||||
public class ClothingApplyController {
|
||||
|
||||
@Inject
|
||||
private ClothingService clothingService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("clothing.apply")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/clothing/apply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取人员")
|
||||
@SaCheckPermission("clothing.apply")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "projectId") String projectId,
|
||||
@Param(value = "isBuy") Boolean isBuy,
|
||||
@Param(value = "sex") String sex,
|
||||
@Param(value = "unionId") String unionId) {
|
||||
Pagination pagination = clothingService.getRegisterUser(pageForm, year, projectId, isBuy, sex, unionId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改服装登记")
|
||||
@SaCheckPermission("clothing.apply")
|
||||
@SLog(type = "clothing", tag = "新增/修改服装登记", msg = "新增/修改服装登记")
|
||||
public Object doHandler(String[] ids, String projectId, Integer year, Boolean isBuy) {
|
||||
if(!isBuy) {
|
||||
clothingService.add(ids, projectId);
|
||||
} else {
|
||||
clothingService.removeBuyUser(ids, projectId, year);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取服装项目")
|
||||
@SaCheckPermission("clothing.apply")
|
||||
public Result getBuyClothesProject() {
|
||||
List<ActivityBasicSettings> list = clothingService.getBuyClothesProject();
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
package com.budwk.app.zhgh.dayofficework.clothing.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.DateUtil;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
import com.budwk.app.zhgh.dayofficework.clothing.service.ClothingService;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ClothingRecordController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/23 8:46
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "服装登记记录")
|
||||
@At("/platform/clothing/record")
|
||||
public class ClothingRecordController {
|
||||
|
||||
@Inject
|
||||
private ClothingService clothingService;
|
||||
@Inject
|
||||
private SysOfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("clothing.record")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/clothing/record/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("clothing.record")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") String year,
|
||||
@Param(value = "projectId") String projectId,
|
||||
@Param(value = "unionId") String unionId) {
|
||||
Pagination pagination = clothingService.pageData(pageForm, projectId, year, unionId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("根据项目删除")
|
||||
@SaCheckPermission("clothing.record")
|
||||
@SLog(type = "clothing", tag = "根据项目删除", msg = "根据项目删除")
|
||||
public Result doDelete(String projectId, String year, String userId) {
|
||||
if(StrUtil.isBlank(projectId)) {
|
||||
Result.error("项目不能为空");
|
||||
}
|
||||
if(StrUtil.isBlank(year)) {
|
||||
Result.error("年份不能为空");
|
||||
}
|
||||
if(StrUtil.isBlank(userId)) {
|
||||
Result.error("登记人不能为空");
|
||||
}
|
||||
boolean result = clothingService.doDelete(projectId, year, userId);
|
||||
return result ? Result.success(): Result.error();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询人员")
|
||||
@SaCheckPermission("clothing.record")
|
||||
public Result findBuyClothesUser(String projectId, String userId, String year) {
|
||||
if(StrUtil.isBlank(projectId)) {
|
||||
return Result.error("项目不能为空");
|
||||
}
|
||||
List<NutMap> buyClothesUsers = clothingService.findBuyClothesUser(projectId, userId, year);
|
||||
return Result.success(buyClothesUsers);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除单个人员")
|
||||
@SaCheckPermission("clothing.record")
|
||||
@SLog(type = "clothing", tag = "删除单个人员", msg = "删除单个人员")
|
||||
public Result deleteBuyUser(String id) {
|
||||
if(StrUtil.isBlank(id)) {
|
||||
Result.error("项目不能为空");
|
||||
}
|
||||
boolean result = clothingService.deleteBuyUser(id);
|
||||
return result ? Result.success(): Result.error();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("clothing.record")
|
||||
public void doExport(String year,
|
||||
String projectId,
|
||||
String userId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
NutMap clothes = NutMap.NEW();
|
||||
clothes.put("ctime", DateUtil.getDate());
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
'服装' as things
|
||||
FROM
|
||||
clothing_register c
|
||||
LEFT JOIN `vw_user` u ON u.id = c.buyUserId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("year(c.ctime)", "=", year);
|
||||
cnd.and("c.projectId", "=", projectId);
|
||||
cnd.and("c.userId", "=", userId);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> buyUserList = clothingService.listMap(sql);
|
||||
for (int i = 0; i < buyUserList.size(); i++) {
|
||||
buyUserList.get(i).put("index", i + 1);
|
||||
}
|
||||
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
Configure config = Configure.builder().bind("buys", policy).build();
|
||||
clothes.put("buys", buyUserList);
|
||||
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
XWPFTemplate template = XWPFTemplate.compile(officeTemplateUtil.getTemplate("clothes"), config);
|
||||
template.render(clothes).writeAndClose(os);
|
||||
CommonDownloadUtil.download("服装登记表.docx", os.toByteArray(), response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.budwk.app.zhgh.dayofficework.clothing.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @ClassName ClothingRegister
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/22 18:51
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("服装登记")
|
||||
@Accessors(chain = true)
|
||||
@Table("clothing_register")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ClothingRegister extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("项目id")
|
||||
private String projectId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("登记人")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("登记人姓名")
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("登记人工号")
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("登记人工会ID")
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("登记人单位ID")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("登记人工会")
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("登记人单位")
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("登记时间")
|
||||
private String ctime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("登记需要购买服装的用户")
|
||||
private String buyUserId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("登记需要购买服装的姓名")
|
||||
private String buyUserName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("登记需要购买服装的工号")
|
||||
private String buyUserLoginName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("购买服装的用户工会ID")
|
||||
private String buyUserUnionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("购买服装的用户单位ID")
|
||||
private String buyUserUnitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("购买服装的用户工会")
|
||||
private String buyUserUnionName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("购买服装的用户单位")
|
||||
private String buyUserUnitName;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.budwk.app.zhgh.dayofficework.clothing.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicSettings;
|
||||
import com.budwk.app.zhgh.dayofficework.clothing.model.ClothingRegister;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ClothingService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/22 18:51
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface ClothingService extends BaseService<ClothingRegister> {
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param pageForm: 表单
|
||||
* @param projectId: 项目id
|
||||
* @param year: 年份
|
||||
* @return io.v.nutz.base.page.Pagination
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/5
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, String projectId, String year, String unionId);
|
||||
|
||||
/**
|
||||
* 获取所有买服装的项目
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/5
|
||||
* @return java.util.List<io.v.nutz.activity.models.ActivityBasicSettings>
|
||||
*/
|
||||
List<ActivityBasicSettings> getBuyClothesProject();
|
||||
|
||||
/**
|
||||
* 获取项目人员名单
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/5
|
||||
* @param projectId: 项目id
|
||||
* @return java.util.List<org.nutz.lang.util.NutMap>
|
||||
*/
|
||||
List<NutMap> findBuyClothesUser(String projectId, String userId, String year);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/5
|
||||
* @param projectId: 项目id
|
||||
* @param year: 年份
|
||||
* @param userId: 登记人
|
||||
* @return void
|
||||
*/
|
||||
boolean doDelete(String projectId, String year, String userId);
|
||||
|
||||
/**
|
||||
* 服装登记菜单查询用户
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/5
|
||||
* @param pageForm:
|
||||
* @param year:
|
||||
* @param projectId:
|
||||
* @param isBuy:
|
||||
* @return cn.wizzer.framework.page.Pagination
|
||||
*/
|
||||
Pagination getRegisterUser(PageForm pageForm, Integer year, String projectId, Boolean isBuy, String sex, String unionId);
|
||||
|
||||
Object add(String[] ids, String projectId);
|
||||
|
||||
boolean removeBuyUser(String[] ids, String projectId, Integer year);
|
||||
|
||||
boolean deleteBuyUser(String id);
|
||||
}
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
package com.budwk.app.zhgh.dayofficework.clothing.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.DateUtil;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicSettings;
|
||||
import com.budwk.app.zhgh.dayofficework.clothing.model.ClothingRegister;
|
||||
import com.budwk.app.zhgh.dayofficework.clothing.service.ClothingService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ClothingServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/22 18:55
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ClothingServiceImpl extends BaseServiceImpl<ClothingRegister> implements ClothingService {
|
||||
|
||||
public ClothingServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String projectId, String year, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
YEAR ( c.ctime ) AS `year`,
|
||||
a.name AS projectName,
|
||||
count(c.buyUserId) AS buyCount
|
||||
FROM
|
||||
clothing_register c
|
||||
LEFT JOIN activity_basic_settings a ON a.CODE = c.projectId
|
||||
$condition
|
||||
""");
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if(AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("c.unionid", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
}
|
||||
cnd.andEX("c.unionId", "=", unionId);
|
||||
cnd.andEX("c.projectId", "=", projectId);
|
||||
cnd.andEX("year(c.ctime)", "=", year);
|
||||
cnd.groupBy("c.userId");
|
||||
cnd.desc("year").asc("projectId");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActivityBasicSettings> getBuyClothesProject() {
|
||||
return dao().query(ActivityBasicSettings.class, Cnd.where(ActivityBasicSettings::getClothing, "=", true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> findBuyClothesUser(String projectId, String userId, String year) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
u.sex,
|
||||
u.mobile
|
||||
FROM
|
||||
clothing_register c
|
||||
LEFT JOIN `vw_user` u ON u.id = c.buyUserId
|
||||
$condition
|
||||
""");
|
||||
cnd.andEX("c.projectId", "=", projectId);
|
||||
cnd.andEX("c.userId", "=", userId);
|
||||
cnd.andEX("year(c.ctime)", "=", year);
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doDelete(String projectId, String year, String userId) {
|
||||
int clearCount = dao().clear(ClothingRegister.class, Cnd.where("projectId", "=", projectId)
|
||||
.and("year(ctime)", "=", year).and("userId", "=", userId));
|
||||
return clearCount >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination getRegisterUser(PageForm pageForm, Integer year, String projectId, Boolean isBuy, String sex, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
id,
|
||||
loginname as loginName,
|
||||
username as userName,
|
||||
unitname as unitName,
|
||||
unionname as unionName,
|
||||
sex,
|
||||
mobile
|
||||
from
|
||||
`vw_user` u
|
||||
$condition
|
||||
""");
|
||||
cnd.and("u.member", "=", true);
|
||||
cnd.andEX("u.unionId", "=", StrUtil.isNotBlank(unionId) ? unionId : "");
|
||||
cnd.andEX("u.sex", "=", sex);
|
||||
if (Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.exps("loginname", "like", "%" + pageForm.getSearchKeyword() + "%").or("username", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
}
|
||||
if(year != null) {
|
||||
int lastYear = year - 1;
|
||||
cnd.and(new Static("id %s (select buyUserId from clothing_register where projectId = '%s' and (year(ctime) = '%s' or year(ctime) = '%s'))"
|
||||
.formatted(isBuy ? "in" : "not in", projectId, year, lastYear)));
|
||||
}
|
||||
cnd.asc("unitId");
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object add(String[] ids, String projectId) {
|
||||
List<ClothingRegister> clothingRegisterList = new ArrayList<>();
|
||||
|
||||
View_user loginUser = dao().fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
|
||||
for (String id : ids) {
|
||||
View_user user = dao().fetch(View_user.class, Cnd.where(View_user::getId, "=", id));
|
||||
|
||||
ClothingRegister clothingRegister = new ClothingRegister();
|
||||
clothingRegister.setProjectId(projectId);
|
||||
clothingRegister.setUserId(loginUser.getId());
|
||||
clothingRegister.setUserName(loginUser.getUsername());
|
||||
clothingRegister.setLoginName(loginUser.getLoginname());
|
||||
clothingRegister.setUnitId(loginUser.getUnitId());
|
||||
clothingRegister.setUnitName(loginUser.getUnitName());
|
||||
clothingRegister.setUnionId(loginUser.getUnionId());
|
||||
clothingRegister.setUnionName(loginUser.getUnionName());
|
||||
clothingRegister.setCtime(DateUtil.getDateTime());
|
||||
clothingRegister.setBuyUserId(id);
|
||||
clothingRegister.setBuyUserName(user.getUsername());
|
||||
clothingRegister.setBuyUserLoginName(user.getLoginname());
|
||||
clothingRegister.setBuyUserUnitId(user.getUnitId());
|
||||
clothingRegister.setBuyUserUnitName(user.getUnitName());
|
||||
clothingRegister.setBuyUserUnionId(user.getUnionId());
|
||||
clothingRegister.setBuyUserUnionName(user.getUnionName());
|
||||
clothingRegisterList.add(clothingRegister);
|
||||
}
|
||||
return dao().insert(clothingRegisterList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeBuyUser(String[] ids, String projectId, Integer year) {
|
||||
Trans.exec(() -> {
|
||||
dao().clear(ClothingRegister.class, Cnd.where("projectId", "=", projectId)
|
||||
.and("year(ctime)", "=", year).and("buyUserId", "in", ids));
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteBuyUser(String id) {
|
||||
int clearCount = dao().clear(ClothingRegister.class, Cnd.where("id", "=", id));
|
||||
return clearCount >= 0;
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.budwk.app.zhgh.dayofficework.condolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName CondolenceApplyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/28 11:06
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/condolence/apply")
|
||||
@Api("新闻投稿统计分析")
|
||||
@Ok("json:full")
|
||||
public class CondolenceApplyController {
|
||||
|
||||
@At("/form")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/condolence/apply/index.html")
|
||||
@SaCheckLogin
|
||||
public void index() {}
|
||||
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.budwk.app.zhgh.dayofficework.condolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName CondolenceUnionAuditController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/28 11:33
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/condolence/unionAudit")
|
||||
@Api("新闻投稿统计分析")
|
||||
@Ok("json:full")
|
||||
public class CondolenceUnionAuditController {
|
||||
|
||||
@At("/form")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/condolence/unionAudit/index.html")
|
||||
@SaCheckLogin
|
||||
public void index() {}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.budwk.app.zhgh.dayofficework.condolence.interceptor;
|
||||
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowInterceptor;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.zhgh.dayofficework.article.models.Article;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.json.Json;
|
||||
|
||||
/**
|
||||
* @ClassName CondolenceSaveInterceptor
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/28 11:01
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public class CondolenceSaveInterceptor implements FlowInterceptor {
|
||||
|
||||
@Override
|
||||
public void intercept(Execution execution) {
|
||||
System.out.println("..................");
|
||||
String formDataStr = execution.getArgs().getStr(FlowConst.FORM_DATA);
|
||||
Article article = Json.fromJson(Article.class, formDataStr);
|
||||
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
dao.insertOrUpdate(article);
|
||||
|
||||
// 设置流程变量
|
||||
execution.getArgs().set("origin", article.getOrigin());
|
||||
|
||||
int instanceId = execution.getArgs().getInt(FlowConst.PROCESS_INSTANCE_ID_KEY);
|
||||
dao.update(ProcessInstance.class, Chain.make("businessNo", article.getId()), Cnd.where(ProcessInstance::getId, "=", instanceId));
|
||||
|
||||
System.out.println(execution);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.budwk.app.zhgh.dayofficework.condolence.model;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.dao.interceptor.annotation.PrevUpdate;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName Condolence
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/28 11:03
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("condolence")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("职工慰问")
|
||||
public class Condolence extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("说明")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 500)
|
||||
private String excerpt;
|
||||
|
||||
@Column
|
||||
@Comment("稿件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> files;
|
||||
|
||||
@Column
|
||||
@Comment("投稿人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("投稿人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("投稿人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("投稿人分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("投稿人分工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("投稿人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("投稿人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String origin;
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ContributionDetailedController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 14:58
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "慈善捐款明细")
|
||||
@At("/platform/contribution/detailed")
|
||||
public class ContributionDetailedController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ContributionApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("contribution.detailed")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/contribution/detailed/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("contribution.detailed")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "payMode") String payMode,
|
||||
@Param(value = "contributionName") String contributionName) {
|
||||
Sql sql = applyService.generateSql(unionId, unitId, payMode, contributionName);
|
||||
Pagination pagination = applyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("contribution.detailed")
|
||||
public void doExport(@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "payMode") String payMode,
|
||||
@Param(value = "contributionName") String contributionName,
|
||||
HttpServletResponse response) throws IOException {
|
||||
Sql sql = applyService.generateSql(unionId, unitId, payMode, contributionName);
|
||||
List<NutMap> listMap = applyService.listMap(sql);
|
||||
for (int i = 0; i < listMap.size(); i++) {
|
||||
listMap.get(i).put("index", i + 1);
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("序号", "index", 10));
|
||||
entityList.add(new ExcelExportEntity("捐款项目", "contributionName", 20));
|
||||
entityList.add(new ExcelExportEntity("捐款人工号", "loginName", 20));
|
||||
entityList.add(new ExcelExportEntity("捐款人姓名", "userName", 20));
|
||||
entityList.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
entityList.add(new ExcelExportEntity("所属工会", "unionName", 20));
|
||||
entityList.add(new ExcelExportEntity("所属单位", "unitName", 20));
|
||||
entityList.add(new ExcelExportEntity("善款金额", "money", 20));
|
||||
entityList.add(new ExcelExportEntity("捐赠方式", "payModeName", 20));
|
||||
entityList.add(new ExcelExportEntity("捐赠时间", "contributionTime", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, listMap);
|
||||
CommonDownloadUtil.download("捐款明细.xlsx", workbook, response);
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionProject;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionType;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ContributionProjectController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 10:51
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "慈善捐款项目")
|
||||
@At("/platform/contribution/list")
|
||||
public class ContributionProjectController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ContributionTypeService typeService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("contribution.list")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/contribution/list/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("contribution.list")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param("contributionName") String contributionName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
con.*,
|
||||
type.typeName
|
||||
FROM
|
||||
`contribution_project` con
|
||||
LEFT JOIN contribution_type type ON type.typeCode = con.contributionTypeCode
|
||||
$condition
|
||||
""");
|
||||
if (Strings.isNotBlank(contributionName)) {
|
||||
cnd.where().andLike("con.contributionName", contributionName);
|
||||
}
|
||||
cnd.asc("con.contributionTypeCode");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = typeService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改慈善捐款项目")
|
||||
@SaCheckPermission("contribution.list")
|
||||
@SLog(type = "contribution", tag = "新增/修改慈善捐款项目", msg = "新增/修改慈善捐款项目")
|
||||
public Object onSubmit(ContributionProject project) {
|
||||
if(StrUtil.isBlank(project.getId())) {
|
||||
project.setContributionCreationDate(DateUtil.now());
|
||||
}
|
||||
typeService.dao().insertOrUpdate(project);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除慈善捐款项目")
|
||||
@SaCheckPermission("contribution.list")
|
||||
@SLog(type = "contribution", tag = "删除慈善捐款项目", msg = "删除慈善捐款项目")
|
||||
public Object onDelete(String id) {
|
||||
typeService.dao().delete(ContributionProject.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询慈善捐款项目")
|
||||
@SaCheckPermission("contribution.list")
|
||||
public Result queryContributionList() {
|
||||
List<ContributionProject> list = typeService.dao().query(
|
||||
ContributionProject.class,
|
||||
Cnd.where(ContributionProject::getIsContributionEnable, "=", true)
|
||||
.desc(ContributionProject::getContributionCreationDate)
|
||||
);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName ContributionStatisticsController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 15:42
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "慈善捐款分工会统计")
|
||||
@At("/platform/contribution/statistics")
|
||||
public class ContributionStatisticsController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ContributionApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("contribution.statistics")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/contribution/statistics/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("contribution.statistics")
|
||||
public Result pageData(@Param(value = "unionId") String unionId,
|
||||
@Param(value = "contributionId") String contributionId) {
|
||||
List<Sys_union> unionList = dao.query(Sys_union.class, Cnd.NEW().andEX("id", "=", unionId).asc(Sys_union::getUnionCode));
|
||||
List<ContributionApply> applyList = applyService.query(Cnd.NEW().andEX(ContributionApply::getContributionId, "=", contributionId));
|
||||
|
||||
List<NutMap> resultList = new ArrayList<>();
|
||||
for (Sys_union union : unionList) {
|
||||
NutMap map = Lang.obj2nutmap(union);
|
||||
//找这个项目的人,去重
|
||||
List<ContributionApply> userList = applyList.stream()
|
||||
.collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ContributionApply::getUserId))))
|
||||
.stream()
|
||||
.toList();
|
||||
|
||||
//这个项目每个分工会有多少个人捐款
|
||||
List<ContributionApply> list = userList.stream()
|
||||
.filter(n -> n.getUnionId().equals(union.getId()) && n.getContributionId().equals(contributionId))
|
||||
.toList();
|
||||
map.setv("contributionUserNum", list.size());
|
||||
|
||||
//捐款多少笔
|
||||
long conCount = applyList.stream()
|
||||
.filter(n -> n.getUnionId().equals(union.getId()) && n.getContributionId().equals(contributionId))
|
||||
.count();
|
||||
map.setv("contributionNum", conCount);
|
||||
|
||||
//一共捐了多少钱
|
||||
double money = list.stream().mapToDouble(ContributionApply::getMoney).sum();
|
||||
map.setv("money", money);
|
||||
|
||||
resultList.add(map);
|
||||
}
|
||||
return Result.success(resultList);
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionType;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName contributionTypeController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 10:06
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "慈善捐款专题")
|
||||
@At("/platform/contribution/type")
|
||||
public class ContributionTypeController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ContributionTypeService typeService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("contribution.type")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/contribution/type/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("contribution.type")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(ContributionType::getTypeName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(ContributionType::getTypeCode, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.asc("typeCode");
|
||||
Pagination pagination = typeService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改慈善捐款专题")
|
||||
@SaCheckPermission("contribution.type")
|
||||
@SLog(type = "contribution", tag = "新增/修改慈善捐款专题", msg = "新增/修改慈善捐款专题")
|
||||
public Object onSubmit(ContributionType type) {
|
||||
typeService.insertOrUpdate(type);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除慈善捐款专题")
|
||||
@SaCheckPermission("contribution.type")
|
||||
@SLog(type = "contribution", tag = "删除慈善捐款专题", msg = "删除慈善捐款专题")
|
||||
public Object onDelete(String id) {
|
||||
typeService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询慈善捐款专题")
|
||||
@SaCheckPermission("contribution.type")
|
||||
public Result queryContributionType() {
|
||||
List<ContributionType> list = typeService.query(Cnd.NEW().desc(ContributionType::getTypeCode));
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.model;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ContributionApply
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 10:03
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("慈善捐款明细")
|
||||
@Accessors(chain = true)
|
||||
@Table("contribution_apply")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ContributionApply extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("项目Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String contributionId;
|
||||
|
||||
@Column
|
||||
@Comment("项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String contributionName;
|
||||
|
||||
@Column
|
||||
@Comment("支付人Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("支付人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("支付人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("支付人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("支付人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("支付人工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("支付人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("捐款金额")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private double money;
|
||||
|
||||
@Column
|
||||
@Comment("支付方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String payMode;
|
||||
|
||||
@Column
|
||||
@Comment("捐款时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String contributionTime;
|
||||
|
||||
@Column
|
||||
@Comment("捐款图片")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> contributionFiles;
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.model;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName Contribution
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 9:59
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("慈善捐款")
|
||||
@Accessors(chain = true)
|
||||
@Table("contribution_project")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ContributionProject extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("项目名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String contributionName;
|
||||
|
||||
@Column
|
||||
@Comment("项目介绍")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String contributionIntroduce;
|
||||
|
||||
@Column
|
||||
@Comment("所属捐款专题")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String contributionTypeCode;
|
||||
|
||||
@Column
|
||||
@Comment("项目图片")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String contributionFiles;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String contributionCreationDate;
|
||||
|
||||
@Column
|
||||
@Comment("是否启用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isContributionEnable;
|
||||
|
||||
@Column
|
||||
@Comment("捐款模式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String contributionMode;
|
||||
|
||||
@Column
|
||||
@Comment("捐款链接")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String contributionUrl;
|
||||
|
||||
@Column
|
||||
@Comment("捐款开启时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 40)
|
||||
private String contributionStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("捐款结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 40)
|
||||
private String contributionEndTime;
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.model;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ContributionType
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 10:01
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("慈善捐款专题")
|
||||
@Accessors(chain = true)
|
||||
@Table("contribution_type")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ContributionType extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("专题名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String typeName;
|
||||
|
||||
@Column
|
||||
@Comment("专题编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String typeCode;
|
||||
|
||||
@Column
|
||||
@Comment("专题介绍")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String contributionTypeIntroduce;
|
||||
|
||||
@Column
|
||||
@Comment("专题图片")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String contributionTypeFiles;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionApply;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
/**
|
||||
* @ClassName ContributionApplyService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 15:00
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface ContributionApplyService extends BaseService<ContributionApply> {
|
||||
|
||||
/**
|
||||
* 生成查询捐款明细的sql
|
||||
* @return
|
||||
*/
|
||||
Sql generateSql(String unionId, String unitId, String payMode, String contributionName);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionType;
|
||||
|
||||
/**
|
||||
* @ClassName ContributionTypeService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 10:07
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface ContributionTypeService extends BaseService<ContributionType> {
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionApplyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
|
||||
/**
|
||||
* @ClassName ContributionApplyServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 15:00
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ContributionApplyServiceImpl extends BaseServiceImpl<ContributionApply> implements ContributionApplyService {
|
||||
|
||||
public ContributionApplyServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sql generateSql(String unionId, String unitId, String payMode, String contributionName) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
ca.*,
|
||||
CASE WHEN ca.payMode = 'WeChat' THEN '微信' ELSE '支付宝' END AS payModeName
|
||||
from
|
||||
contribution_apply ca
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX(ContributionApply::getUnionId, "=", unionId);
|
||||
cnd.andEX(ContributionApply::getUnitId, "=", unitId);
|
||||
cnd.andEX(ContributionApply::getPayMode, "=", payMode);
|
||||
if (Strings.isNotBlank(contributionName)) {
|
||||
cnd.where().andLike(ContributionApply::getContributionName, contributionName);
|
||||
}
|
||||
cnd.desc(ContributionApply::getContributionTime);
|
||||
cnd.asc(ContributionApply::getUnitId);
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.contribution.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionType;
|
||||
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @ClassName ContributionTypeServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 10:08
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ContributionTypeServiceImpl extends BaseServiceImpl<ContributionType> implements ContributionTypeService {
|
||||
|
||||
public ContributionTypeServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName LegalApplyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 15:08
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "法律援助预约")
|
||||
@At("/platform/legal/apply")
|
||||
public class LegalApplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private LegalApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("legal.apply")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/legal/apply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改法律援助预约")
|
||||
@SaCheckPermission("legal.apply")
|
||||
@SLog(type = "legal", tag = "新增/修改法律援助预约", msg = "新增/修改法律援助预约")
|
||||
public Object onSubmit(LegalApply apply) {
|
||||
LegalApply legalApply = applyService.fetch(apply.getId());
|
||||
if(StrUtil.isNotBlank(legalApply.getUserId())) {
|
||||
return Result.error("该时段已被预约");
|
||||
}
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
|
||||
apply.setUserId(user.getId());
|
||||
apply.setLoginName(user.getLoginname());
|
||||
apply.setUserName(user.getUsername());
|
||||
apply.setUnitId(user.getUnitId());
|
||||
apply.setUnitName(user.getUnitName());
|
||||
apply.setUnionId(user.getUnionId());
|
||||
apply.setUnionName(user.getUnionName());
|
||||
/*apply.setMobile(apply.getMobile());
|
||||
apply.setRemark(apply.getRemark());
|
||||
apply.setAskTypeValue(apply.getAskTypeValue());*/
|
||||
applyService.updateIgnoreNull(apply);
|
||||
|
||||
//TODO:这里后面要加发短信
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName LegalAppointmentSetController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 10:04
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "法律援助预约安排")
|
||||
@At("/platform/legal/appointmentSet")
|
||||
public class LegalAppointmentSetController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private LegalApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("legal.appointmentSet")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/legal/appointmentSet/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询时间段内的预约信息")
|
||||
@SaCheckPermission("legal.appointmentSet")
|
||||
public Result queryAppointmentInfo(Long startTimeTs, Long endTimeTs) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pa.*,
|
||||
pa.userId as appointmentUser,
|
||||
pa.userName AS appointmentUserName,
|
||||
pa.loginName AS appointmentLoginName,
|
||||
pa.unitName AS appointmentUnitName,
|
||||
pa.mobile AS appointmentMobile,
|
||||
pd.specialty AS doctorSpecialty,
|
||||
pd.introduce AS doctorIntroduce,
|
||||
pd.sex AS doctorSex,
|
||||
pd.technicalTitle AS doctorJobTitle,
|
||||
pd.unitName AS doctorUnitName,
|
||||
pd.avatar AS doctorAvatar,
|
||||
pd.mobile AS doctorMobile,
|
||||
pd.userName AS doctorUserName
|
||||
FROM
|
||||
`legal_apply` pa
|
||||
LEFT JOIN legal_doctor pd ON pd.userId = pa.doctorUser
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("startTimeTs", ">=", startTimeTs);
|
||||
cnd.and("endTimeTs", "<=", endTimeTs);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = applyService.listMap(sql);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改法律援助安排")
|
||||
@SaCheckPermission("legal.appointmentSet")
|
||||
@SLog(type = "legal", tag = "新增/修改法律援助安排", msg = "新增/修改法律援助安排")
|
||||
public Object onSubmit(LegalApply apply) {
|
||||
long startTimeTs = com.budwk.app.base.utils.DateUtil.formatDate(apply.getStartTime());
|
||||
long endTimeTs = com.budwk.app.base.utils.DateUtil.formatDate(apply.getEndTime());
|
||||
List<LegalApply> list = new ArrayList<>();
|
||||
for (long i = startTimeTs; i < endTimeTs; i = i + 3600000) {
|
||||
LegalApply app = new LegalApply();
|
||||
LegalApply legalAppointmentInfo = Lang.copyProperties(apply, app);
|
||||
String start = com.budwk.app.base.utils.DateUtil.getDate(i / 1000);
|
||||
long e = i + 3600000;
|
||||
if ((endTimeTs - e) <= 0) {
|
||||
e = i + (endTimeTs - i);
|
||||
}
|
||||
String end = com.budwk.app.base.utils.DateUtil.getDate(e / 1000);
|
||||
legalAppointmentInfo.setStartTimeTs(i);
|
||||
legalAppointmentInfo.setEndTimeTs(e);
|
||||
legalAppointmentInfo.setStartTime(start);
|
||||
legalAppointmentInfo.setEndTime(end);
|
||||
list.add(legalAppointmentInfo);
|
||||
}
|
||||
dao.insert(list);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("修改法律援助安排")
|
||||
@SaCheckPermission("legal.appointmentSet")
|
||||
@SLog(type = "legal", tag = "修改法律援助安排", msg = "修改法律援助安排")
|
||||
public Object onEdit(String id, String[] askType) {
|
||||
LegalApply apply = applyService.fetch(id);
|
||||
apply.setAskType(Lang.isNotEmpty(askType) ? Arrays.asList(askType) : new ArrayList<>());
|
||||
apply.setAskTypeValue(null);
|
||||
applyService.update(apply);
|
||||
//TODO:以后这里加个发短信
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除法律援助安排")
|
||||
@SaCheckPermission("legal.appointmentSet")
|
||||
@SLog(type = "legal", tag = "删除法律援助安排", msg = "删除法律援助安排")
|
||||
public Object onDelete(String id) {
|
||||
applyService.delete(id);
|
||||
//TODO:以后这里加个发短信
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询咨询师")
|
||||
@SaCheckPermission("legal.appointmentSet")
|
||||
public Result queryDoctorUser(String keyWord, long startTimeTs, long endTimeTs) {
|
||||
//先查询该时间段没时间的咨询师
|
||||
Sql doctorSql = Sqls.create("""
|
||||
SELECT
|
||||
pd.userId AS id,
|
||||
pd.userName AS doctorUserName,
|
||||
replace(pd.mobile,' ','') as mobile
|
||||
FROM
|
||||
legal_doctor pd
|
||||
WHERE
|
||||
pd.userId NOT IN
|
||||
(
|
||||
SELECT doctorUser FROM legal_apply
|
||||
WHERE startTimeTs >= @startTimeTs AND endTimeTs <= @endTimeTs
|
||||
AND doctorUser IS NOT NULL
|
||||
)
|
||||
and (pd.userName like @keyWord or pd.loginName like @keyWord)
|
||||
""");
|
||||
doctorSql.setParam("startTimeTs", startTimeTs);
|
||||
doctorSql.setParam("endTimeTs", endTimeTs);
|
||||
doctorSql.setParam("keyWord", "%" + keyWord + "%");
|
||||
Pagination pagination = applyService.listPageMap(1, 10, doctorSql);
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalDoctor;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalDoctorService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName LegalDoctorController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 18:18
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "法律援助咨询师")
|
||||
@At("/platform/legal/doctorManage")
|
||||
public class LegalDoctorController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private LegalDoctorService doctorService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("legal.doctorManage")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/legal/doctorManage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("legal.doctorManage")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(LegalDoctor::getLoginName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(LegalDoctor::getUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
Pagination pagination = doctorService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("新增/修改法律援助师")
|
||||
@SaCheckPermission("legal.doctorManage")
|
||||
@SLog(type = "legal", tag = "新增/修改法律援助师", msg = "新增/修改法律援助师")
|
||||
public Object onSubmit(LegalDoctor doctor) {
|
||||
if(StrUtil.isBlank(doctor.getId())) {
|
||||
int count = doctorService.count(Cnd.where(LegalDoctor::getUserId, "=", doctor.getUserId()));
|
||||
if(count > 0) {
|
||||
return Result.error("此咨询师信息已录入");
|
||||
}
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", doctor.getUserId()));
|
||||
doctor.setLoginName(user.getLoginname());
|
||||
doctor.setUserName(user.getUsername());
|
||||
doctor.setUnitId(user.getUnitId());
|
||||
doctor.setUnitName(user.getUnitName());
|
||||
doctor.setUnionId(user.getUnionId());
|
||||
doctor.setUnionName(user.getUnionName());
|
||||
//插入角色
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setUserId(doctor.getUserId());
|
||||
userRole.setRoleId(RoleConstant.PSYCHOLOGY_DOCTOR.name());
|
||||
dao.insert(userRole);
|
||||
}
|
||||
doctorService.insertOrUpdate(doctor);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除法律援助师")
|
||||
@SaCheckPermission("legal.doctorManage")
|
||||
@SLog(type = "legal", tag = "删除法律援助师", msg = "删除法律援助师")
|
||||
public Object onDelete(String id) {
|
||||
doctorService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询用户")
|
||||
@SaCheckPermission("legal.doctorManage")
|
||||
@SLog(type = "legal", tag = "查询用户", msg = "查询用户")
|
||||
public Object listUser(String keyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
id,
|
||||
username as userName,
|
||||
loginname as loginName,
|
||||
sex,
|
||||
mobile,
|
||||
technicalTitle,
|
||||
unitname as unitName
|
||||
from
|
||||
vw_user
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(View_user::getLoginname, "like", "%" + keyword + "%");
|
||||
seg.or(View_user::getUsername, "like", "%" + keyword + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
List<LegalDoctor> list = doctorService.query(Cnd.NEW());
|
||||
List<String> idList = list.stream().map(LegalDoctor::getUserId).toList();
|
||||
cnd.andEX(View_user::getId, "not in", idList);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = doctorService.listPageMap(1, 50, sql);
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @ClassName LegalListController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 16:00
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "法律援助我的预约")
|
||||
@At("/platform/legal/list")
|
||||
public class LegalListController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private LegalApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("legal.list")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/legal/list/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("legal.list")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pa.*,
|
||||
pa.userName AS appointmentUserName,
|
||||
pa.loginName AS appointmentLoginName,
|
||||
pa.unitName AS appointmentUnitName,
|
||||
pa.mobile AS appointmentMobile,
|
||||
pd.specialty AS doctorSpecialty,
|
||||
pd.introduce AS doctorIntroduce,
|
||||
pd.sex AS doctorSex,
|
||||
pd.technicalTitle AS doctorJobTitle,
|
||||
pd.unitName AS doctorUnitName,
|
||||
pd.avatar AS doctorAvatar,
|
||||
pd.mobile AS doctorMobile,
|
||||
pd.userName AS doctorUserName
|
||||
FROM
|
||||
`legal_apply` pa
|
||||
LEFT JOIN legal_doctor pd ON pd.userId = pa.doctorUser
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("pa.userId", "IS NOT", null);
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
|
||||
cnd.and("pa.userId", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
cnd.andEX("YEAR(pa.startTime)", "=", year);
|
||||
cnd.desc("pa.startTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = applyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除法律援助预约")
|
||||
@SaCheckPermission("legal.list")
|
||||
@SLog(type = "legal", tag = "删除法律援助预约", msg = "删除法律援助预约")
|
||||
public Object onDelete(String id) {
|
||||
LegalApply apply = applyService.fetch(id);
|
||||
apply.setUserId(null);
|
||||
apply.setLoginName(null);
|
||||
apply.setUserName(null);
|
||||
apply.setUnitId(null);
|
||||
apply.setUnitName(null);
|
||||
apply.setUnionId(null);
|
||||
apply.setUnionName(null);
|
||||
apply.setRemark(null);
|
||||
apply.setMobile(null);
|
||||
applyService.update(apply);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalOnlinePost;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalOnlineReply;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName LegalOnlinePostController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:37
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "法律援助线上发帖")
|
||||
@At("/platform/legal/onlinePost")
|
||||
public class LegalOnlinePostController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("legal.onlinePost")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/legal/onlinePost/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("legal.onlinePost")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "isReply") Boolean isReply) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pop.*,
|
||||
IF( count( por.id ) = 0, false, true ) AS isReply
|
||||
FROM
|
||||
legal_online_post pop
|
||||
LEFT JOIN legal_online_reply por on por.postId = pop.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("poster", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
cnd.andEX("YEAR(pop.postingTime)", "=", year);
|
||||
cnd.groupBy("pop.id");
|
||||
cnd.having(Cnd.where("count(por.id)", isReply == null ? ">=" : isReply ? ">" : "=", 0));
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改法律援助线上发帖")
|
||||
@SaCheckPermission("legal.onlinePost")
|
||||
@SLog(type = "legal", tag = "新增/修改法律援助线上发帖", msg = "新增/修改法律援助线上发帖")
|
||||
public Object onSubmit(LegalOnlinePost post) {
|
||||
if(StrUtil.isBlank(post.getId())) {
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
post.setPoster(user.getId());
|
||||
post.setLoginName(user.getLoginname());
|
||||
post.setUserName(user.getUsername());
|
||||
post.setUnitId(user.getUnitId());
|
||||
post.setUnitName(user.getUnitName());
|
||||
post.setUnionId(user.getUnionId());
|
||||
post.setUnionName(user.getUnionName());
|
||||
post.setMobile(user.getMobile());
|
||||
post.setPostingTime(DateUtil.now());
|
||||
}
|
||||
dao.insertOrUpdate(post);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除法律援助线上发帖")
|
||||
@SaCheckPermission("legal.onlinePost")
|
||||
@SLog(type = "legal", tag = "删除法律援助线上发帖", msg = "删除法律援助线上发帖")
|
||||
public Object onDelete(String id) {
|
||||
dao.delete(LegalOnlinePost.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询法律援助线上发帖")
|
||||
@SaCheckPermission("legal.onlinePost")
|
||||
public Result fetchOne(String id) {
|
||||
LegalOnlinePost onlinePost = dao.fetch(LegalOnlinePost.class, id);
|
||||
List<LegalOnlineReply> replyList = dao.query(
|
||||
LegalOnlineReply.class,
|
||||
Cnd.where(LegalOnlineReply::getPostId, "=", id).desc(LegalOnlineReply::getReplyTime)
|
||||
);
|
||||
NutMap nutMap = Lang.obj2nutmap(onlinePost);
|
||||
nutMap.put("replyList", replyList);
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalOnlinePost;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalOnlineReply;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName LegalOnlineReplyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 17:35
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "法律援助线上回复")
|
||||
@At("/platform/legal/onlineReply")
|
||||
public class LegalOnlineReplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("legal.onlineReply")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/legal/onlineReply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("legal.onlineReply")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "isReply") Boolean isReply) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pop.id,
|
||||
pop.poster,
|
||||
pop.loginName,
|
||||
pop.postingTime,
|
||||
pop.postTitle,
|
||||
pop.postContent,
|
||||
CONCAT( LEFT( pop.userName, 1 ), '**' ) AS posterUserName,
|
||||
count( por.id ) AS replyCount
|
||||
FROM
|
||||
legal_online_post pop
|
||||
LEFT JOIN legal_online_reply por ON por.postId = pop.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(pop.postingTime)", "=", year);
|
||||
cnd.groupBy("pop.id");
|
||||
cnd.having(Cnd.where("count(por.id)", isReply == null ? ">=" : isReply ? ">" : "=", 0));
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改法律援助线上回复")
|
||||
@SaCheckPermission("legal.onlineReply")
|
||||
@SLog(type = "legal", tag = "新增/修改法律援助线上回复", msg = "新增/修改法律援助线上回复")
|
||||
public Object onSubmit(LegalOnlineReply reply) {
|
||||
if (StrUtil.isBlank(reply.getId())) {
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
reply.setReplyUserId(user.getId());
|
||||
reply.setLoginName(user.getLoginname());
|
||||
reply.setUserName(user.getUsername());
|
||||
reply.setUnitId(user.getUnitId());
|
||||
reply.setUnitName(user.getUnitName());
|
||||
reply.setUnionId(user.getUnionId());
|
||||
reply.setUnionName(user.getUnionName());
|
||||
reply.setMobile(user.getMobile());
|
||||
reply.setReplyTime(DateUtil.now());
|
||||
}
|
||||
dao.insertOrUpdate(reply);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询法律援助线上回复")
|
||||
@SaCheckPermission("legal.onlineReply")
|
||||
public Result fetchOne(String id) {
|
||||
LegalOnlinePost onlinePost = dao.fetch(LegalOnlinePost.class, id);
|
||||
List<LegalOnlineReply> replyList = dao.query(
|
||||
LegalOnlineReply.class,
|
||||
Cnd.where(LegalOnlineReply::getPostId, "=", id).desc(LegalOnlineReply::getReplyTime)
|
||||
);
|
||||
replyList.forEach(item -> item.setUserName(item.getUserName().charAt(0) + "**"));
|
||||
NutMap nutMap = Lang.obj2nutmap(onlinePost);
|
||||
nutMap.put("userName", onlinePost.getUserName().charAt(0) + "**");
|
||||
nutMap.put("replyList", replyList);
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalDoctor;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName LegalStatisticsController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 16:16
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "法律援助统计分析")
|
||||
@At("/platform/legal/statistics")
|
||||
public class LegalStatisticsController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private LegalApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("legal.statistics")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/legal/statistics/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("legal.statistics")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "tableIndex") Integer tableIndex,
|
||||
@Param(value = "doctorUser") String doctorUser) {
|
||||
Sql sql = null;
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (tableIndex == 1) {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
pd.userId,
|
||||
pd.userName AS doctorUserName,
|
||||
pd.sex,
|
||||
pd.technicalTitle as jobTitle,
|
||||
(select count(*) from legal_apply pa where pa.doctorUser = pd.userId and pa.userId is not null) AS serviceNum
|
||||
FROM
|
||||
legal_doctor pd
|
||||
LEFT JOIN legal_apply pa ON pa.doctorUser = pd.userId
|
||||
$condition
|
||||
""");
|
||||
cnd.andEX("YEAR(pa.startTime)", "=", year);
|
||||
cnd.groupBy("pd.userId");
|
||||
cnd.desc("serviceNum");
|
||||
} else if (tableIndex == 2) {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
pa.*,
|
||||
u.username AS doctorUserName
|
||||
FROM
|
||||
legal_apply pa
|
||||
left join vw_user u on u.id = pa.doctorUser
|
||||
$condition
|
||||
""");
|
||||
cnd.and("pa.userId", "is not", null);
|
||||
cnd.andEX("pa.doctorUser", "=", doctorUser);
|
||||
cnd.andEX("YEAR(pa.startTime)", "=", year);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = applyService.listMap(sql);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("统计数量")
|
||||
@SaCheckPermission("legal.statistics")
|
||||
public Result queryCount(@Param(value = "year") Integer year) {
|
||||
NutMap resultMap = new NutMap();
|
||||
List<LegalApply> list = applyService.query(Cnd.NEW().andEX("YEAR(startTime)", "=", year));
|
||||
resultMap.put("total", list.size());
|
||||
|
||||
long serviceTeacherCount = list.stream().map(LegalApply::getUserId).filter(StrUtil::isNotBlank).distinct().count();
|
||||
resultMap.put("successNum", serviceTeacherCount);
|
||||
resultMap.put("serviceTeacherCount", serviceTeacherCount);
|
||||
|
||||
int doctorCount = applyService.dao().count(LegalDoctor.class, Cnd.NEW());
|
||||
resultMap.put("doctorCount", doctorCount);
|
||||
|
||||
return Result.success(resultMap);
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalStudy;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName LegalStudyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:19
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "法律援助资料学习")
|
||||
@At("/platform/legal/study")
|
||||
public class LegalStudyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("legal.study")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/legal/study/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("legal.study")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
s.*,
|
||||
u.username
|
||||
from
|
||||
legal_study s
|
||||
left join `vw_user` u on u.id = s.createdBy
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(StrUtil.isNotBlank(pageForm.getSearchKeyword())){
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("s.title", pageForm.getSearchKeyword());
|
||||
seg.orLike("s.url", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改法律援助资料")
|
||||
@SaCheckPermission("legal.study")
|
||||
@SLog(type = "legal", tag = "新增/修改法律援助资料", msg = "新增/修改法律援助资料")
|
||||
public Object onSubmit(LegalStudy study) {
|
||||
dao.insertOrUpdate(study);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除法律援助资料")
|
||||
@SaCheckPermission("legal.study")
|
||||
@SLog(type = "legal", tag = "删除法律援助资料", msg = "删除法律援助资料")
|
||||
public Object onDelete(String id) {
|
||||
dao.delete(LegalStudy.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName LegalApply
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:12
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("法律援助预约")
|
||||
@Accessors(chain = true)
|
||||
@Table("legal_apply")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LegalApply extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Comment("日期")
|
||||
private String date;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Comment("开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Comment("结束时间")
|
||||
private String endTime;
|
||||
|
||||
@Column
|
||||
@Comment("开始时间")
|
||||
private Long startTimeTs;
|
||||
|
||||
@Column
|
||||
@Comment("结束时间")
|
||||
private Long endTimeTs;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("预约人")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("预约人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("预约人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("预约人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("预约人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("预约人工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("预约人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("预约人备注")
|
||||
private String remark;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("咨询师")
|
||||
private String doctorUser;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("咨询方式")
|
||||
private List<String> askType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("预约人选择的咨询方式")
|
||||
private String askTypeValue;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @ClassName LegalDoctor
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:16
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("法律援助咨询师")
|
||||
@Accessors(chain = true)
|
||||
@Table("legal_doctor")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LegalDoctor extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1)
|
||||
@Comment("性别")
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("职称")
|
||||
private String technicalTitle;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
@Comment("特长")
|
||||
private String specialty;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
@Comment("简介")
|
||||
private String introduce;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
@Comment("头像")
|
||||
private String avatar;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @ClassName LegalOnlinePost
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:17
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("法律援助线上发帖")
|
||||
@Accessors(chain = true)
|
||||
@Table("legal_online_post")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LegalOnlinePost extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("发帖人")
|
||||
private String poster;
|
||||
|
||||
@Column
|
||||
@Comment("发帖人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("发帖人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("发帖人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("发帖人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("发帖人工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("发帖人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Comment("发帖时间")
|
||||
private String postingTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("发帖标题")
|
||||
private String postTitle;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
@Comment("发帖内容")
|
||||
private String postContent;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @ClassName LegalOnlineReply
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:18
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("法律援助线上答复")
|
||||
@Accessors(chain = true)
|
||||
@Table("legal_online_reply")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LegalOnlineReply extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("帖子Id")
|
||||
private String postId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("答复人")
|
||||
private String replyUserId;
|
||||
|
||||
@Column
|
||||
@Comment("答复人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("答复人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("答复人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("答复人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("答复人工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("答复人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Comment("答复时间")
|
||||
private String replyTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
@Comment("答复内容")
|
||||
private String replyContent;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @ClassName LegalStudy
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:11
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("法律援助资料学习")
|
||||
@Accessors(chain = true)
|
||||
@Table("legal_study")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LegalStudy extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("标题")
|
||||
private String title;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("跳转链接")
|
||||
private String url;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
@Comment("备注")
|
||||
private String bz;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
|
||||
|
||||
/**
|
||||
* @ClassName LegalApplyService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 10:07
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface LegalApplyService extends BaseService<LegalApply> {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalDoctor;
|
||||
|
||||
/**
|
||||
* @ClassName LegalDoctorService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 9:13
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface LegalDoctorService extends BaseService<LegalDoctor> {
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @ClassName LegalApplyServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 10:07
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class LegalApplyServiceImpl extends BaseServiceImpl<LegalApply> implements LegalApplyService {
|
||||
|
||||
public LegalApplyServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.legal.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalDoctor;
|
||||
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalDoctorService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @ClassName LegalDoctorServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 9:14
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class LegalDoctorServiceImpl extends BaseServiceImpl<LegalDoctor> implements LegalDoctorService {
|
||||
|
||||
public LegalDoctorServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName PsychologyApplyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 15:08
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "心理咨询预约")
|
||||
@At("/platform/psychology/apply")
|
||||
public class PsychologyApplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private PsychologyApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("psychology.apply")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/apply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改心理咨询预约")
|
||||
@SaCheckPermission("psychology.apply")
|
||||
@SLog(type = "psychology", tag = "新增/修改心理咨询预约", msg = "新增/修改心理咨询预约")
|
||||
public Object onSubmit(PsychologyApply apply) {
|
||||
PsychologyApply psychologyApply = applyService.fetch(apply.getId());
|
||||
if(StrUtil.isNotBlank(psychologyApply.getUserId())) {
|
||||
return Result.error("该时段已被预约");
|
||||
}
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
|
||||
apply.setUserId(user.getId());
|
||||
apply.setLoginName(user.getLoginname());
|
||||
apply.setUserName(user.getUsername());
|
||||
apply.setUnitId(user.getUnitId());
|
||||
apply.setUnitName(user.getUnitName());
|
||||
apply.setUnionId(user.getUnionId());
|
||||
apply.setUnionName(user.getUnionName());
|
||||
/*apply.setMobile(apply.getMobile());
|
||||
apply.setRemark(apply.getRemark());
|
||||
apply.setAskTypeValue(apply.getAskTypeValue());*/
|
||||
applyService.updateIgnoreNull(apply);
|
||||
//TODO:这里后面要加发短信
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlinePost;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyApplyService;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyDoctorService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PsychologyAppointmentSetController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 10:04
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "心理咨询预约安排")
|
||||
@At("/platform/psychology/appointmentSet")
|
||||
public class PsychologyAppointmentSetController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private PsychologyApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("psychology.appointmentSet")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/appointmentSet/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询时间段内的预约信息")
|
||||
@SaCheckPermission("psychology.appointmentSet")
|
||||
public Result queryAppointmentInfo(Long startTimeTs, Long endTimeTs) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pa.*,
|
||||
pa.userId as appointmentUser,
|
||||
pa.userName AS appointmentUserName,
|
||||
pa.loginName AS appointmentLoginName,
|
||||
pa.unitName AS appointmentUnitName,
|
||||
pa.mobile AS appointmentMobile,
|
||||
pd.specialty AS doctorSpecialty,
|
||||
pd.introduce AS doctorIntroduce,
|
||||
pd.sex AS doctorSex,
|
||||
pd.technicalTitle AS doctorJobTitle,
|
||||
pd.unitName AS doctorUnitName,
|
||||
pd.avatar AS doctorAvatar,
|
||||
pd.mobile AS doctorMobile,
|
||||
pd.userName AS doctorUserName
|
||||
FROM
|
||||
`psychology_apply` pa
|
||||
LEFT JOIN psychology_doctor pd ON pd.userId = pa.doctorUser
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("startTimeTs", ">=", startTimeTs);
|
||||
cnd.and("endTimeTs", "<=", endTimeTs);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = applyService.listMap(sql);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改心理咨询安排")
|
||||
@SaCheckPermission("psychology.appointmentSet")
|
||||
@SLog(type = "psychology", tag = "新增/修改心理咨询安排", msg = "新增/修改心理咨询安排")
|
||||
public Object onSubmit(PsychologyApply apply) {
|
||||
long startTimeTs = com.budwk.app.base.utils.DateUtil.formatDate(apply.getStartTime());
|
||||
long endTimeTs = com.budwk.app.base.utils.DateUtil.formatDate(apply.getEndTime());
|
||||
List<PsychologyApply> list = new ArrayList<>();
|
||||
for (long i = startTimeTs; i < endTimeTs; i = i + 3600000) {
|
||||
PsychologyApply app = new PsychologyApply();
|
||||
PsychologyApply psychologyAppointmentInfo = Lang.copyProperties(apply, app);
|
||||
String start = com.budwk.app.base.utils.DateUtil.getDate(i / 1000);
|
||||
long e = i + 3600000;
|
||||
if ((endTimeTs - e) <= 0) {
|
||||
e = i + (endTimeTs - i);
|
||||
}
|
||||
String end = com.budwk.app.base.utils.DateUtil.getDate(e / 1000);
|
||||
psychologyAppointmentInfo.setStartTimeTs(i);
|
||||
psychologyAppointmentInfo.setEndTimeTs(e);
|
||||
psychologyAppointmentInfo.setStartTime(start);
|
||||
psychologyAppointmentInfo.setEndTime(end);
|
||||
list.add(psychologyAppointmentInfo);
|
||||
}
|
||||
dao.insert(list);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("修改心理咨询安排")
|
||||
@SaCheckPermission("psychology.appointmentSet")
|
||||
@SLog(type = "psychology", tag = "修改心理咨询安排", msg = "修改心理咨询安排")
|
||||
public Object onEdit(String id, String[] askType) {
|
||||
PsychologyApply apply = applyService.fetch(id);
|
||||
apply.setAskType(Lang.isNotEmpty(askType) ? Arrays.asList(askType) : new ArrayList<>());
|
||||
apply.setAskTypeValue(null);
|
||||
applyService.update(apply);
|
||||
//TODO:以后这里加个发短信
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除心理咨询安排")
|
||||
@SaCheckPermission("psychology.appointmentSet")
|
||||
@SLog(type = "psychology", tag = "删除心理咨询安排", msg = "删除心理咨询安排")
|
||||
public Object onDelete(String id) {
|
||||
applyService.delete(id);
|
||||
//TODO:以后这里加个发短信
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询咨询师")
|
||||
@SaCheckPermission("psychology.appointmentSet")
|
||||
public Result queryDoctorUser(String keyWord, long startTimeTs, long endTimeTs) {
|
||||
//先查询该时间段没时间的咨询师
|
||||
Sql doctorSql = Sqls.create("""
|
||||
SELECT
|
||||
pd.userId AS id,
|
||||
pd.userName AS doctorUserName,
|
||||
replace(pd.mobile,' ','') as mobile
|
||||
FROM
|
||||
psychology_doctor pd
|
||||
WHERE
|
||||
pd.userId NOT IN
|
||||
(
|
||||
SELECT doctorUser FROM psychology_apply
|
||||
WHERE startTimeTs >= @startTimeTs AND endTimeTs <= @endTimeTs
|
||||
AND doctorUser IS NOT NULL
|
||||
)
|
||||
and (pd.userName like @keyWord or pd.loginName like @keyWord)
|
||||
""");
|
||||
doctorSql.setParam("startTimeTs", startTimeTs);
|
||||
doctorSql.setParam("endTimeTs", endTimeTs);
|
||||
doctorSql.setParam("keyWord", "%" + keyWord + "%");
|
||||
Pagination pagination = applyService.listPageMap(1, 10, doctorSql);
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyDoctor;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyDoctorService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PsychologyDoctorController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 18:18
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "心理咨询咨询师")
|
||||
@At("/platform/psychology/doctorManage")
|
||||
public class PsychologyDoctorController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private PsychologyDoctorService doctorService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("psychology.doctorManage")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/doctorManage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("psychology.doctorManage")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(PsychologyDoctor::getLoginName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(PsychologyDoctor::getUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
Pagination pagination = doctorService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("新增/修改心理咨询师")
|
||||
@SaCheckPermission("psychology.doctorManage")
|
||||
@SLog(type = "psychology", tag = "新增/修改心理咨询师", msg = "新增/修改心理咨询师")
|
||||
public Object onSubmit(PsychologyDoctor doctor) {
|
||||
if(StrUtil.isBlank(doctor.getId())) {
|
||||
int count = doctorService.count(Cnd.where(PsychologyDoctor::getUserId, "=", doctor.getUserId()));
|
||||
if(count > 0) {
|
||||
return Result.error("此咨询师信息已录入");
|
||||
}
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", doctor.getUserId()));
|
||||
doctor.setLoginName(user.getLoginname());
|
||||
doctor.setUserName(user.getUsername());
|
||||
doctor.setUnitId(user.getUnitId());
|
||||
doctor.setUnitName(user.getUnitName());
|
||||
doctor.setUnionId(user.getUnionId());
|
||||
doctor.setUnionName(user.getUnionName());
|
||||
//插入角色
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setUserId(doctor.getUserId());
|
||||
userRole.setRoleId(RoleConstant.PSYCHOLOGY_DOCTOR.name());
|
||||
dao.insert(userRole);
|
||||
}
|
||||
doctorService.insertOrUpdate(doctor);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除心理咨询师")
|
||||
@SaCheckPermission("psychology.doctorManage")
|
||||
@SLog(type = "psychology", tag = "删除心理咨询师", msg = "删除心理咨询师")
|
||||
public Object onDelete(String id) {
|
||||
doctorService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询用户")
|
||||
@SaCheckPermission("psychology.doctorManage")
|
||||
@SLog(type = "psychology", tag = "查询用户", msg = "查询用户")
|
||||
public Object listUser(String keyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
id,
|
||||
username as userName,
|
||||
loginname as loginName,
|
||||
sex,
|
||||
mobile,
|
||||
technicalTitle,
|
||||
unitname as unitName
|
||||
from
|
||||
vw_user
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(View_user::getLoginname, "like", "%" + keyword + "%");
|
||||
seg.or(View_user::getUsername, "like", "%" + keyword + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
List<PsychologyDoctor> list = doctorService.query(Cnd.NEW());
|
||||
List<String> idList = list.stream().map(PsychologyDoctor::getUserId).toList();
|
||||
cnd.andEX(View_user::getId, "not in", idList);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = doctorService.listPageMap(1, 50, sql);
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlinePost;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @ClassName PsychologyListController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 16:00
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "心理咨询我的预约")
|
||||
@At("/platform/psychology/list")
|
||||
public class PsychologyListController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private PsychologyApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("psychology.list")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/list/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("psychology.list")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pa.*,
|
||||
pa.userName AS appointmentUserName,
|
||||
pa.loginName AS appointmentLoginName,
|
||||
pa.unitName AS appointmentUnitName,
|
||||
pa.mobile AS appointmentMobile,
|
||||
pd.specialty AS doctorSpecialty,
|
||||
pd.introduce AS doctorIntroduce,
|
||||
pd.sex AS doctorSex,
|
||||
pd.technicalTitle AS doctorJobTitle,
|
||||
pd.unitName AS doctorUnitName,
|
||||
pd.avatar AS doctorAvatar,
|
||||
pd.mobile AS doctorMobile,
|
||||
pd.userName AS doctorUserName
|
||||
FROM
|
||||
`psychology_apply` pa
|
||||
LEFT JOIN psychology_doctor pd ON pd.userId = pa.doctorUser
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("pa.userId", "IS NOT", null);
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
|
||||
cnd.and("pa.userId", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
cnd.andEX("YEAR(pa.startTime)", "=", year);
|
||||
cnd.desc("pa.startTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = applyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除心理咨询预约")
|
||||
@SaCheckPermission("psychology.list")
|
||||
@SLog(type = "psychology", tag = "删除心理咨询预约", msg = "删除心理咨询预约")
|
||||
public Object onDelete(String id) {
|
||||
PsychologyApply apply = applyService.fetch(id);
|
||||
apply.setUserId(null);
|
||||
apply.setLoginName(null);
|
||||
apply.setUserName(null);
|
||||
apply.setUnitId(null);
|
||||
apply.setUnitName(null);
|
||||
apply.setUnionId(null);
|
||||
apply.setUnionName(null);
|
||||
apply.setRemark(null);
|
||||
apply.setMobile(null);
|
||||
applyService.update(apply);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlinePost;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlineReply;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PsychologyOnlinePostController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:37
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "心理咨询线上发帖")
|
||||
@At("/platform/psychology/onlinePost")
|
||||
public class PsychologyOnlinePostController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("psychology.onlinePost")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/onlinePost/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("psychology.onlinePost")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "isReply") Boolean isReply) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pop.*,
|
||||
IF( count( por.id ) = 0, false, true ) AS isReply
|
||||
FROM
|
||||
psychology_online_post pop
|
||||
LEFT JOIN psychology_online_reply por on por.postId = pop.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("poster", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
cnd.andEX("YEAR(pop.postingTime)", "=", year);
|
||||
cnd.groupBy("pop.id");
|
||||
cnd.having(Cnd.where("count(por.id)", isReply == null ? ">=" : isReply ? ">" : "=", 0));
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改心理咨询线上发帖")
|
||||
@SaCheckPermission("psychology.onlinePost")
|
||||
@SLog(type = "psychology", tag = "新增/修改心理咨询线上发帖", msg = "新增/修改心理咨询线上发帖")
|
||||
public Object onSubmit(PsychologyOnlinePost post) {
|
||||
if(StrUtil.isBlank(post.getId())) {
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
post.setPoster(user.getId());
|
||||
post.setLoginName(user.getLoginname());
|
||||
post.setUserName(user.getUsername());
|
||||
post.setUnitId(user.getUnitId());
|
||||
post.setUnitName(user.getUnitName());
|
||||
post.setUnionId(user.getUnionId());
|
||||
post.setUnionName(user.getUnionName());
|
||||
post.setMobile(user.getMobile());
|
||||
post.setPostingTime(DateUtil.now());
|
||||
}
|
||||
dao.insertOrUpdate(post);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除心理咨询线上发帖")
|
||||
@SaCheckPermission("psychology.onlinePost")
|
||||
@SLog(type = "psychology", tag = "删除心理咨询线上发帖", msg = "删除心理咨询线上发帖")
|
||||
public Object onDelete(String id) {
|
||||
dao.delete(PsychologyOnlinePost.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询心理咨询线上发帖")
|
||||
@SaCheckPermission("psychology.onlinePost")
|
||||
public Result fetchOne(String id) {
|
||||
PsychologyOnlinePost onlinePost = dao.fetch(PsychologyOnlinePost.class, id);
|
||||
List<PsychologyOnlineReply> replyList = dao.query(
|
||||
PsychologyOnlineReply.class,
|
||||
Cnd.where(PsychologyOnlineReply::getPostId, "=", id).desc(PsychologyOnlineReply::getReplyTime)
|
||||
);
|
||||
NutMap nutMap = Lang.obj2nutmap(onlinePost);
|
||||
nutMap.put("replyList", replyList);
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlinePost;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlineReply;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PsychologyOnlineReplyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 17:35
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "心理咨询线上回复")
|
||||
@At("/platform/psychology/onlineReply")
|
||||
public class PsychologyOnlineReplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("psychology.onlineReply")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/onlineReply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("psychology.onlineReply")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "isReply") Boolean isReply) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pop.id,
|
||||
pop.poster,
|
||||
pop.loginName,
|
||||
pop.postingTime,
|
||||
pop.postTitle,
|
||||
pop.postContent,
|
||||
CONCAT( LEFT( pop.userName, 1 ), '**' ) AS posterUserName,
|
||||
count( por.id ) AS replyCount
|
||||
FROM
|
||||
psychology_online_post pop
|
||||
LEFT JOIN psychology_online_reply por ON por.postId = pop.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(pop.postingTime)", "=", year);
|
||||
cnd.groupBy("pop.id");
|
||||
cnd.having(Cnd.where("count(por.id)", isReply == null ? ">=" : isReply ? ">" : "=", 0));
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改心理咨询线上回复")
|
||||
@SaCheckPermission("psychology.onlineReply")
|
||||
@SLog(type = "psychology", tag = "新增/修改心理咨询线上回复", msg = "新增/修改心理咨询线上回复")
|
||||
public Object onSubmit(PsychologyOnlineReply reply) {
|
||||
if (StrUtil.isBlank(reply.getId())) {
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
reply.setReplyUserId(user.getId());
|
||||
reply.setLoginName(user.getLoginname());
|
||||
reply.setUserName(user.getUsername());
|
||||
reply.setUnitId(user.getUnitId());
|
||||
reply.setUnitName(user.getUnitName());
|
||||
reply.setUnionId(user.getUnionId());
|
||||
reply.setUnionName(user.getUnionName());
|
||||
reply.setMobile(user.getMobile());
|
||||
reply.setReplyTime(DateUtil.now());
|
||||
}
|
||||
dao.insertOrUpdate(reply);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询心理咨询线上回复")
|
||||
@SaCheckPermission("psychology.onlineReply")
|
||||
public Result fetchOne(String id) {
|
||||
PsychologyOnlinePost onlinePost = dao.fetch(PsychologyOnlinePost.class, id);
|
||||
List<PsychologyOnlineReply> replyList = dao.query(
|
||||
PsychologyOnlineReply.class,
|
||||
Cnd.where(PsychologyOnlineReply::getPostId, "=", id).desc(PsychologyOnlineReply::getReplyTime)
|
||||
);
|
||||
replyList.forEach(item -> item.setUserName(item.getUserName().charAt(0) + "**"));
|
||||
NutMap nutMap = Lang.obj2nutmap(onlinePost);
|
||||
nutMap.put("userName", onlinePost.getUserName().charAt(0) + "**");
|
||||
nutMap.put("replyList", replyList);
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyDoctor;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PsychologyStatisticsController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/25 16:16
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "心理咨询统计分析")
|
||||
@At("/platform/psychology/statistics")
|
||||
public class PsychologyStatisticsController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private PsychologyApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("psychology.statistics")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/statistics/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("psychology.statistics")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "tableIndex") Integer tableIndex,
|
||||
@Param(value = "doctorUser") String doctorUser) {
|
||||
Sql sql = null;
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (tableIndex == 1) {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
pd.userId,
|
||||
pd.userName AS doctorUserName,
|
||||
pd.sex,
|
||||
pd.technicalTitle as jobTitle,
|
||||
(select count(*) from psychology_apply pa where pa.doctorUser = pd.userId and pa.userId is not null) AS serviceNum
|
||||
FROM
|
||||
psychology_doctor pd
|
||||
LEFT JOIN psychology_apply pa ON pa.doctorUser = pd.userId
|
||||
$condition
|
||||
""");
|
||||
cnd.andEX("YEAR(pa.startTime)", "=", year);
|
||||
cnd.groupBy("pd.userId");
|
||||
cnd.desc("serviceNum");
|
||||
} else if (tableIndex == 2) {
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
pa.*,
|
||||
u.username AS doctorUserName
|
||||
FROM
|
||||
psychology_apply pa
|
||||
left join vw_user u on u.id = pa.doctorUser
|
||||
$condition
|
||||
""");
|
||||
cnd.and("pa.userId", "is not", null);
|
||||
cnd.andEX("pa.doctorUser", "=", doctorUser);
|
||||
cnd.andEX("YEAR(pa.startTime)", "=", year);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = applyService.listMap(sql);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("统计数量")
|
||||
@SaCheckPermission("psychology.statistics")
|
||||
public Result queryCount(@Param(value = "year") Integer year) {
|
||||
NutMap resultMap = new NutMap();
|
||||
List<PsychologyApply> list = applyService.query(Cnd.NEW().andEX("YEAR(startTime)", "=", year));
|
||||
resultMap.put("total", list.size());
|
||||
|
||||
long serviceTeacherCount = list.stream().map(PsychologyApply::getUserId).filter(StrUtil::isNotBlank).distinct().count();
|
||||
resultMap.put("successNum", serviceTeacherCount);
|
||||
resultMap.put("serviceTeacherCount", serviceTeacherCount);
|
||||
|
||||
int doctorCount = applyService.dao().count(PsychologyDoctor.class, Cnd.NEW());
|
||||
resultMap.put("doctorCount", doctorCount);
|
||||
|
||||
return Result.success(resultMap);
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyStudy;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName PsychologyStudyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:19
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "心理咨询资料学习")
|
||||
@At("/platform/psychology/study")
|
||||
public class PsychologyStudyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("psychology.study")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/study/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("psychology.study")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
s.*,
|
||||
u.username
|
||||
from
|
||||
psychology_study s
|
||||
left join `vw_user` u on u.id = s.createdBy
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(StrUtil.isNotBlank(pageForm.getSearchKeyword())){
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("s.title", pageForm.getSearchKeyword());
|
||||
seg.orLike("s.url", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改心理咨询资料")
|
||||
@SaCheckPermission("psychology.study")
|
||||
@SLog(type = "psychology", tag = "新增/修改心理咨询资料", msg = "新增/修改心理咨询资料")
|
||||
public Object onSubmit(PsychologyStudy study) {
|
||||
dao.insertOrUpdate(study);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除心理咨询资料")
|
||||
@SaCheckPermission("psychology.study")
|
||||
@SLog(type = "psychology", tag = "删除心理咨询资料", msg = "删除心理咨询资料")
|
||||
public Object onDelete(String id) {
|
||||
dao.delete(PsychologyStudy.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PsychologyApply
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/24 16:12
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Comment("心理咨询预约")
|
||||
@Accessors(chain = true)
|
||||
@Table("psychology_apply")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PsychologyApply extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Comment("日期")
|
||||
private String date;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Comment("开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Comment("结束时间")
|
||||
private String endTime;
|
||||
|
||||
@Column
|
||||
@Comment("开始时间")
|
||||
private Long startTimeTs;
|
||||
|
||||
@Column
|
||||
@Comment("结束时间")
|
||||
private Long endTimeTs;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("预约人")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("预约人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("预约人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("预约人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("预约人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("预约人工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("预约人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("预约人备注")
|
||||
private String remark;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("咨询师")
|
||||
private String doctorUser;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("咨询方式")
|
||||
private List<String> askType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("预约人选择的咨询方式")
|
||||
private String askTypeValue;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user