Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/v4
This commit is contained in:
+285
-35
@@ -1,14 +1,19 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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_dict;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
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.basic.models.ActivityUserScope;
|
||||
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;
|
||||
@@ -16,6 +21,7 @@ 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.Static;
|
||||
@@ -28,39 +34,56 @@ 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.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动报名")
|
||||
@At("/platform/family/manage/apply")
|
||||
@At("/platform/family/apply")
|
||||
public class FamilyActivityApplyController {
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock(true);
|
||||
|
||||
@Inject
|
||||
private FamilyActivityService familyActivityService;
|
||||
@Inject
|
||||
private SysDictService dictService;
|
||||
@Inject
|
||||
private FamilyActivityStatisticsService statisticsService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
@At("/")
|
||||
@SaCheckPermission("family.apply")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/apply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/h5")
|
||||
@SaCheckPermission("h5.family.apply")
|
||||
@Ok("beetl:/platform/zhghh5/activity/family/apply/index.html")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At("/list/h5")
|
||||
@SaCheckPermission("h5.family.apply")
|
||||
@Ok("beetl:/platform/zhghh5/activity/family/list/index.html")
|
||||
public void listIndex() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动查询")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
public Result activityData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType) {
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
public Result activityPageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType,
|
||||
@Param(value = "id") String id,
|
||||
@Param(value = "dataType") String dataType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("id", "=", id);
|
||||
cnd.andEX("`year`", "=", year);
|
||||
//查询报名中
|
||||
if (activityType == 2) {
|
||||
@@ -68,12 +91,18 @@ public class FamilyActivityApplyController {
|
||||
}//查询已结束的
|
||||
else if (activityType == 3) {
|
||||
cnd.and(new Static("now() > activityEndTime"));
|
||||
} else if (activityType == 4) {
|
||||
cnd.and(new Static("now() < activitySignUpStartTime"));
|
||||
}
|
||||
|
||||
if (AuthUtil.hasRole("H04") && !AuthUtil.hasRoleOr("sysadmin, A06")) {
|
||||
cnd.and("activityMode", "=", 2).and("createdBy", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
if("mine".equals(dataType)) {
|
||||
cnd.and(new Static("id in (select activityId from family_user where userId = '%s')".formatted(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));
|
||||
@@ -83,33 +112,17 @@ public class FamilyActivityApplyController {
|
||||
|
||||
@At
|
||||
@ApiOperation("分活动查询")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "courseTypeId") String courseTypeId,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "assortTypes") String[] assortTypes) {
|
||||
@Param(value = "assortTypes") String[] assortTypes,
|
||||
@Param(value = "dataType") String dataType) {
|
||||
FamilyActivity activity = dao.fetch(FamilyActivity.class, 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,
|
||||
tsuc.waitingNum,
|
||||
tsuc.assort,
|
||||
type.typeName,
|
||||
tsuc.courseIsLimitApply
|
||||
tsuc.*,
|
||||
type.typeName
|
||||
FROM
|
||||
`family_course` tsuc
|
||||
LEFT JOIN family_type type ON type.id = tsuc.courseType
|
||||
@@ -122,6 +135,10 @@ public class FamilyActivityApplyController {
|
||||
cnd.and("tsuc.assort", "in", assortTypes);
|
||||
}
|
||||
|
||||
if("mine".equals(dataType)) {
|
||||
cnd.and(new Static("tsuc.id in (select courseId from family_user where userId = '%s')".formatted(SecurityUtil.getUserId())));
|
||||
}
|
||||
|
||||
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());
|
||||
@@ -134,6 +151,9 @@ public class FamilyActivityApplyController {
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
|
||||
courseList.forEach(c -> {
|
||||
List<FamilyActivityCourse> courseTimes = dao.query(FamilyActivityCourse.class, Cnd.where("courseId", "=", c.getString("id")).asc("courseDate"));
|
||||
c.put("courseTimes", courseTimes);
|
||||
|
||||
c.put("hasRegisterNum", statisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
|
||||
c.put("hasWaitingNum", statisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
|
||||
//当前用户是否报过
|
||||
@@ -148,13 +168,28 @@ public class FamilyActivityApplyController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<FamilyUser> userList = dao.query(FamilyUser.class, Cnd.where("courseId", "=", c.getString("id")).and("userId", "=", SecurityUtil.getUserId()));
|
||||
List<String> values = new ArrayList<>();
|
||||
if(Lang.isNotEmpty(userList)) {
|
||||
for (FamilyUser familyUser : userList) {
|
||||
List<List<NutMap>> mobileColumnsValue = familyUser.getMobileColumnsValue();
|
||||
for (List<NutMap> listMap : mobileColumnsValue) {
|
||||
NutMap nutMap = listMap.stream().filter(o -> Objects.equals(o.getString("columnCode"), activity.getOnlyKey())).findFirst().orElse(null);
|
||||
if(nutMap != null) {
|
||||
values.add(nutMap.getString("columnValue"));
|
||||
}
|
||||
}
|
||||
}
|
||||
c.put("signValue", String.join(",", values));
|
||||
}
|
||||
});
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取分活动时间")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
public Result getCourseTime(String id) {
|
||||
List<FamilyActivityCourse> list = familyActivityService.dao().query(FamilyActivityCourse.class, Cnd.where("courseId", "=", id));
|
||||
return Result.success(list);
|
||||
@@ -162,7 +197,7 @@ public class FamilyActivityApplyController {
|
||||
|
||||
@At
|
||||
@ApiOperation("查询分类标识集合")
|
||||
@SaCheckPermission("family.manage.apply")
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
public Result queryCourseAssort(String activityId) {
|
||||
List<FamilyCourse> courseList = familyActivityService.dao().query(
|
||||
FamilyCourse.class,
|
||||
@@ -175,4 +210,219 @@ public class FamilyActivityApplyController {
|
||||
return Result.success(assortList);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("验证是否能报名")
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
public Result validateSignUp(String courseId,
|
||||
@Param(value = "currentFamilyNumber") Integer currentFamilyNumber) {
|
||||
try {
|
||||
lock.lock();
|
||||
if(StrUtil.isBlank(courseId)) {
|
||||
return Result.error(99, "报名信息为空");
|
||||
}
|
||||
|
||||
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(99,"报名未开始");
|
||||
}
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpEndTime(), "yyyy-MM-dd HH:mm:ss") > 0) {
|
||||
return Result.error(99,"报名已结束");
|
||||
}
|
||||
|
||||
//判断活动组别
|
||||
int count = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", activity.getActivityGroupId()).and("userId", "=", SecurityUtil.getUserId()));
|
||||
if(count == 0) {
|
||||
return Result.error(99,"抱歉,您没有此次活动的权限");
|
||||
}
|
||||
|
||||
//判断是否报名
|
||||
boolean courseByUser = familyActivityService.isSignCourseByUser(courseId, SecurityUtil.getUserId());
|
||||
if(courseByUser) {
|
||||
return Result.error(99,"抱歉,您已经报名");
|
||||
}
|
||||
|
||||
//判断活动人数
|
||||
boolean signFull = familyActivityService.isSignFull(course, currentFamilyNumber);
|
||||
if(signFull) {
|
||||
return Result.error(99,"啊哦,目前报名人数已达上限。您可保持关注,如有老师取消之前的报名从而释放出名额,您可再来试试。谢谢!");
|
||||
}
|
||||
|
||||
//判断活动限制
|
||||
boolean signCourse = familyActivityService.isSignCourse(course, activity);
|
||||
if(!signCourse) {
|
||||
if(activity.getRestrictLimit() != 3) {
|
||||
return Result.error(99,"您选择的类型已达上限,不能再报该类型的了");
|
||||
} else {
|
||||
return Result.error(99,activity.getActivityName() + "限制报" + activity.getLimitNum() + "个活动,已达上限");
|
||||
}
|
||||
}
|
||||
|
||||
//判断分工会人数限制
|
||||
boolean signFullByUnionId = familyActivityService.isSignFullByUnionId(course, currentFamilyNumber);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error(99,"您所在的分工会名额不足");
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(99,"报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询子活动时间段")
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
public Object getCourseTimeSelectList(String courseId) {
|
||||
// 查课程的时间段
|
||||
List<FamilyActivityCourse> courseList = dao.query(FamilyActivityCourse.class, Cnd.where("courseId", "=", courseId).asc("courseStartTime"));
|
||||
|
||||
// 查课程的报名人数
|
||||
List<FamilyUserCourse> applyUserList = dao.query(FamilyUserCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
|
||||
List<FamilyUser> userList = dao.query(FamilyUser.class, Cnd.where("courseId", "=", courseId).and("state", "=", 1));
|
||||
List<String> idList = userList.stream().map(FamilyUser::getUserId).toList();
|
||||
|
||||
applyUserList = applyUserList.stream().filter(o -> idList.contains(o.getUserId())).toList();
|
||||
|
||||
// 按照课程下面时间段去分组
|
||||
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() != null ? v.getCourseLimitNum() : 0;
|
||||
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);
|
||||
nutMap.put("disabled", remainingNum == 0);
|
||||
return nutMap;
|
||||
}).filter(v -> v.getInt("remainingNum") != 0).toList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("验证子活动是否能报名")
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
public Object validateSourceSignUp(String activityCourseId, String courseId) {
|
||||
try {
|
||||
lock.lock();
|
||||
|
||||
List<FamilyUser> userList = dao.query(FamilyUser.class, Cnd.where("courseId", "=", courseId).and("state", "=", 1));
|
||||
List<String> isList = userList.stream().map(FamilyUser::getUserId).toList();
|
||||
|
||||
// 该时间段下已报名的人数
|
||||
int count = dao.count(FamilyUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId)
|
||||
.and("courseId", "=", courseId).and("userId", "in", isList));
|
||||
// 获取改时间段下的活动课程限制报名人数
|
||||
FamilyActivityCourse course = dao.fetch(FamilyActivityCourse.class, activityCourseId);
|
||||
Integer courseLimitNum = course.getCourseLimitNum();
|
||||
// 报名加上自己,如果大于了限制人数,那就无法报名
|
||||
if (count + 1 > courseLimitNum) {
|
||||
return Result.error(99,"该时间段名额已报满,请选择其他时段报名");
|
||||
} else {
|
||||
return Result.success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(99,"报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报名")
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
@SLog(tag = "亲子活动-活动报名", msg = "活动报名")
|
||||
public Result doSignUp(FamilyUser familyUser) {
|
||||
try {
|
||||
lock.lock();
|
||||
boolean courseByUser = familyActivityService.isSignCourseByUser(familyUser.getCourseId(), SecurityUtil.getUserId());
|
||||
if(courseByUser) {
|
||||
return Result.error(99,"您已报过该活动");
|
||||
}
|
||||
FamilyActivity activity = familyActivityService.fetch(familyUser.getActivityId());
|
||||
boolean validFamilyCount = familyActivityService.validFamilyCount(familyUser);
|
||||
if(validFamilyCount) {
|
||||
return Result.error(99,activity.getKeyWord() + "人数最多为" + activity.getFamilyMaxCount());
|
||||
}
|
||||
//判断人数
|
||||
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(99,"当前报名人数已满");
|
||||
}
|
||||
boolean signFullByUnionId = familyActivityService.isSignFullByUnionId(course, number);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error(99,"该活动您所在的分工会名额不足");
|
||||
}
|
||||
familyActivityService.doSignUp(familyUser);
|
||||
return Result.success("祝贺您!您已报名成功!请留意各分场活动的准确时间、地点,提前10-15分钟到达活动现场做好准备。如您因故不能参加活动,还请及时登录系统取消报名,以便将机会留给其他有需要的教职工。谢谢!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("取消报名")
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
@SLog(tag = "亲子活动-活动报名", msg = "取消报名")
|
||||
public Result cancelSignUp(@Param("activityId") String activityId, @Param("courseId") String courseId) {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
//取消分两种情况
|
||||
//第一种没有设置分工会人数限制,那么将候补的人按时间倒叙往上补
|
||||
//第二种如果设置了分工会人数限制,那么只将本分工会的候补人员按照时间倒叙往上补,如果本分工会没有候补人员,则名额空出来,由校工会手动调整
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ public class FamilyActivityController {
|
||||
|
||||
@At
|
||||
@ApiOperation("查询单个活动")
|
||||
@SaCheckPermission("family.manage")
|
||||
@SaCheckPermission("family")
|
||||
public Result findOne(@Param("id") @NotNull String id) {
|
||||
NutMap dataMap = familyActivityManageService.findOne(id, null, "");
|
||||
String activityStartTime = dataMap.getString("activityStartTime");
|
||||
|
||||
+8
-8
@@ -36,7 +36,7 @@ import java.util.List;
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "亲子活动人员调整")
|
||||
@At("/platform/family/manage/userAdjust")
|
||||
@At("/platform/family/userAdjust")
|
||||
public class FamilyAdjustController {
|
||||
|
||||
@Inject
|
||||
@@ -49,7 +49,7 @@ public class FamilyAdjustController {
|
||||
private FamilyActivityStatisticsService familyActivityStatisticsService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@SaCheckPermission("family.adjust")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/userAdjust/index.html")
|
||||
public void index() {
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class FamilyAdjustController {
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("活动列表")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@SaCheckPermission("family.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);
|
||||
@@ -69,7 +69,7 @@ public class FamilyAdjustController {
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@SaCheckPermission("family.adjust")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Pagination pagination = familyActivityStatisticsService.pageData(pageForm, activityId);
|
||||
@@ -78,7 +78,7 @@ public class FamilyAdjustController {
|
||||
|
||||
@At
|
||||
@ApiOperation("子活动查询")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@SaCheckPermission("family.adjust")
|
||||
public Result getCourse(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -108,7 +108,7 @@ public class FamilyAdjustController {
|
||||
|
||||
@At
|
||||
@ApiOperation("报名用户列表")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@SaCheckPermission("family.adjust")
|
||||
public Result registerUserList(@Param("courseId") String courseId,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@@ -120,7 +120,7 @@ public class FamilyAdjustController {
|
||||
|
||||
@At
|
||||
@ApiOperation("人员调整")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@SaCheckPermission("family.adjust")
|
||||
@SLog(tag = "亲子活动-人员调整", msg = "人员调整")
|
||||
public Result adjust(String activityId, String oldCourseId, String newCourseId, String userId) {
|
||||
|
||||
@@ -159,7 +159,7 @@ public class FamilyAdjustController {
|
||||
|
||||
@At
|
||||
@ApiOperation("删除报名人员")
|
||||
@SaCheckPermission("family.manage.activity.adjust")
|
||||
@SaCheckPermission("family.adjust")
|
||||
@SLog(tag = "亲子活动-人员调整", msg = "删除报名人员")
|
||||
public Result deleteSignUser(String activityId, String courseId, String userId) {
|
||||
|
||||
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package com.budwk.app.zhgh.activity.family.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.family.models.FamilyUserCourse;
|
||||
import com.budwk.app.zhgh.activity.family.service.FamilyActivityService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUserCourse;
|
||||
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.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.ioc.aop.Aop;
|
||||
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 java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName FamilyMineController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/9/13 16:56
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动报名")
|
||||
@At("/platform/family/mine")
|
||||
public class FamilyMineController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FamilyActivityService activityService;
|
||||
|
||||
@At("/")
|
||||
@SaCheckPermission("family.mine")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/mine/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/h5")
|
||||
@SaCheckPermission("h5.family.mine")
|
||||
@Ok("beetl:/platform/zhghh5/activity/family/mine/index.html")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("主动扫码签到")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"family.mine", "h5.family.mine"}, mode = SaMode.OR)
|
||||
@SLog(tag = "品牌活动-活动签到", msg = "主动扫码签到")
|
||||
public Result drivingScan(String courseId) {
|
||||
|
||||
// 主动扫码签到是用户自己打开扫一扫,扫二维码签到
|
||||
int count = dao.count(FamilyUserCourse.class, Cnd.where("courseId", "=", courseId).and("userId", "=", SecurityUtil.getUserId()));
|
||||
if (count == 0) {
|
||||
return Result.error(99, "未查询到您的报名记录");
|
||||
}
|
||||
|
||||
// 获取现在的日期,并往后推1个小时
|
||||
String oneHourLater = DateUtil.offsetHour(new Date(), 1).toString("yyyy-MM-dd HH:mm:ss");
|
||||
FamilyUserCourse userCourse = dao.fetch(
|
||||
FamilyUserCourse.class,
|
||||
Cnd.where("courseId", "=", courseId)
|
||||
.and("userId", "=", SecurityUtil.getUserId())
|
||||
.and("courseStartTime", "<=", oneHourLater)
|
||||
.and("courseEndTime", ">=", oneHourLater)
|
||||
);
|
||||
if (userCourse == null) {
|
||||
return Result.error(99, "未到签到时间");
|
||||
}
|
||||
|
||||
userCourse.setAttend(true);
|
||||
userCourse.setAttendTime(DateUtil.date());
|
||||
dao.update(userCourse);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("被动扫码签到")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"family.mine", "h5.family.mine"}, mode = SaMode.OR)
|
||||
@SLog(tag = "品牌活动-活动签到", msg = "被动扫码签到")
|
||||
public Result passiveScan(String id) {
|
||||
|
||||
// id表示课程的某个时间段,userId表示是谁出示的二维码
|
||||
FamilyUserCourse userCourse = dao.fetch(FamilyUserCourse.class, id);
|
||||
if (userCourse == null) {
|
||||
return Result.error("未查询到报名记录");
|
||||
}
|
||||
int isAfter = DateUtil.compare(new Date(), userCourse.getCourseStartTime());
|
||||
if (isAfter > 0) {
|
||||
return Result.error("抱歉,已经开始,无法签到");
|
||||
}
|
||||
long diffMillis = Math.abs(DateUtil.between(new Date(), userCourse.getCourseStartTime(), DateUnit.MS));
|
||||
long oneHourInMs = 3600 * 1000;
|
||||
if (diffMillis > oneHourInMs) {
|
||||
return Result.error("签到时间为开始前1个小时");
|
||||
}
|
||||
|
||||
userCourse.setAttend(true);
|
||||
userCourse.setAttendTime(DateUtil.date());
|
||||
dao.update(userCourse);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分活动查询")
|
||||
@SaCheckPermission(value = {"family.mine", "h5.family.mine"}, mode = SaMode.OR)
|
||||
public Result queryCourseSign(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.*,
|
||||
date(uc.courseStartTime) as courseDate
|
||||
FROM
|
||||
`family_user_course` uc
|
||||
WHERE
|
||||
courseId = @courseId and userId = @userId
|
||||
""");
|
||||
sql.setParam("userId", SecurityUtil.getUserId());
|
||||
sql.setParam("courseId", courseId);
|
||||
List<NutMap> listMap = activityService.listMap(sql);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取我报名的课程")
|
||||
@SaCheckPermission(value = {"family.apply", "h5.family.apply"}, mode = SaMode.OR)
|
||||
public Result queryMineCourse(String activityId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
u.mobileColumnsValue
|
||||
FROM
|
||||
family_user u
|
||||
LEFT JOIN family_course c ON c.id = u.courseId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.activityId", "=", activityId);
|
||||
cnd.and("u.userId", "=", SecurityUtil.getUserId());
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = activityService.listMap(sql);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -42,7 +42,7 @@ import java.util.List;
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动类型管理")
|
||||
@At("/platform/family/manage/type")
|
||||
@At("/platform/family/type")
|
||||
public class FamilyTypeController {
|
||||
|
||||
@Inject
|
||||
@@ -51,14 +51,14 @@ public class FamilyTypeController {
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SaCheckPermission("family.type")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/type/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SaCheckPermission("family.type")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "typeName") String typeName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
@@ -89,7 +89,7 @@ public class FamilyTypeController {
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型新增")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SaCheckPermission("family.type")
|
||||
@SLog(tag = "亲子活动-活动类型管理", msg = "活动类型新增")
|
||||
public Result doAdd(@Param("data") String data) throws Exception {
|
||||
FamilyType type = Json.fromJson(FamilyType.class, data);
|
||||
@@ -105,7 +105,7 @@ public class FamilyTypeController {
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型修改")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SaCheckPermission("family.type")
|
||||
@SLog(tag = "亲子活动-活动类型管理", msg = "活动类型修改")
|
||||
public Result doEdit(FamilyType type) {
|
||||
int count = dao.count(FamilyType.class, Cnd.where("code", "=", type.getCode()).and("id", "!=", type.getId()));
|
||||
@@ -120,7 +120,7 @@ public class FamilyTypeController {
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型删除")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SaCheckPermission("family.type")
|
||||
@SLog(tag = "亲子活动-活动类型管理", msg = "活动类型删除")
|
||||
public Object doDelete(@Param(value = "id") String id) {
|
||||
dao.clear(FamilyType.class, Cnd.where("id", "=", id));
|
||||
@@ -131,7 +131,7 @@ public class FamilyTypeController {
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("排序号变更")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SaCheckPermission("family.type")
|
||||
public Object xhChange(String id, Integer xh, boolean toDown) {
|
||||
if (toDown) {
|
||||
FamilyType next = dao.fetch(FamilyType.class, Cnd.where("xh", "=", xh + 1));
|
||||
@@ -158,7 +158,7 @@ public class FamilyTypeController {
|
||||
|
||||
@At
|
||||
@ApiOperation("自定义表单字段类型")
|
||||
@SaCheckPermission("family.manage.type")
|
||||
@SaCheckPermission("family.type")
|
||||
public Result getColumnType() {
|
||||
List<String> names = EnumUtil.getNames(ColType.class);
|
||||
names.add("JSON");
|
||||
|
||||
+7
-7
@@ -56,14 +56,14 @@ public class FamilyUserManageController {
|
||||
private FamilyBlackListService familyBlackListService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@SaCheckPermission("family.userManage")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/userManage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@SaCheckPermission("family.userManage")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "courseId") String courseId,
|
||||
@@ -87,7 +87,7 @@ public class FamilyUserManageController {
|
||||
|
||||
@At
|
||||
@ApiOperation("报名人员处理")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@SaCheckPermission("family.userManage")
|
||||
@SLog(tag = "亲子活动-人员调整", msg = "报名人员处理")
|
||||
public Result doHandleUser(@Param("userId") String userId) {
|
||||
familyBlackListService.doHandleUser(userId);
|
||||
@@ -96,7 +96,7 @@ public class FamilyUserManageController {
|
||||
|
||||
@At
|
||||
@ApiOperation("根据活动Id获取子活动")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@SaCheckPermission("family.userManage")
|
||||
public Result getCourseByActivityId(@Param("activityId") String activityId) {
|
||||
List<FamilyCourse> list = dao.query(FamilyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
return Result.success(list);
|
||||
@@ -104,7 +104,7 @@ public class FamilyUserManageController {
|
||||
|
||||
@At
|
||||
@ApiOperation("获取子活动具体时间")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@SaCheckPermission("family.userManage")
|
||||
public Result attendClassRecord(String userId) {
|
||||
familyBlackListService.attendClassRecord(userId);
|
||||
return Result.success();
|
||||
@@ -112,7 +112,7 @@ public class FamilyUserManageController {
|
||||
|
||||
@At
|
||||
@ApiOperation("获取候补人员")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@SaCheckPermission("family.userManage")
|
||||
public Result getReserveUser(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -133,7 +133,7 @@ public class FamilyUserManageController {
|
||||
|
||||
@At
|
||||
@ApiOperation("补充人员")
|
||||
@SaCheckPermission("family.user.activity")
|
||||
@SaCheckPermission("family.userManage")
|
||||
@SLog(tag = "亲子活动-人员管理", msg = "补充人员")
|
||||
public Result reserveSingUp(String[] ids, String courseId) {
|
||||
//先查询这个课程有多少个未签到的人员
|
||||
|
||||
-369
@@ -1,369 +0,0 @@
|
||||
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() != null ? v.getCourseLimitNum() : 0;
|
||||
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(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(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(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, String courseId) {
|
||||
try {
|
||||
lock.lock();
|
||||
// 该时间段下已报名的人数
|
||||
int count = dao.count(FamilyUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId)
|
||||
.and("courseId", "=", courseId));
|
||||
// 获取改时间段下的活动课程限制报名人数
|
||||
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(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
@@ -1,201 +0,0 @@
|
||||
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);
|
||||
}*/
|
||||
|
||||
}
|
||||
+9
-9
@@ -62,7 +62,7 @@ import java.util.stream.Collectors;
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "亲子活动统计")
|
||||
@At("/platform/family/statistics/activity")
|
||||
@At("/platform/family/statistics")
|
||||
public class FamilyActivityStatisticsController {
|
||||
|
||||
@Inject
|
||||
@@ -73,14 +73,14 @@ public class FamilyActivityStatisticsController {
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
@SaCheckPermission("family.statistics")
|
||||
@Ok("beetl:/platform/zhgh/activity/family/statistics/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
@SaCheckPermission("family.statistics")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Pagination pagination = familyActivityStatisticsService.pageData(pageForm, activityId);
|
||||
@@ -95,7 +95,7 @@ public class FamilyActivityStatisticsController {
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("活动列表")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
@SaCheckPermission("family.statistics")
|
||||
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);
|
||||
@@ -109,14 +109,14 @@ public class FamilyActivityStatisticsController {
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("报名人员列表")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
@SaCheckPermission("family.statistics")
|
||||
public Result registerUserList(@Param(value = "courseId") String courseId) {
|
||||
return Result.success(familyActivityStatisticsService.registerUserList(courseId));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("报名动态列")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
@SaCheckPermission("family.statistics")
|
||||
public Object getTaleColumnInfo(@Param(value = "courseId") String courseId) {
|
||||
return Result.success(familyActivityStatisticsService.getTaleColumnInfo(courseId));
|
||||
}
|
||||
@@ -129,14 +129,14 @@ public class FamilyActivityStatisticsController {
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("获取签到信息")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
@SaCheckPermission("family.statistics")
|
||||
public Result getSignInfo(@Param("courseId") String courseId) {
|
||||
return Result.success(familyActivityStatisticsService.getSignInfo(courseId));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("开放报名")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
@SaCheckPermission("family.statistics")
|
||||
public Result signChange(@Param("courseId") String courseId, @Param("openOtherUnion") Boolean openOtherUnion) {
|
||||
dao.update(FamilyCourse.class, Chain.make("openOtherUnion", openOtherUnion)
|
||||
, Cnd.where("id", "=", courseId));
|
||||
@@ -146,7 +146,7 @@ public class FamilyActivityStatisticsController {
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出签到名单")
|
||||
@SaCheckPermission("family.statistics.activity")
|
||||
@SaCheckPermission("family.statistics")
|
||||
public void exportSignUser(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
|
||||
@@ -24,113 +24,129 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FamilyActivity extends BaseModel implements Serializable, SysHomeConvert {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("活动名称")
|
||||
private String activityName;
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("活动名称")
|
||||
private String activityName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("年度")
|
||||
private Integer year;
|
||||
@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 activitySignUpStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动报名开始时间")
|
||||
private Date activitySignUpEndTime;
|
||||
@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 activityStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动结束时间")
|
||||
private Date activityEndTime;
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动结束时间")
|
||||
private Date activityEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否禁用")
|
||||
@Default("0")
|
||||
private boolean isDisabled;
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否禁用")
|
||||
@Default("0")
|
||||
private boolean isDisabled;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "longtext")
|
||||
@Comment("活动介绍")
|
||||
private String introduce;
|
||||
@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 restrictLimit;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
@Comment("活动限制报名个数")
|
||||
private Integer limitNum;
|
||||
@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 cover;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("微信群二维码")
|
||||
private String wechat;
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("微信群二维码")
|
||||
private String wechat;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("上课前是否通知")
|
||||
@Default("0")
|
||||
private boolean notice;
|
||||
@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("活动范围Id")
|
||||
@ColDefine(type = ColType.INT, width = 32)
|
||||
private Integer activityGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("活动范围名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 40)
|
||||
private String activityGroupName;
|
||||
@Column
|
||||
@Comment("活动范围名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 40)
|
||||
private String activityGroupName;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<FamilyCourse> courseList;
|
||||
@Many(field = "activityId")
|
||||
private List<FamilyCourse> courseList;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<FamilyTypeLimit> typeLimits;
|
||||
@Many(field = "activityId")
|
||||
private List<FamilyTypeLimit> typeLimits;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String trainType;
|
||||
@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;
|
||||
}
|
||||
@Column
|
||||
@Comment("关键词")
|
||||
@Default("家属")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String keyWord;
|
||||
|
||||
@Column
|
||||
@Comment("家属最多数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer familyMaxCount;
|
||||
|
||||
@Column
|
||||
@Comment("判断家属数量的唯一标识")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String onlyKey;
|
||||
|
||||
@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/apply");
|
||||
sysHomeActivity.setH5Url("/platform/family/apply/h5?id=" + this.getId());
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,11 @@ public class FamilyCourse extends BaseModel implements Serializable {
|
||||
@Comment("序号")
|
||||
private int orderNum;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "longtext")
|
||||
@Comment("详细信息")
|
||||
private String introduce;
|
||||
|
||||
@Many(field = "courseId")
|
||||
private List<FamilyActivityCourse> courseTimeList;
|
||||
|
||||
@@ -89,6 +94,7 @@ public class FamilyCourse extends BaseModel implements Serializable {
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("移动端是否签到")
|
||||
@Default("0")
|
||||
private boolean isMobileSign;
|
||||
|
||||
@Column
|
||||
@@ -99,6 +105,7 @@ public class FamilyCourse extends BaseModel implements Serializable {
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("移动端是否签收礼品")
|
||||
@Default("0")
|
||||
private boolean isReceiveGift;
|
||||
|
||||
@Column
|
||||
@@ -137,6 +144,33 @@ public class FamilyCourse extends BaseModel implements Serializable {
|
||||
@Comment("候补名额数")
|
||||
private Integer waitingNum;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否限制年龄")
|
||||
@Default("0")
|
||||
private boolean familyAgeLimit;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("最小年龄")
|
||||
private Integer minAge;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("最大年龄")
|
||||
private Integer maxAge;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否限制性别")
|
||||
@Default("0")
|
||||
private boolean familySexLimit;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("限制性别")
|
||||
private String familySex;
|
||||
|
||||
private Integer hasWaitingNum;
|
||||
private String courseTimeName;
|
||||
private Integer hasRegisterNum;
|
||||
|
||||
@@ -84,4 +84,9 @@ public class FamilyMobileSignColumn implements Serializable {
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer columnIndex;
|
||||
|
||||
@Column
|
||||
@Comment("验证规则")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String validRule;
|
||||
|
||||
}
|
||||
|
||||
+84
-82
@@ -16,101 +16,103 @@ import java.util.List;
|
||||
*/
|
||||
public interface FamilyActivityService extends BaseService<FamilyActivity> {
|
||||
|
||||
/**
|
||||
* 添加活动
|
||||
* @param activity 活动信息
|
||||
* @param course 培训班信息
|
||||
*/
|
||||
void add(FamilyActivity activity, FamilyCourse course);
|
||||
/**
|
||||
* 添加活动
|
||||
* @param activity 活动信息
|
||||
* @param course 培训班信息
|
||||
*/
|
||||
void add(FamilyActivity activity, FamilyCourse course);
|
||||
|
||||
/**
|
||||
* 编辑活动
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void edit(FamilyActivity activity);
|
||||
/**
|
||||
* 编辑活动
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void edit(FamilyActivity activity);
|
||||
|
||||
/**
|
||||
* 更新活动状态
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void updateActivityStatus(FamilyActivity activity);
|
||||
/**
|
||||
* 更新活动状态
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void updateActivityStatus(FamilyActivity activity);
|
||||
|
||||
/**
|
||||
* 查询单条活动信息
|
||||
* @param id 活动ID
|
||||
* @return 返回的数据与前端符合
|
||||
*/
|
||||
NutMap findOne(String id, Cnd cnd, String fromMode);
|
||||
/**
|
||||
* 查询单条活动信息
|
||||
* @param id 活动ID
|
||||
* @return 返回的数据与前端符合
|
||||
*/
|
||||
NutMap findOne(String id, Cnd cnd, String fromMode);
|
||||
|
||||
/**
|
||||
* pc分页查询
|
||||
* @param pageForm
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd);
|
||||
/**
|
||||
* 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 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 familyUser 活动ID
|
||||
*/
|
||||
void doSignUp(FamilyUser familyUser) throws Exception;
|
||||
|
||||
/**
|
||||
* 异步插入每个报名成功人员的课程数据
|
||||
* @param activityId
|
||||
* @param courseId
|
||||
* @param userId
|
||||
*/
|
||||
void asyncInsertUserCourse(String activityId, String courseId, String userId);
|
||||
/**
|
||||
* 异步插入每个报名成功人员的课程数据
|
||||
* @param activityId
|
||||
* @param courseId
|
||||
* @param userId
|
||||
*/
|
||||
void asyncInsertUserCourse(String activityId, String courseId, String userId);
|
||||
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
* @return
|
||||
*/
|
||||
boolean isSignFullByUnionId(FamilyCourse course, Integer currentFamilyNumber);
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
* @return
|
||||
*/
|
||||
boolean isSignFullByUnionId(FamilyCourse course, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 该培训班是否报满
|
||||
*/
|
||||
boolean isSignFull(FamilyCourse course, Integer currentFamilyNumber);
|
||||
/**
|
||||
* 该培训班是否报满
|
||||
*/
|
||||
boolean isSignFull(FamilyCourse course, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 还能报该类型的培训班吗 比如书画班最多报一项 健身班两项
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourse(FamilyCourse course, FamilyActivity activity);
|
||||
boolean validFamilyCount(FamilyUser user);
|
||||
|
||||
/**
|
||||
* 当前用户是否已报过该培训班
|
||||
* @param courseId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourseByUser(String courseId, String userId);
|
||||
/**
|
||||
* 还能报该类型的培训班吗 比如书画班最多报一项 健身班两项
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourse(FamilyCourse course, FamilyActivity activity);
|
||||
|
||||
/**
|
||||
* 手机端签到
|
||||
* @param id 每个培训班每节课每个用户的记录ID
|
||||
*/
|
||||
void doQd(String id);
|
||||
/**
|
||||
* 当前用户是否已报过该培训班
|
||||
* @param courseId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourseByUser(String courseId, String userId);
|
||||
|
||||
/**
|
||||
* 某个用户的签到信息
|
||||
* @param userId 用户id
|
||||
* @param activityId 活动id
|
||||
*/
|
||||
List<NutMap> qdInfoByUserId(String userId, String activityId);
|
||||
/**
|
||||
* 手机端签到
|
||||
* @param id 每个培训班每节课每个用户的记录ID
|
||||
*/
|
||||
void doQd(String id);
|
||||
|
||||
List<FamilyCourse> filterCourseByHostUnion(List<FamilyCourse> courseList);
|
||||
/**
|
||||
* 某个用户的签到信息
|
||||
* @param userId 用户id
|
||||
* @param activityId 活动id
|
||||
*/
|
||||
List<NutMap> qdInfoByUserId(String userId, String activityId);
|
||||
|
||||
List<FamilyCourse> filterCourseByHostUnion(List<FamilyCourse> courseList);
|
||||
}
|
||||
|
||||
+21
-5
@@ -1,11 +1,9 @@
|
||||
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.result.Result;
|
||||
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;
|
||||
@@ -27,12 +25,10 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -373,6 +369,26 @@ public class FamilyActivityServiceImpl extends BaseServiceImpl<FamilyActivity> i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validFamilyCount(FamilyUser user) {
|
||||
String activityId = user.getActivityId();
|
||||
// 查询报名记录
|
||||
List<FamilyUser> list = dao().query(FamilyUser.class, Cnd.where(FamilyUser::getActivityId, "=", activityId).and(FamilyUser::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if(Lang.isEmpty(list)) {
|
||||
return false;
|
||||
}
|
||||
FamilyActivity activity = dao().fetch(FamilyActivity.class, activityId);
|
||||
|
||||
List<List<NutMap>> allMobileColumnsValue = new ArrayList<>(list.stream()
|
||||
.map(FamilyUser::getMobileColumnsValue)
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(List::stream)
|
||||
.toList());
|
||||
|
||||
allMobileColumnsValue.addAll(user.getMobileColumnsValue());
|
||||
return allMobileColumnsValue.size() > activity.getFamilyMaxCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignCourse(FamilyCourse course, FamilyActivity activity) {
|
||||
//培训班类型
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ public class TrainSignUpManageController {
|
||||
|
||||
@At
|
||||
@ApiOperation("查询单个活动")
|
||||
@SaCheckPermission("trainSingUp.manage")
|
||||
@SaCheckPermission("trainSingUp")
|
||||
public Result findOne(@Param("id") @NotNull String id) {
|
||||
NutMap dataMap = trainSignUpActivityManageService.findOne(id, null, "");
|
||||
String activityStartTime = dataMap.getString("activityStartTime");
|
||||
|
||||
+22
@@ -140,4 +140,26 @@ public class TrainsignUpMineController {
|
||||
List<NutMap> listMap = activityService.listMap(sql);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取我报名的课程")
|
||||
@SaCheckPermission(value = {"trainSingUp.mine", "h5.trainSingUp.mine"}, mode = SaMode.OR)
|
||||
public Result queryMineCourse(String activityId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
u.mobileColumnsValue
|
||||
FROM
|
||||
train_sign_up_user u
|
||||
LEFT JOIN train_sign_up_course c ON c.id = u.courseId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.activityId", "=", activityId);
|
||||
cnd.and("u.userId", "=", SecurityUtil.getUserId());
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = activityService.listMap(sql);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
}
|
||||
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.dsznfmtx.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.models.Dsznfmtx;
|
||||
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.Dao;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/16 20:51
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/dsznfmtx/apply")
|
||||
@Api("独生子女父母退休奖励申请")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class DsznfmtxApplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/dsznfmtx/apply/index.html")
|
||||
@SaCheckPermission("dsznfmtx.apply")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/dsznfmtx/apply/index.html")
|
||||
@SaCheckPermission("h5.dsznfmtx.apply")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("保存申请")
|
||||
@SaCheckPermission(value = {"dsznfmtx.apply", "h5.dsznfmtx.apply"}, mode = SaMode.OR)
|
||||
@SLog(tag = "生育休假-休假申请", msg = "保存休假申请")
|
||||
public Result save(@Param("data") Dsznfmtx dsznfmtx) {
|
||||
if (StrUtil.isBlank(dsznfmtx.getId())) dsznfmtx.setApplyTime(new Date());
|
||||
dao.insertOrUpdate(dsznfmtx);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("提交申请")
|
||||
@SaCheckPermission(value = {"dsznfmtx.apply", "h5.dsznfmtx.apply"}, mode = SaMode.OR)
|
||||
public Result submit(@Param("data") Dsznfmtx dsznfmtx) {
|
||||
if (StrUtil.isBlank(dsznfmtx.getId())) dsznfmtx.setApplyTime(new Date());
|
||||
|
||||
dao.insertOrUpdate(dsznfmtx);
|
||||
// 开启流程实例
|
||||
Dict args = Dict.create();
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, dsznfmtx);
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("DSZNFMTX", dsznfmtx.getId(), SecurityUtil.getUserId(), args);
|
||||
|
||||
// 自动完成第一个申请任务
|
||||
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
|
||||
for (ProcessTask task : doingTaskList) {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("重新提交申请")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"dsznfmtx.apply", "h5.dsznfmtx.apply"}, mode = SaMode.OR)
|
||||
public Result submitAgain(@Param("data") Dsznfmtx dsznfmtx, @Param("taskId") Long taskId) {
|
||||
if (StrUtil.isBlank(dsznfmtx.getId())) dsznfmtx.setApplyTime(new Date());
|
||||
|
||||
dao.insertOrUpdate(dsznfmtx);
|
||||
|
||||
Dict dict = Dict.create();
|
||||
dict.set(FlowConst.PROCESS_TASK_ID_KEY, taskId);
|
||||
dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.RE_APPLY.getCode());
|
||||
flowCommonService.executeTask(dict);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result findOne(String id) {
|
||||
return Result.success(baseService.dao().fetch(Dsznfmtx.class, id));
|
||||
}
|
||||
}
|
||||
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.dsznfmtx.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.flow.engine.FlowEngine;
|
||||
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.service.DsznfmtxService;
|
||||
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.vo.DsznfmtxCollectExcelVO;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.vo.MaternityLeaveCollectExcelVO;
|
||||
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.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
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.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.util.List;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/16 20:53
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/dsznfmtx/collect")
|
||||
@Api("查询统计")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class DsznfmtxCollectController {
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private DsznfmtxService dsznfmtxService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/dsznfmtx/collect/index.html")
|
||||
@SaCheckPermission("dsznfmtx.collect")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/dsznfmtx/collect/index.html")
|
||||
@SaCheckPermission("h5.dsznfmtx.collect")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"dsznfmtx.collect", "h5.dsznfmtx.collect"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
Integer year,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String userName,
|
||||
String sex) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke,
|
||||
(select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask' AND taskState in (10,20)) AS startTaskId
|
||||
FROM
|
||||
dsznfmtx info
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 年度查询条件
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
|
||||
// 工会、单位名称查询条件
|
||||
cnd.andEX("info.unionId", "=", unionId);
|
||||
cnd.andEX("info.unitId", "=", unitId);
|
||||
|
||||
// 性别查询条件
|
||||
cnd.andEX("info.sex", "=", sex);
|
||||
|
||||
// 姓名查询条件
|
||||
if (StrUtil.isNotBlank(userName)) {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
|
||||
// 只查询流程实例状态为20的数据(已完成状态)
|
||||
cnd.and("ins.state", "=", 20);
|
||||
|
||||
cnd.desc("info.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = dsznfmtxService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
@At
|
||||
@ApiOperation("删除")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"dsznfmtx.mine", "h5.dsznfmtx.mine"}, mode = SaMode.OR)
|
||||
@SLog( tag = "删除工会报销", msg = "删除工会报销")
|
||||
public Result delete(@Param("id") String id) {
|
||||
dsznfmtxService.delete(id);
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission(value = {"dsznfmtx.collect", "h5.dsznfmtx.collect"}, mode = SaMode.OR)
|
||||
@ApiOperation("导出独生子女父母退休领取奖励表")
|
||||
public void onExport(@Param(value = "year") Integer year,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "userName") String userName,
|
||||
@Param(value = "sex") String sex,
|
||||
HttpServletResponse response) {
|
||||
//查询审核通过的数据
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.state instanceState
|
||||
FROM
|
||||
dsznfmtx info
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(userName)) {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
cnd.andEX("info.unionId", "=", unionId);
|
||||
cnd.andEX("info.unitId", "=", unitId);
|
||||
cnd.andEX("info.sex", "=", sex);
|
||||
cnd.and("ins.state", "=", 20);
|
||||
|
||||
cnd.desc("info.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
List<DsznfmtxCollectExcelVO> list = dsznfmtxService.listVO(sql, DsznfmtxCollectExcelVO.class);
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DsznfmtxCollectExcelVO.class, list);
|
||||
CommonDownloadUtil.download("独生子女父母退休领取奖励表.xlsx", workbook, response);
|
||||
}
|
||||
}
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.dsznfmtx.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.flow.engine.FlowEngine;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.service.DsznfmtxService;
|
||||
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.Sqls;
|
||||
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.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/16 20:52
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/dsznfmtx/mine")
|
||||
@Api("我的申请")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class DsznfmtxMineController {
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private DsznfmtxService dsznfmtxService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/dsznfmtx/mine/index.html")
|
||||
@SaCheckPermission("dsznfmtx.mine")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/dsznfmtx/mine/index.html")
|
||||
@SaCheckPermission("h5.dsznfmtx.mine")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"dsznfmtx.mine", "h5.dsznfmtx.mine"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm, @Param(value = "year") Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke,
|
||||
(select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask') AS startTaskId
|
||||
FROM
|
||||
dsznfmtx info
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 年度查询条件
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
cnd.desc("info.applyTime");
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = dsznfmtxService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"dsznfmtx.mine", "h5.dsznfmtx.mine"}, mode = SaMode.OR)
|
||||
@SLog( tag = "删除工会报销", msg = "删除工会报销")
|
||||
public Result delete(@Param("id") String id) {
|
||||
dsznfmtxService.delete(id);
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.dsznfmtx.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.service.DsznfmtxService;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/16 20:52
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/dsznfmtx/schoolAudit")
|
||||
@Api("校工会审核")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class DsznfmtxSchoolAuditController {
|
||||
|
||||
@Inject
|
||||
private DsznfmtxService dsznfmtxService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/dsznfmtx/schoolAudit/index.html")
|
||||
@SaCheckPermission("dsznfmtx.schoolAudit")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/dsznfmtx/schoolAudit/index.html")
|
||||
@SaCheckPermission("h5.dsznfmtx.schoolAudit")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"dsznfmtx.unionAudit", "h5.dsznfmtx.unionAudit"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
boolean approval,
|
||||
Integer year,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String userName,
|
||||
String sex) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN dsznfmtx info ON info.id = ins.businessNo
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "47a91fa5-4ade-4c15-9a2c-2706465d3c8d");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
// 年度查询条件
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
|
||||
// 工会、单位名称查询条件
|
||||
cnd.andEX("info.unionId", "=", unionId);
|
||||
cnd.andEX("info.unitId", "=", unitId);
|
||||
|
||||
// 性别查询条件
|
||||
cnd.andEX("info.sex", "=", sex);
|
||||
|
||||
// 姓名查询条件
|
||||
if (StrUtil.isNotBlank(userName)) {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = dsznfmtxService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.dsznfmtx.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.service.DsznfmtxService;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/16 20:52
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/dsznfmtx/unionAudit")
|
||||
@Api("分工会审核")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class DsznfmtxUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private DsznfmtxService dsznfmtxService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/dsznfmtx/unionAudit/index.html")
|
||||
@SaCheckPermission("dsznfmtx.unionAudit")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/dsznfmtx/unionAudit/index.html")
|
||||
@SaCheckPermission("h5.dsznfmtx.unionAudit")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"dsznfmtx.unionAudit", "h5.dsznfmtx.unionAudit"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
boolean approval,
|
||||
Integer year,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String userName,
|
||||
String sex) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN dsznfmtx info ON info.id = ins.businessNo
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "0558e187-d3e5-4c1f-b0e0-1502eb7ac136");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
// 年度查询条件
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
|
||||
// 工会、单位名称查询条件
|
||||
cnd.andEX("info.unionId", "=", unionId);
|
||||
cnd.andEX("info.unitId", "=", unitId);
|
||||
|
||||
// 性别查询条件
|
||||
cnd.andEX("info.sex", "=", sex);
|
||||
|
||||
// 姓名查询条件
|
||||
if (StrUtil.isNotBlank(userName)) {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = dsznfmtxService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.dsznfmtx.models;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
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 java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/16 20:32
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("dsznfmtx")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("独生子女父母退休")
|
||||
public class Dsznfmtx extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("userId")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("姓名")
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("性别")
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("出生年月")
|
||||
private Date birthday;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("工号")
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在工会Id")
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在工会")
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在单位Id")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在单位")
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("退休时间")
|
||||
private Date retireTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("爱人姓名")
|
||||
private String loverName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("性别")
|
||||
private String loverSex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("工作单位")
|
||||
private String loverUnitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("结婚日期")
|
||||
private Date marryTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("子女出生日期")
|
||||
private Date childrenBirthday;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("领独生子女证时间")
|
||||
private Date getCertificateTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("奖励金额")
|
||||
private String bonus;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME,width = 50)
|
||||
@Comment("申请时间")
|
||||
private Date applyTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("独生子女父母光荣证")
|
||||
private List<JSONObject> honorFiles;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("退休证")
|
||||
private List<JSONObject> retireFiles;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 500)
|
||||
@Comment("签字")
|
||||
private String sign;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("独生子女光荣证号")
|
||||
private String childrenGraceNumber;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("办证机关")
|
||||
private String office;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.dsznfmtx.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.models.Dsznfmtx;
|
||||
|
||||
|
||||
public interface DsznfmtxService extends BaseService<Dsznfmtx> {
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.dsznfmtx.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.models.Dsznfmtx;
|
||||
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.service.DsznfmtxService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/17 8:48
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class DsznfmtxServiceImpl extends BaseServiceImpl<Dsznfmtx> implements DsznfmtxService {
|
||||
public DsznfmtxServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.dsznfmtx.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/17 16:03
|
||||
*/
|
||||
|
||||
//独生子女父母退休导出
|
||||
@Data
|
||||
public class DsznfmtxCollectExcelVO {
|
||||
|
||||
@Excel(name = "办理时间", width = 20, format = "yyyy-MM-dd")
|
||||
private Date applyTime;
|
||||
|
||||
@Excel(name = "职工姓名", width = 20)
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "性别", width = 20)
|
||||
private String sex;
|
||||
|
||||
@Excel(name = "出生年月", width = 20, format = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
|
||||
@Excel(name = "原工作单位", width = 20)
|
||||
private String unitName;
|
||||
|
||||
@Excel(name = "退休时间", width = 20, format = "yyyy-MM-dd")
|
||||
private Date retireTime;
|
||||
|
||||
@Excel(name = "子女出生年月", width = 20, format = "yyyy-MM-dd")
|
||||
private Date childrenBirthday;
|
||||
|
||||
@Excel(name = "领取独生子女证时间", width = 20, format = "yyyy-MM-dd")
|
||||
private Date getCertificateTime;
|
||||
|
||||
@Excel(name = "独生子女光荣证号", width = 20)
|
||||
private String childrenGraceNumber;
|
||||
|
||||
@Excel(name = "办证机关", width = 20)
|
||||
private String office;
|
||||
|
||||
@Excel(name = "奖励金额", width = 20)
|
||||
private String bonus;
|
||||
}
|
||||
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.maternityLeave.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.models.MaternityLeave;
|
||||
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.Dao;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/15 17:52
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/maternityLeave/apply")
|
||||
@Api("生育休假申请")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MaternityLeaveApplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/maternityLeave/apply/index.html")
|
||||
@SaCheckPermission("maternityLeave.apply")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/maternityLeave/apply/index.html")
|
||||
@SaCheckPermission("h5.maternityLeave.apply")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("保存申请")
|
||||
@SaCheckPermission(value = {"maternityLeave.apply", "h5.maternityLeave.apply"}, mode = SaMode.OR)
|
||||
@SLog(tag = "生育休假-休假申请", msg = "保存休假申请")
|
||||
public Result save(@Param("data") MaternityLeave maternityLeave) {
|
||||
if (StrUtil.isBlank(maternityLeave.getId())) maternityLeave.setApplyTime(new Date());
|
||||
dao.insertOrUpdate(maternityLeave);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("提交申请")
|
||||
@SaCheckPermission(value = {"maternityLeave.apply", "h5.maternityLeave.apply"}, mode = SaMode.OR)
|
||||
public Result submit(@Param("data") MaternityLeave maternityLeave) {
|
||||
if (StrUtil.isBlank(maternityLeave.getId())) maternityLeave.setApplyTime(new Date());
|
||||
|
||||
dao.insertOrUpdate(maternityLeave);
|
||||
// 开启流程实例
|
||||
Dict args = Dict.create();
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, maternityLeave);
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("SYXJ", maternityLeave.getId(), SecurityUtil.getUserId(), args);
|
||||
|
||||
// 自动完成第一个申请任务
|
||||
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
|
||||
for (ProcessTask task : doingTaskList) {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("重新提交申请")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"maternityLeave.apply", "h5.maternityLeave.apply"}, mode = SaMode.OR)
|
||||
public Result submitAgain(@Param("data") MaternityLeave maternityLeave, @Param("taskId") Long taskId) {
|
||||
if (StrUtil.isBlank(maternityLeave.getId())) maternityLeave.setApplyTime(new Date());
|
||||
|
||||
dao.insertOrUpdate(maternityLeave);
|
||||
|
||||
Dict dict = Dict.create();
|
||||
dict.set(FlowConst.PROCESS_TASK_ID_KEY, taskId);
|
||||
dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.RE_APPLY.getCode());
|
||||
flowCommonService.executeTask(dict);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result findOne(String id) {
|
||||
return Result.success(baseService.dao().fetch(MaternityLeave.class, id));
|
||||
}
|
||||
}
|
||||
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.maternityLeave.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.flow.engine.FlowEngine;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.zhgh.dayofficework.unionReimburse.vo.UnionReimburseCollectExcelVO;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.service.MaternityLeaveService;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.vo.MaternityLeaveCollectExcelVO;
|
||||
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.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
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.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.util.List;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/16 16:38
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/maternityLeave/collect")
|
||||
@Api("查询统计")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MaternityLeaveCollectController {
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private MaternityLeaveService maternityLeaveService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/maternityLeave/collect/index.html")
|
||||
@SaCheckPermission("maternityLeave.collect")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/maternityLeave/collect/index.html")
|
||||
@SaCheckPermission("h5.maternityLeave.collect")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"unionReimburse.collect", "h5.unionReimburse.collect"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
Integer year,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String userName,
|
||||
String sex) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke,
|
||||
(select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask' AND taskState in (10,20)) AS startTaskId
|
||||
FROM
|
||||
maternity_leave info
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 年度查询条件
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
|
||||
// 工会、单位名称查询条件
|
||||
cnd.andEX("info.unionId", "=", unionId);
|
||||
cnd.andEX("info.unitId", "=", unitId);
|
||||
|
||||
// 性别查询条件
|
||||
cnd.andEX("info.sex", "=", sex);
|
||||
|
||||
// 姓名查询条件
|
||||
if (StrUtil.isNotBlank(userName)) {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
|
||||
// 只查询流程实例状态为20的数据(已完成状态)
|
||||
cnd.and("ins.state", "=", 20);
|
||||
|
||||
cnd.desc("info.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = maternityLeaveService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
@At
|
||||
@ApiOperation("删除")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"maternityLeave.mine", "h5.maternityLeave.mine"}, mode = SaMode.OR)
|
||||
@SLog( tag = "删除工会报销", msg = "删除工会报销")
|
||||
public Result delete(@Param("id") String id) {
|
||||
maternityLeaveService.delete(id);
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission(value = {"maternityLeave.collect", "h5.maternityLeave.collect"}, mode = SaMode.OR)
|
||||
@ApiOperation("导出生育休假表")
|
||||
public void onExport(@Param(value = "year") Integer year,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "userName") String userName,
|
||||
@Param(value = "sex") String sex,
|
||||
HttpServletResponse response) {
|
||||
//查询审核通过的数据
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.state instanceState
|
||||
FROM
|
||||
maternity_leave info
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(userName)) {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
cnd.andEX("info.unionId", "=", unionId);
|
||||
cnd.andEX("info.unitId", "=", unitId);
|
||||
cnd.andEX("info.sex", "=", sex);
|
||||
cnd.and("ins.state", "=", 20);
|
||||
|
||||
cnd.desc("info.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
List<MaternityLeaveCollectExcelVO> list = maternityLeaveService.listVO(sql, MaternityLeaveCollectExcelVO.class);
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, MaternityLeaveCollectExcelVO.class, list);
|
||||
CommonDownloadUtil.download("生育休假表.xlsx", workbook, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.maternityLeave.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.flow.engine.FlowEngine;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.service.MaternityLeaveService;
|
||||
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.Sqls;
|
||||
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.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/15 17:52
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/maternityLeave/mine")
|
||||
@Api("我的休假申请")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MaternityLeaveMineController {
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private MaternityLeaveService maternityLeaveService;
|
||||
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/maternityLeave/mine/index.html")
|
||||
@SaCheckPermission("maternityLeave.mine")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/maternityLeave/mine/index.html")
|
||||
@SaCheckPermission("h5.maternityLeave.mine")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"maternityLeave.mine", "h5.maternityLeave.mine"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm, @Param(value = "year") Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke,
|
||||
(select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask') AS startTaskId
|
||||
FROM
|
||||
maternity_leave info
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 年度查询条件
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
cnd.desc("info.applyTime");
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = maternityLeaveService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"maternityLeave.mine", "h5.maternityLeave.mine"}, mode = SaMode.OR)
|
||||
@SLog( tag = "删除工会报销", msg = "删除工会报销")
|
||||
public Result delete(@Param("id") String id) {
|
||||
maternityLeaveService.delete(id);
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.maternityLeave.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.service.MaternityLeaveService;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/15 17:54
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/maternityLeave/schoolAudit")
|
||||
@Api("校工会审核")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MaternityLeaveSchoolAuditController {
|
||||
|
||||
@Inject
|
||||
private MaternityLeaveService maternityLeaveService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/maternityLeave/schoolAudit/index.html")
|
||||
@SaCheckPermission("maternityLeave.schoolAudit")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/maternityLeave/schoolAudit/index.html")
|
||||
@SaCheckPermission("h5.maternityLeave.schoolAudit")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"maternityLeave.unionAudit", "h5.maternityLeave.unionAudit"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
boolean approval,
|
||||
Integer year,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String userName,
|
||||
String sex) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN maternity_leave info ON info.id = ins.businessNo
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "abf59f7b-dc50-4d5d-8e61-a442ce3f1e8a");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
// 年度查询条件
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
|
||||
// 工会、单位名称查询条件
|
||||
cnd.andEX("info.unionId", "=", unionId);
|
||||
cnd.andEX("info.unitId", "=", unitId);
|
||||
|
||||
// 性别查询条件
|
||||
cnd.andEX("info.sex", "=", sex);
|
||||
|
||||
// 姓名查询条件
|
||||
if (StrUtil.isNotBlank(userName)) {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = maternityLeaveService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.maternityLeave.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.service.MaternityLeaveService;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/15 17:53
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/maternityLeave/unionAudit")
|
||||
@Api("分工会审核")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MaternityLeaveUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private MaternityLeaveService maternityLeaveService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/maternityLeave/unionAudit/index.html")
|
||||
@SaCheckPermission("maternityLeave.unionAudit")
|
||||
public void index() {
|
||||
}
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/maternityLeave/unionAudit/index.html")
|
||||
@SaCheckPermission("h5.maternityLeave.unionAudit")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"maternityLeave.unionAudit", "h5.maternityLeave.unionAudit"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
boolean approval,
|
||||
Integer year,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String userName,
|
||||
String sex) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN maternity_leave info ON info.id = ins.businessNo
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "c28f910f-b888-4404-a6a8-9350cc501241");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
// 年度查询条件
|
||||
cnd.andEX("year(info.applyTime)", "=", year);
|
||||
|
||||
// 工会、单位名称查询条件
|
||||
cnd.andEX("info.unionId", "=", unionId);
|
||||
cnd.andEX("info.unitId", "=", unitId);
|
||||
|
||||
// 性别查询条件
|
||||
cnd.andEX("info.sex", "=", sex);
|
||||
|
||||
// 姓名查询条件
|
||||
if (StrUtil.isNotBlank(userName)) {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = maternityLeaveService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
}
|
||||
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.maternityLeave.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/15 16:09
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("maternity_leave")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("生育休假")
|
||||
public class MaternityLeave extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("userId")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("姓名")
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("性别")
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("民族")
|
||||
private String nation;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("出生年月")
|
||||
private Date birthday;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("工号")
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在工会Id")
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在工会")
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在单位Id")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在单位")
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("电话")
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("爱人姓名")
|
||||
private String loverName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("性别")
|
||||
private String loverSex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("民族")
|
||||
private String loverNation;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("出生年月")
|
||||
private Date loverBirthday;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在单位")
|
||||
private String loverUnitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("陪护假")
|
||||
private String withLeave;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("育儿假")
|
||||
private String parentalLeave;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("产假")
|
||||
private String maternityLeave;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("延长假")
|
||||
private String extendLeave;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("多胞胎")
|
||||
private String birthsLeave;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("难产假")
|
||||
private String difficultLeave;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("寒假")
|
||||
private String winterLeave;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("暑假")
|
||||
private String summerLeave;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("假期天数")
|
||||
private String leaveDays;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("子女出生日期")
|
||||
private Date childrenBirthday;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("休假开始时间")
|
||||
private Date startTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME, width = 30)
|
||||
@Comment("休假结束时间")
|
||||
private Date endTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("填写时间")
|
||||
private Date applyTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.maternityLeave.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.models.MaternityLeave;
|
||||
|
||||
public interface MaternityLeaveService extends BaseService<MaternityLeave> {
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.maternityLeave.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.models.MaternityLeave;
|
||||
import com.budwk.app.zhgh.staffbenefit.maternityLeave.service.MaternityLeaveService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/15 17:55
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MaternityLeaveServiceImpl extends BaseServiceImpl<MaternityLeave> implements MaternityLeaveService {
|
||||
public MaternityLeaveServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
// MaternityLeaveCollectExcelVO.java
|
||||
package com.budwk.app.zhgh.staffbenefit.maternityLeave.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : hongqiwei
|
||||
* @description :
|
||||
* @createDate : 2025/9/16 17:08
|
||||
*/
|
||||
|
||||
//生育休假导出
|
||||
@Data
|
||||
public class MaternityLeaveCollectExcelVO {
|
||||
|
||||
@Excel(name = "办理时间", width = 20, format = "yyyy-MM-dd")
|
||||
private Date applyTime;
|
||||
|
||||
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "出生年月", width = 20, format = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
|
||||
@Excel(name = "爱人姓名", width = 20)
|
||||
private String loverName;
|
||||
|
||||
@Excel(name = "出生年月", width = 20, format = "yyyy-MM-dd")
|
||||
private Date loverBirthday;
|
||||
|
||||
@Excel(name = "单位", width = 20)
|
||||
private String unitName;
|
||||
|
||||
@Excel(name = "陪护假", width = 20)
|
||||
private String withLeave;
|
||||
|
||||
@Excel(name = "育儿假", width = 20)
|
||||
private String parentalLeave;
|
||||
|
||||
@Excel(name = "产假", width = 20)
|
||||
private String maternityLeave;
|
||||
|
||||
@Excel(name = "延长假", width = 20)
|
||||
private String extendLeave;
|
||||
|
||||
@Excel(name = "多胞胎", width = 20)
|
||||
private String birthsLeave;
|
||||
|
||||
@Excel(name = "难产假", width = 20)
|
||||
private String difficultLeave;
|
||||
|
||||
@Excel(name = "寒假", width = 20)
|
||||
private String winterLeave;
|
||||
|
||||
@Excel(name = "暑假", width = 20)
|
||||
private String summerLeave;
|
||||
|
||||
@Excel(name = "合计天数", width = 20)
|
||||
private String leaveDays;
|
||||
|
||||
@Excel(name = "子女出生日期", width = 20, format = "yyyy-MM-dd")
|
||||
private Date childrenBirthday;
|
||||
|
||||
@Excel(name = "休假开始时间", width = 20, format = "yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
|
||||
@Excel(name = "休假结束时间", width = 20, format = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
|
||||
@Excel(name = "电话", width = 20)
|
||||
private String mobile;
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
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.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author zzr
|
||||
* @name:PsychologyIndexController
|
||||
* @Date 2025/9/12 10:54
|
||||
* @version 1.0
|
||||
* @注释
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "心理咨询")
|
||||
@At("/platform/psychology/index")
|
||||
public class PsychologyIndexController {
|
||||
|
||||
@Inject
|
||||
private PsychologyDoctorService psychologyDoctorService;
|
||||
|
||||
@At("")
|
||||
// @SaCheckPermission("psychology.index")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/index/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
// @SaCheckPermission("psychology.index")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/psychology/index/index.html")
|
||||
public void h5() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("手机端咨询师列表展示")
|
||||
// @SaCheckPermission("psychology.index")
|
||||
public Result listConsultantByH5(){
|
||||
Pagination<PsychologyDoctor> pagination = psychologyDoctorService.listPage(1, 4, Cnd.NEW());
|
||||
List<PsychologyDoctor> list = pagination.getList();
|
||||
// 判断有没有咨询师,并且咨询师数量小于4的话,要顺序填充到4个,便于前端展示
|
||||
if (Lang.isNotEmpty(list) && list.size() < 4) {
|
||||
List<PsychologyDoctor> filledList = new ArrayList<>(4);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
filledList.add(list.get(i % list.size()));
|
||||
}
|
||||
pagination.setList(filledList);
|
||||
}
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user