Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/v4
# Conflicts: # src/main/resources/views/platform/zhgh/staffbenefit/excellentRecuperation/activityList/basicForm.js
This commit is contained in:
+79
-75
@@ -1,15 +1,25 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.declare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
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.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.declare.models.ActivityDeclareInfo;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.declare.service.ActivityDeclareService;
|
||||
import com.budwk.app.zhgh.staffmanage.member.models.MemberChangeRecord;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -22,8 +32,11 @@ 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.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
@@ -43,6 +56,8 @@ public class ActivityDeclareApplyController {
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
@Inject
|
||||
private ActivityDeclareService activityDeclareService;
|
||||
|
||||
@At("")
|
||||
@@ -57,84 +72,73 @@ public class ActivityDeclareApplyController {
|
||||
public void form() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activityDeclare.apply")
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/declare/apply/view.html")
|
||||
public void view() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动申报,我的申请列表")
|
||||
@SaCheckPermission("activityDeclare.apply")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.startTime,
|
||||
info.endTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
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
|
||||
activity_declare_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityDeclareService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动申报,查看活动申报")
|
||||
@SaCheckPermission("activityDeclare.apply")
|
||||
public Result findOne(@Valid String id) {
|
||||
ActivityDeclareInfo info = dao.fetch(ActivityDeclareInfo.class, id);
|
||||
return Result.success().addData(info);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("删除活动申报")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("保存申请")
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "活动申报", msg = "删除活动申报id: ${args[0]}")
|
||||
public Result onDelete(@Valid String id) {
|
||||
dao.clear(ActivityDeclareInfo.class, Cnd.where("id", "=", id));
|
||||
// 删除流程相关
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
@SLog(tag = "活动申报", msg = "保存申请,申请人: ${args[0].username}")
|
||||
public Result save(@Param("data") ActivityDeclareInfo activityDeclareInfo) {
|
||||
// 计算预算总金额
|
||||
double sum = activityDeclareInfo.getBudgets().stream()
|
||||
.mapToDouble(v -> ObjectUtil.defaultIfNull(v.getBudgetPrice(), 0D))
|
||||
.sum();
|
||||
activityDeclareInfo.setBudgetMoney(new BigDecimal(sum));
|
||||
dao.insertOrUpdate(activityDeclareInfo);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("提交申请")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "活动申报", msg = "提交申请,申请人: ${args[0].username}")
|
||||
public Result submit(@Param("data") ActivityDeclareInfo activityDeclareInfo){
|
||||
activityDeclareInfo.setYear(ObjectUtil.defaultIfNull(activityDeclareInfo.getYear(), DateUtil.thisYear()));
|
||||
// 计算预算总金额
|
||||
double sum = activityDeclareInfo.getBudgets().stream()
|
||||
.mapToDouble(v -> ObjectUtil.defaultIfNull(v.getBudgetPrice(), 0D))
|
||||
.sum();
|
||||
activityDeclareInfo.setBudgetMoney(new BigDecimal(sum));
|
||||
// 保存数据
|
||||
dao.insertOrUpdate(activityDeclareInfo);
|
||||
|
||||
// 开启流程实例
|
||||
Dict args = Dict.create();
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, activityDeclareInfo);
|
||||
args.set("type", activityDeclareInfo.getActivityType());
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("HDSB", activityDeclareInfo.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("member.apply.submit")
|
||||
@SLog(tag = "活动申报", msg = "重新提交申请,申请人: ${args[0].username}")
|
||||
public Result submitAgain(@Param("data") ActivityDeclareInfo activityDeclareInfo, @Param("taskId") Long taskId) {
|
||||
activityDeclareInfo.setYear(ObjectUtil.defaultIfNull(activityDeclareInfo.getYear(), DateUtil.thisYear()));
|
||||
// 计算预算总金额
|
||||
double sum = activityDeclareInfo.getBudgets().stream()
|
||||
.mapToDouble(v -> ObjectUtil.defaultIfNull(v.getBudgetPrice(), 0D))
|
||||
.sum();
|
||||
activityDeclareInfo.setBudgetMoney(new BigDecimal(sum));
|
||||
dao.insertOrUpdate(activityDeclareInfo);
|
||||
|
||||
Dict dict = Dict.create();
|
||||
dict.set(FlowConst.PROCESS_TASK_ID_KEY, taskId);
|
||||
dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.RE_APPLY.getCode());
|
||||
dict.set("type", activityDeclareInfo.getActivityType());
|
||||
flowCommonService.executeTask(dict);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+72
-1
@@ -1,17 +1,28 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.declare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.declare.service.ActivityDeclareService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -50,7 +61,67 @@ public class ActivityDeclareBranchUnionController {
|
||||
@ApiOperation("分工会审核列表")
|
||||
@SaCheckPermission("activityDeclare.branchUnion")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
return Result.success();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.mobile,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.planStartTime,
|
||||
info.planEndTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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 activity_declare_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
|
||||
cnd.and("t.taskName", "=", "54f481d7-3239-4cd2-882d-e1cc18ea86eb");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityDeclareService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+85
@@ -1,11 +1,26 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.declare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
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.activity.declarereimbursement.declare.service.ActivityDeclareService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -19,6 +34,8 @@ import org.nutz.mvc.annotation.Ok;
|
||||
@At("/platform/activityDeclare/clubPrincipal")
|
||||
public class ActivityDeclareClubPrincipalController {
|
||||
|
||||
@Inject
|
||||
private ActivityDeclareService activityDeclareService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityDeclare.clubPrincipal")
|
||||
@@ -31,4 +48,72 @@ public class ActivityDeclareClubPrincipalController {
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/declare/clubprincipal/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动申报,协会负责人审核列表")
|
||||
@SaCheckPermission("activityDeclare.clubPrincipal")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.mobile,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.planStartTime,
|
||||
info.planEndTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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 activity_declare_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
|
||||
cnd.and("t.taskName", "=", "06d5979b-b52f-4df1-8974-087568322cd6");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityDeclareService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
}
|
||||
|
||||
+296
@@ -0,0 +1,296 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.declare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.BpmProcessConstant;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
import com.budwk.app.bpm.vo.BpmTaskApprovalRecordVo;
|
||||
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.vo.ProcessTaskVO;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.declare.models.ActivityDeclareInfo;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.declare.service.ActivityDeclareService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.models.ActivityReimbursementInfo;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.ActivityBudgetVO;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
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.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityDeclareMineController
|
||||
* @Date 2025/8/26 10:14
|
||||
* @注释
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("我的活动申报")
|
||||
@At("/platform/activityDeclare/mine")
|
||||
public class ActivityDeclareMineController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private SysOfficeTemplateUtil sysOfficeTemplateUtil;
|
||||
@Inject
|
||||
private ActivityDeclareService activityDeclareService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityDeclare.mine")
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/declare/mine/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动申报,我的申请列表")
|
||||
@SaCheckPermission("activityDeclare.mine")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.mobile,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.planStartTime,
|
||||
info.planEndTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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
|
||||
activity_declare_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_MEMBER_ADMIN.name())) {
|
||||
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("info.unionId", "=", SecurityUtil.getUnionId());
|
||||
} else {
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityDeclareService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动申报,查看活动申报")
|
||||
@SaCheckPermission("activityDeclare.mine")
|
||||
public Result findOne(@Valid String id) {
|
||||
ActivityDeclareInfo info = dao.fetch(ActivityDeclareInfo.class, id);
|
||||
return Result.success().addData(info);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("删除活动申报")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("activityDeclare.mine")
|
||||
@SLog(tag = "活动申报", msg = "删除活动申报id: ${args[0]}")
|
||||
public Result onDelete(@Valid String id) {
|
||||
dao.clear(ActivityDeclareInfo.class, Cnd.where("id", "=", id));
|
||||
// 删除流程相关
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
|
||||
// 如果有报销的流程,也一并删除
|
||||
ActivityReimbursementInfo reimbursementInfo = dao.fetch(ActivityReimbursementInfo.class, Cnd.where("declareId", "=", id));
|
||||
if (Lang.isNotEmpty(reimbursementInfo)) {
|
||||
dao.clear(ActivityReimbursementInfo.class, Cnd.where("id", "=", reimbursementInfo.getId()));
|
||||
// 删除流程相关
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(reimbursementInfo.getId());
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activityDeclare.mine")
|
||||
@SLog(tag = "活动申报", msg = "导出活动申报表")
|
||||
public void doExportDeclare(@Valid String id, HttpServletResponse response) {
|
||||
HashMap<String, Object> docData = new HashMap<>();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId
|
||||
FROM
|
||||
`activity_declare_info` info
|
||||
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
|
||||
WHERE
|
||||
ins.state = 20 AND info.id = @id
|
||||
""").setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap info = (NutMap) sql.getResult();
|
||||
|
||||
String activityContent = info.getString("activityContent");
|
||||
info.put("activityContent", sysOfficeTemplateUtil.convertRichTextToDocText(activityContent));
|
||||
|
||||
docData.put("schoolName", Globals.AppName);
|
||||
docData.put("info", info);
|
||||
|
||||
List<ProcessTaskVO> doneTaskVos = new ArrayList<>();
|
||||
List<ProcessTask> doneTaskList = flowEngine.processTaskService().getDoneTaskList(info.getLong("instanceId"), null);
|
||||
for (ProcessTask doneTask : doneTaskList) {
|
||||
ProcessTaskVO taskVO = flowEngine.processTaskService().findById(doneTask.getId());
|
||||
doneTaskVos.add(taskVO);
|
||||
}
|
||||
|
||||
// 分工会审核
|
||||
doneTaskVos.stream().filter(task -> "分工会审核".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
HashMap<String, Object> approval = new HashMap<>();
|
||||
|
||||
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
approval.put("user", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("fgh", approval);
|
||||
});
|
||||
|
||||
// 协会负责人审核
|
||||
doneTaskVos.stream().filter(task -> "协会负责人审核".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
HashMap<String, Object> approval = new HashMap<>();
|
||||
|
||||
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
approval.put("user", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("xh", approval);
|
||||
});
|
||||
|
||||
// 校工会负责人审核
|
||||
doneTaskVos.stream().filter(task -> "校工会负责人审核".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
HashMap<String, Object> approval = new HashMap<>();
|
||||
|
||||
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
approval.put("user", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("xfzr", approval);
|
||||
});
|
||||
|
||||
// 校工会主席审核
|
||||
doneTaskVos.stream().filter(task -> "校工会主席审核".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
HashMap<String, Object> approval = new HashMap<>();
|
||||
|
||||
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
approval.put("user", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("xzx", approval);
|
||||
});
|
||||
|
||||
String budgetsStr = info.getString("budgets");
|
||||
List<ActivityBudgetVO> list = JSONUtil.parseArray(budgetsStr).toList(ActivityBudgetVO.class);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setRanking(i + 1);
|
||||
}
|
||||
docData.put("budgets", list);
|
||||
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
Configure config = Configure.builder()
|
||||
.bind("budgets", policy)
|
||||
.build();
|
||||
|
||||
String fileName = Globals.AppName + "【" + info.getString("activityName") + "】申报表.docx";
|
||||
|
||||
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("activity_declare"), config).render(docData).writeAndClose(byteArrayOutputStream);
|
||||
CommonDownloadUtil.download(fileName, byteArrayOutputStream.toByteArray(), response);
|
||||
} catch (IOException e) {
|
||||
log.error("活动申报表导出失败,id:{},错误信息:{}", id, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+86
@@ -1,11 +1,26 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.declare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
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.activity.declarereimbursement.declare.service.ActivityDeclareService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -19,6 +34,9 @@ import org.nutz.mvc.annotation.Ok;
|
||||
@At("/platform/activityDeclare/schoolPrincipal")
|
||||
public class ActivityDeclareSchoolPrincipalController {
|
||||
|
||||
@Inject
|
||||
private ActivityDeclareService activityDeclareService;
|
||||
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityDeclare.schoolPrincipal")
|
||||
@@ -31,4 +49,72 @@ public class ActivityDeclareSchoolPrincipalController {
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/declare/schoolprincipal/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动申报,校工会负责人审核列表")
|
||||
@SaCheckPermission("activityDeclare.schoolPrincipal")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.mobile,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.planStartTime,
|
||||
info.planEndTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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 activity_declare_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
|
||||
cnd.and("t.taskName", "=", "5b511275-143f-4ecd-8eff-7c8ad1456b1b");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityDeclareService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
}
|
||||
|
||||
+85
@@ -1,11 +1,26 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.declare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
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.activity.declarereimbursement.declare.service.ActivityDeclareService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -19,6 +34,9 @@ import org.nutz.mvc.annotation.Ok;
|
||||
@At("/platform/activityDeclare/schoolUnion")
|
||||
public class ActivityDeclareSchoolUnionController {
|
||||
|
||||
@Inject
|
||||
private ActivityDeclareService activityDeclareService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityDeclare.schoolUnion")
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/declare/schoolunion/index.html")
|
||||
@@ -30,4 +48,71 @@ public class ActivityDeclareSchoolUnionController {
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/declare/schoolunion/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动申报,校工会审核列表")
|
||||
@SaCheckPermission("activityDeclare.schoolUnion")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.mobile,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.planStartTime,
|
||||
info.planEndTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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 activity_declare_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
|
||||
cnd.and("t.taskName", "=", "81428a9b-63c0-44b8-a28c-17d282c2cc8e");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityDeclareService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
}
|
||||
|
||||
+29
-1
@@ -1,5 +1,17 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.declare.interceptor;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowInterceptor;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.declare.models.ActivityDeclareInfo;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.json.Json;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -7,5 +19,21 @@ package com.budwk.app.zhgh.activity.declarereimbursement.declare.interceptor;
|
||||
* @Date 2025/8/1 11:05
|
||||
* @注释
|
||||
*/
|
||||
public class ActivityDeclareInterceptor {
|
||||
public class ActivityDeclareInterceptor implements FlowInterceptor {
|
||||
|
||||
@Override
|
||||
public void intercept(Execution execution) {
|
||||
String formDataStr = execution.getArgs().getStr(FlowConst.FORM_DATA);
|
||||
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
ActivityDeclareInfo declareInfo = Json.fromJson(ActivityDeclareInfo.class, formDataStr);
|
||||
declareInfo.setYear(DateUtil.thisYear());
|
||||
// 设置流程变量
|
||||
execution.getArgs().set("type", declareInfo.getActivityType());
|
||||
dao.insertOrUpdate(declareInfo);
|
||||
|
||||
execution.getArgs().set(FlowConst.FORM_DATA, Json.toJson(declareInfo));
|
||||
int instanceId = execution.getArgs().getInt(FlowConst.PROCESS_INSTANCE_ID_KEY);
|
||||
dao.update(ProcessInstance.class, Chain.make("businessNo", declareInfo.getId()), Cnd.where(ProcessInstance::getId, "=", instanceId));
|
||||
}
|
||||
}
|
||||
|
||||
+14
-9
@@ -2,12 +2,13 @@ package com.budwk.app.zhgh.activity.declarereimbursement.declare.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.ActivityBudget;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.ActivityBudgetVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -90,14 +91,14 @@ public class ActivityDeclareInfo extends BaseModel {
|
||||
private String activityAddress;
|
||||
|
||||
@Column
|
||||
@Comment("活动开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String startTime;
|
||||
@Comment("活动计划开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date planStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String endTime;
|
||||
@Comment("活动计划结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date planEndTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@@ -105,7 +106,7 @@ public class ActivityDeclareInfo extends BaseModel {
|
||||
private String activityType;
|
||||
|
||||
@Column
|
||||
@Comment("活动内容")
|
||||
@Comment("活动方案及简介")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String activityContent;
|
||||
|
||||
@@ -122,6 +123,10 @@ public class ActivityDeclareInfo extends BaseModel {
|
||||
@Column
|
||||
@Comment("活动经费预算")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<ActivityBudget> budgets;
|
||||
private List<ActivityBudgetVO> budgets;
|
||||
|
||||
@Column
|
||||
@Comment("预算总金额")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal budgetMoney;
|
||||
}
|
||||
|
||||
+160
-54
@@ -1,12 +1,22 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
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.activity.declarereimbursement.declare.models.ActivityDeclareInfo;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.models.ActivityReimbursementInfo;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.service.ActivityReimbursementService;
|
||||
@@ -19,11 +29,16 @@ 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.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 javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
@@ -43,6 +58,8 @@ public class ActivityReimbursementApplyController {
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
@Inject
|
||||
private ActivityReimbursementService activityReimbursementService;
|
||||
|
||||
@At("")
|
||||
@@ -57,75 +74,164 @@ public class ActivityReimbursementApplyController {
|
||||
public void form() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activityReimbursement.apply")
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/reimbursement/apply/view.html")
|
||||
public void view() {
|
||||
@ApiOperation("保存申请")
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "活动申报", msg = "保存申请,申请人: ${args[0].username}")
|
||||
public Result save(@Param("data") ActivityReimbursementInfo activityReimbursementInfo) {
|
||||
if (StrUtil.isBlank(activityReimbursementInfo.getDeclareId())) {
|
||||
activityReimbursementInfo.setDeclareId(activityReimbursementInfo.getDeclareId());
|
||||
}
|
||||
// 计算实际总金额
|
||||
double sum = activityReimbursementInfo.getBudgets().stream()
|
||||
.mapToDouble(v -> ObjectUtil.defaultIfNull(v.getActualPrice(), 0D))
|
||||
.sum();
|
||||
activityReimbursementInfo.setActualMoney(new BigDecimal(sum));
|
||||
dao.insertOrUpdate(activityReimbursementInfo);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报销,我的申请列表")
|
||||
@SaCheckPermission("activityDeclare.apply")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
@ApiOperation("提交申请")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "活动申报", msg = "提交申请,申请人: ${args[0].username}")
|
||||
public Result submit(@Param("data") ActivityReimbursementInfo activityReimbursementInfo){
|
||||
if (StrUtil.isBlank(activityReimbursementInfo.getDeclareId())) {
|
||||
activityReimbursementInfo.setDeclareId(activityReimbursementInfo.getDeclareId());
|
||||
}
|
||||
activityReimbursementInfo.setYear(ObjectUtil.defaultIfNull(activityReimbursementInfo.getYear(), DateUtil.thisYear()));
|
||||
// 计算实际总金额
|
||||
double sum = activityReimbursementInfo.getBudgets().stream()
|
||||
.mapToDouble(v -> ObjectUtil.defaultIfNull(v.getActualPrice(), 0D))
|
||||
.sum();
|
||||
activityReimbursementInfo.setActualMoney(new BigDecimal(sum));
|
||||
dao.insertOrUpdate(activityReimbursementInfo);
|
||||
|
||||
// 开启流程实例
|
||||
Dict args = Dict.create();
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, activityReimbursementInfo);
|
||||
args.set("type", activityReimbursementInfo.getActivityType());
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("HDBX", activityReimbursementInfo.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("member.apply.submit")
|
||||
@SLog(tag = "活动申报", msg = "重新提交申请,申请人: ${args[0].username}")
|
||||
public Result submitAgain(@Param("data") ActivityReimbursementInfo activityReimbursementInfo, @Param("taskId") Long taskId) {
|
||||
if (StrUtil.isBlank(activityReimbursementInfo.getDeclareId())) {
|
||||
activityReimbursementInfo.setDeclareId(activityReimbursementInfo.getDeclareId());
|
||||
}
|
||||
activityReimbursementInfo.setYear(ObjectUtil.defaultIfNull(activityReimbursementInfo.getYear(), DateUtil.thisYear()));
|
||||
// 计算实际总金额
|
||||
double sum = activityReimbursementInfo.getBudgets().stream()
|
||||
.mapToDouble(v -> ObjectUtil.defaultIfNull(v.getActualPrice(), 0D))
|
||||
.sum();
|
||||
activityReimbursementInfo.setActualMoney(new BigDecimal(sum));
|
||||
dao.insertOrUpdate(activityReimbursementInfo);
|
||||
|
||||
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
|
||||
@ApiOperation("获取当前用户活动报销")
|
||||
@SaCheckPermission("activityReimbursement.apply")
|
||||
public Result getActivityReimbursementByUser(String id) {
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
ActivityReimbursementInfo reimbursementInfo = dao.fetch(ActivityReimbursementInfo.class, id);
|
||||
ActivityDeclareInfo info = dao.fetch(ActivityDeclareInfo.class, reimbursementInfo.getDeclareId());
|
||||
return Result.success().addData(List.of(info));
|
||||
}
|
||||
|
||||
// 查询已经报销成功的记录
|
||||
Sql reiSql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.startTime,
|
||||
info.endTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
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
|
||||
info.declareId
|
||||
FROM
|
||||
activity_reimbursement_info 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
|
||||
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
|
||||
WHERE
|
||||
userId = @userId
|
||||
AND ins.state IN (10, 20)
|
||||
""").setParam("userId", SecurityUtil.getUserId());
|
||||
reiSql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(reiSql);
|
||||
List<String> reiDecIdList = reiSql.getList(String.class);
|
||||
|
||||
Sql sql = Sqls.create("select declareId from activity_reimbursement_info where userId = @userId").setParam("userId", SecurityUtil.getUserId());
|
||||
sql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(sql);
|
||||
List<String> declareIdList = sql.getList(String.class);
|
||||
|
||||
Sql applySql = Sqls.create("""
|
||||
SELECT
|
||||
info.*
|
||||
FROM
|
||||
activity_declare_info info
|
||||
LEFT JOIN wf_process_instance ins ON info.id = ins.businessNo
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
if (Lang.isNotEmpty(declareIdList)) {
|
||||
cnd.and("info.id", "not in", declareIdList);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityReimbursementService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
if (Lang.isNotEmpty(reiDecIdList)) {
|
||||
cnd.and("info.id", "not in", reiDecIdList);
|
||||
}
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
cnd.and("ins.state", "=", 20);
|
||||
applySql.setCondition(cnd);
|
||||
|
||||
List<NutMap> resultList = activityReimbursementService.listMap(applySql);
|
||||
return Result.success().addData(resultList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("删除活动报销")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "活动报销", msg = "删除活动报销id: ${args[0]}")
|
||||
public Result onDelete(@Valid String id) {
|
||||
dao.clear(ActivityReimbursementInfo.class, Cnd.where("id", "=", id));
|
||||
// 删除流程相关
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
@ApiOperation("获取收款人卡号")
|
||||
@SaCheckPermission("activityReimbursement.apply")
|
||||
public Result getCardNumberByPayeeId(String username) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
JT.bankName,
|
||||
JT.bankCardNum
|
||||
FROM
|
||||
activity_reimbursement_info AS info,
|
||||
JSON_TABLE(
|
||||
budgets,
|
||||
'$[*]' COLUMNS(
|
||||
username VARCHAR(255) PATH '$.username',
|
||||
bankName VARCHAR(255) PATH '$.bankName',
|
||||
bankCardNum VARCHAR(255) PATH '$.bankCardNum'
|
||||
)
|
||||
) AS JT
|
||||
WHERE
|
||||
JT.username = @username
|
||||
ORDER BY info.applyTime DESC LIMIT 1
|
||||
""").setParam("username", username);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap map = (NutMap) sql.getResult();
|
||||
return Result.success().addData(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+274
@@ -0,0 +1,274 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.enums.ActivityDeclareReimbursement;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.service.ActivityReimbursementService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementBoardController
|
||||
* @Date 2025/8/26 16:10
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("活动报销图表展示")
|
||||
@At("/platform/activityReimbursement/board")
|
||||
public class ActivityReimbursementBoardController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ActivityReimbursementService activityReimbursementService;
|
||||
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityReimbursement.board")
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/reimbursement/board/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("获取参与人数和活动报销经费数据")
|
||||
@SaCheckPermission("activityReimbursement.board")
|
||||
public Result getNumData(Integer startYear, Integer endYear){
|
||||
Sql schoolSignNum = activityReimbursementService.getActivityUserNumAndMoneySql(startYear, endYear, false).setParam("type", ActivityDeclareReimbursement.SCHOOL_UNION.name());
|
||||
Sql unionSignNum = activityReimbursementService.getActivityUserNumAndMoneySql(startYear, endYear, false).setParam("type", ActivityDeclareReimbursement.BRANCH_UNION.name());
|
||||
Sql clubSignNum = activityReimbursementService.getActivityUserNumAndMoneySql(startYear, endYear, false).setParam("type", ActivityDeclareReimbursement.CLUB.name());
|
||||
|
||||
Sql schoolActivityMoney = activityReimbursementService.getActivityUserNumAndMoneySql(startYear, endYear, true).setParam("type", ActivityDeclareReimbursement.SCHOOL_UNION.name());
|
||||
Sql unionActivityMoney = activityReimbursementService.getActivityUserNumAndMoneySql(startYear, endYear, true).setParam("type", ActivityDeclareReimbursement.BRANCH_UNION.name());
|
||||
Sql clubActivityMoney = activityReimbursementService.getActivityUserNumAndMoneySql(startYear, endYear, true).setParam("type", ActivityDeclareReimbursement.CLUB.name());
|
||||
HashMap result = new HashMap() {{
|
||||
put("schoolSignNum", activityReimbursementService.listMap(schoolSignNum).stream().mapToInt(v->v.getInt("activityNum")).sum());
|
||||
put("unionSignNum", activityReimbursementService.listMap(unionSignNum).stream().mapToInt(v->v.getInt("activityNum")).sum());
|
||||
put("clubSignNum", activityReimbursementService.listMap(clubSignNum).stream().mapToInt(v->v.getInt("activityNum")).sum());
|
||||
put("schoolActivityMoney", activityReimbursementService.count(schoolActivityMoney));
|
||||
put("unionActivityMoney", activityReimbursementService.count(unionActivityMoney));
|
||||
put("clubActivityMoney", activityReimbursementService.count(clubActivityMoney));
|
||||
}};
|
||||
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("获取活动的类型数量柱状图")
|
||||
@SaCheckPermission("activityReimbursement.board")
|
||||
public Result getActivityTypeChart(Integer startYear, Integer endYear){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count(1)
|
||||
FROM
|
||||
activity_reimbursement_info info
|
||||
LEFT JOIN wf_process_instance ins ON info.id = ins.businessNo
|
||||
WHERE
|
||||
ins.state = 30
|
||||
AND info.activityType = @type
|
||||
AND info.`year` = @year
|
||||
""");
|
||||
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
if (startYear == null || endYear == null) {
|
||||
int nowYear = DateUtil.thisYear();
|
||||
startYear = nowYear - 9;
|
||||
endYear = nowYear;
|
||||
}
|
||||
|
||||
for (int i = startYear; i <= endYear; i++) {
|
||||
final int year = i;
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "校工会活动");
|
||||
put("num", activityReimbursementService.count(sql.setParam("type", ActivityDeclareReimbursement.SCHOOL_UNION.name()).setParam("year", year)));
|
||||
}});
|
||||
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "分工会活动");
|
||||
put("num", activityReimbursementService.count(sql.setParam("type", ActivityDeclareReimbursement.BRANCH_UNION.name()).setParam("year", year)));
|
||||
}});
|
||||
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "社团活动");
|
||||
put("num", activityReimbursementService.count(sql.setParam("type", ActivityDeclareReimbursement.CLUB.name()).setParam("year", year)));
|
||||
}});
|
||||
}
|
||||
return Result.success().addData(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("获取活动的类型数量饼图")
|
||||
@SaCheckPermission("activityReimbursement.board")
|
||||
public Result getActivityTypePieNum(Integer startYear, Integer endYear){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count(1)
|
||||
FROM
|
||||
activity_reimbursement_info info
|
||||
LEFT JOIN wf_process_instance ins ON info.id = ins.businessNo
|
||||
WHERE
|
||||
ins.state = 30
|
||||
AND activityType = @type
|
||||
AND `year` <= @startYear
|
||||
AND `year` >= @endYear
|
||||
""").setParam("startYear", startYear).setParam("endYear", endYear);
|
||||
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
list.add(new NutMap() {{
|
||||
put("type", "校工会活动");
|
||||
put("num", activityReimbursementService.count(sql.setParam("type", ActivityDeclareReimbursement.SCHOOL_UNION.name())));
|
||||
}});
|
||||
list.add(new NutMap() {{
|
||||
put("type", "分工会活动");
|
||||
put("num", activityReimbursementService.count(sql.setParam("type", ActivityDeclareReimbursement.BRANCH_UNION.name())));
|
||||
}});
|
||||
list.add(new NutMap() {{
|
||||
put("type", "社团活动");
|
||||
put("num", activityReimbursementService.count(sql.setParam("type", ActivityDeclareReimbursement.CLUB.name())));
|
||||
}});
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("获取活动的经费统计图")
|
||||
@SaCheckPermission("activityReimbursement.board")
|
||||
public Result getActivityMoneyChart(Integer startYear, Integer endYear){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
IFNULL(sum(info.actualMoney), 0) money
|
||||
FROM
|
||||
activity_reimbursement_info info
|
||||
LEFT JOIN wf_process_instance ins ON info.id = ins.businessNo
|
||||
WHERE
|
||||
ins.state = 30
|
||||
AND info.activityType = @type
|
||||
AND info.`year` = @year
|
||||
""");
|
||||
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
if (startYear == null || endYear == null) {
|
||||
int nowYear = DateUtil.thisYear();
|
||||
startYear = nowYear - 9;
|
||||
endYear = nowYear;
|
||||
}
|
||||
|
||||
for (int i = startYear; i <= endYear; i++) {
|
||||
final int year = i;
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "校工会费用");
|
||||
put("num", activityReimbursementService.list(sql.setParam("type", ActivityDeclareReimbursement.SCHOOL_UNION.name()).setParam("year", year)).get(0).getDouble("money"));
|
||||
}});
|
||||
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "分工会费用");
|
||||
put("num", activityReimbursementService.list(sql.setParam("type", ActivityDeclareReimbursement.BRANCH_UNION.name()).setParam("year", year)).get(0).getDouble("money"));
|
||||
}});
|
||||
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "社团费用");
|
||||
put("num", activityReimbursementService.list(sql.setParam("type", ActivityDeclareReimbursement.CLUB.name()).setParam("year", year)).get(0).getDouble("money"));
|
||||
}});
|
||||
}
|
||||
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("获取活动的经费饼图")
|
||||
@SaCheckPermission("activityReimbursement.board")
|
||||
public Result getActivityMoneyPieNum(Integer startYear, Integer endYear){
|
||||
Sql schoolSql = activityReimbursementService.getActivityUserNumAndMoneySql(startYear, endYear, true).setParam("type", ActivityDeclareReimbursement.SCHOOL_UNION.name());
|
||||
Sql unionSql = activityReimbursementService.getActivityUserNumAndMoneySql(startYear, endYear, true).setParam("type", ActivityDeclareReimbursement.BRANCH_UNION.name());
|
||||
Sql clubSql = activityReimbursementService.getActivityUserNumAndMoneySql(startYear, endYear, true).setParam("type", ActivityDeclareReimbursement.CLUB.name());
|
||||
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
list.add(new NutMap() {{
|
||||
put("type", "校工会费用");
|
||||
put("num", activityReimbursementService.count(schoolSql));
|
||||
}});
|
||||
list.add(new NutMap() {{
|
||||
put("type", "分工会费用");
|
||||
put("num", activityReimbursementService.count(unionSql));
|
||||
}});
|
||||
list.add(new NutMap() {{
|
||||
put("type", "社团费用");
|
||||
put("num", activityReimbursementService.count(clubSql));
|
||||
}});
|
||||
return Result.success().addData(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("所有工会的报销费用或活动数统计")
|
||||
@SaCheckPermission("activityReimbursement.board")
|
||||
public Result allUnionActivityAndMoney(Integer year, Boolean isUnionMoney){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.`name` AS unionname,
|
||||
$unionSql
|
||||
FROM
|
||||
sys_union su
|
||||
LEFT JOIN activity_reimbursement_info info ON su.id = info.unionId
|
||||
AND info.activityType = "BRANCH_UNION"
|
||||
AND info.`year` = @year
|
||||
GROUP BY
|
||||
su.`name`
|
||||
ORDER BY
|
||||
su.unionCode ASC
|
||||
""").setParam("year", year);
|
||||
sql.setVar("unionSql", isUnionMoney ? new Static(" COALESCE(SUM(info.actualMoney), 0) AS money ") : new Static(" count(info.id) as money "));
|
||||
List<NutMap> list = activityReimbursementService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("所有协会的报销费用或活动数统计")
|
||||
@SaCheckPermission("activityReimbursement.board")
|
||||
public Result allClubActivityAndMoney(Integer year, Boolean isClubMoney) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sc.clubName,
|
||||
$clubSql
|
||||
FROM
|
||||
sys_club sc
|
||||
LEFT JOIN activity_reimbursement_info info ON sc.id = info.clubId
|
||||
AND info.`year` = @year
|
||||
AND info.activityType = "CLUB"
|
||||
GROUP BY
|
||||
sc.id
|
||||
ORDER BY
|
||||
sc.clubCode ASC
|
||||
""").setParam("year", year);
|
||||
sql.setVar("clubSql", isClubMoney ? new Static(" COALESCE(SUM(info.actualMoney), 0) AS money ") : new Static(" count(info.id) as money "));
|
||||
List<NutMap> list = activityReimbursementService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
+87
-1
@@ -1,11 +1,26 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
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.activity.declarereimbursement.reimbursement.service.ActivityReimbursementService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -15,10 +30,13 @@ import org.nutz.mvc.annotation.Ok;
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("活动申报,分工会管理员审核")
|
||||
@ApiOperation("活动报销,分工会管理员审核")
|
||||
@At("/platform/activityReimbursement/branchUnion")
|
||||
public class ActivityReimbursementBranchUnionController {
|
||||
|
||||
@Inject
|
||||
private ActivityReimbursementService activityReimbursementService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityReimbursement.branchUnion")
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/reimbursement/branchunion/index.html")
|
||||
@@ -30,4 +48,72 @@ public class ActivityReimbursementBranchUnionController {
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/reimbursement/branchunion/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报销,分工会审核列表")
|
||||
@SaCheckPermission("activityReimbursement.branchUnion")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.mobile,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.planStartTime,
|
||||
info.planEndTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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 activity_reimbursement_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
|
||||
cnd.and("t.taskName", "=", "1e4cc473-beae-427d-b9dc-c1c4d0eb07c8");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityReimbursementService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
}
|
||||
|
||||
+87
-1
@@ -1,11 +1,26 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
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.activity.declarereimbursement.reimbursement.service.ActivityReimbursementService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -15,10 +30,12 @@ import org.nutz.mvc.annotation.Ok;
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("活动申报,协会负责人审核")
|
||||
@ApiOperation("活动报销,协会负责人审核")
|
||||
@At("/platform/activityReimbursement/clubPrincipal")
|
||||
public class ActivityReimbursementClubPrincipalController {
|
||||
|
||||
@Inject
|
||||
private ActivityReimbursementService activityReimbursementService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityReimbursement.clubPrincipal")
|
||||
@@ -31,4 +48,73 @@ public class ActivityReimbursementClubPrincipalController {
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/reimbursement/clubprincipal/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报销,协会负责人审核列表")
|
||||
@SaCheckPermission("activityReimbursement.clubPrincipal")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.mobile,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.planStartTime,
|
||||
info.planEndTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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 activity_reimbursement_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
|
||||
cnd.and("t.taskName", "=", "5afcf810-7a8b-4896-9aa7-c99995e0856b");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityReimbursementService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+379
@@ -0,0 +1,379 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.convert.NumberChineseFormatter;
|
||||
import cn.hutool.core.convert.NumberWordFormatter;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.vo.ProcessTaskVO;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.models.ActivityReimbursementInfo;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.service.ActivityReimbursementService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.ActivityBudgetVO;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementMineController
|
||||
* @Date 2025/8/26 11:16
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@Slf4j
|
||||
@ApiOperation("我的活动报销")
|
||||
@At("/platform/activityReimbursement/mine")
|
||||
public class ActivityReimbursementMineController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private SysOfficeTemplateUtil sysOfficeTemplateUtil;
|
||||
@Inject
|
||||
private ActivityReimbursementService activityReimbursementService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityReimbursement.mine")
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/reimbursement/mine/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报销,我的申请列表")
|
||||
@SaCheckPermission("activityReimbursement.mine")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.declareId,
|
||||
info.userName,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.startTime,
|
||||
info.endTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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
|
||||
activity_reimbursement_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_MEMBER_ADMIN.name())) {
|
||||
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("info.unionId", "=", SecurityUtil.getUnionId());
|
||||
} else {
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
// cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityReimbursementService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报销,查看活动报销")
|
||||
@SaCheckPermission("activityReimbursement.mine")
|
||||
public Result findOne(@Valid String id) {
|
||||
ActivityReimbursementInfo info = dao.fetch(ActivityReimbursementInfo.class, id);
|
||||
return Result.success().addData(info);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("删除活动报销")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("activityReimbursement.mine")
|
||||
@SLog(tag = "活动报销", msg = "删除活动报销id: ${args[0]}")
|
||||
public Result onDelete(@Valid String id) {
|
||||
dao.clear(ActivityReimbursementInfo.class, Cnd.where("id", "=", id));
|
||||
// 删除流程相关
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activityReimbursement.mine")
|
||||
@SLog(tag = "活动报销", msg = "导出报销凭证")
|
||||
public void doExportReimbursement(@Valid String id, HttpServletResponse response) {
|
||||
HashMap<String, Object> docData = new HashMap<>();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId
|
||||
FROM
|
||||
`activity_reimbursement_info` info
|
||||
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
|
||||
WHERE
|
||||
ins.state = 20 AND info.id = @id
|
||||
""").setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap info = (NutMap) sql.getResult();
|
||||
|
||||
String activityContent = info.getString("activityContent");
|
||||
if (activityContent != null) {
|
||||
// 检查是否以<p>标签开头并以</p>标签结尾
|
||||
if (activityContent.startsWith("<p>") && activityContent.endsWith("</p>")) {
|
||||
// 去除最外层的<p>和</p>标签
|
||||
activityContent = activityContent.substring(3, activityContent.length() - 4);
|
||||
}
|
||||
// 对处理后的内容进行富文本转换
|
||||
info.put("activityContent", sysOfficeTemplateUtil.convertRichTextToDocText(activityContent));
|
||||
}
|
||||
|
||||
|
||||
double actualMoneyNum = info.getDouble("actualMoney");
|
||||
// 分离整数和小数部分
|
||||
long integerPart = (long) actualMoneyNum;
|
||||
int decimalPartValue = (int) Math.round((actualMoneyNum - integerPart) * 100);
|
||||
|
||||
// 转换整数部分为中文大写
|
||||
String integerChinese = NumberChineseFormatter.format(integerPart, true) + "元";
|
||||
|
||||
// 处理小数部分
|
||||
String decimalChinese = "";
|
||||
int jiao = decimalPartValue / 10;
|
||||
int fen = decimalPartValue % 10;
|
||||
|
||||
if (jiao > 0) {
|
||||
decimalChinese += NumberChineseFormatter.format(jiao, true) + "角";
|
||||
}
|
||||
if (fen > 0) {
|
||||
decimalChinese += NumberChineseFormatter.format(fen, true) + "分";
|
||||
}
|
||||
|
||||
// 如果没有小数部分,添加"整"字
|
||||
if (decimalChinese.isEmpty()) {
|
||||
decimalChinese = "整";
|
||||
}
|
||||
|
||||
// 组合结果
|
||||
String actualMoneyChinese = integerChinese + decimalChinese;
|
||||
info.put("actualMoney", actualMoneyChinese);
|
||||
|
||||
docData.put("schoolName", Globals.AppName);
|
||||
docData.put("info", info);
|
||||
// 使用BigDecimal确保精确处理
|
||||
BigDecimal bd = BigDecimal.valueOf(actualMoneyNum).setScale(2, RoundingMode.HALF_UP);
|
||||
String moneyStr = bd.toPlainString();
|
||||
|
||||
// 分割整数和小数部分
|
||||
String[] parts = moneyStr.split("\\.");
|
||||
String integerPartStr = parts[0];
|
||||
String decimalPartStr = parts.length > 1 ? parts[1] : "00";
|
||||
|
||||
// 确保小数部分是两位
|
||||
if (decimalPartStr.length() < 2) {
|
||||
decimalPartStr = String.format("%-2s", decimalPartStr).replace(' ', '0');
|
||||
} else if (decimalPartStr.length() > 2) {
|
||||
decimalPartStr = decimalPartStr.substring(0, 2);
|
||||
}
|
||||
|
||||
// 处理小数部分(角和分)
|
||||
int jiaoDigit = 0, fenDigit = 0;
|
||||
if (decimalPartStr.length() >= 1) jiaoDigit = Character.getNumericValue(decimalPartStr.charAt(0));
|
||||
if (decimalPartStr.length() >= 2) fenDigit = Character.getNumericValue(decimalPartStr.charAt(1));
|
||||
|
||||
// 处理整数部分(各位数值)
|
||||
String reversed = new StringBuilder(integerPartStr).reverse().toString();
|
||||
String[] units = {"元", "十位", "百位", "千位", "万位", "十万位", "百万位"};
|
||||
Map<String, Integer> digits = new HashMap<>();
|
||||
|
||||
for (int i = 0; i < reversed.length(); i++) {
|
||||
if (i >= units.length) break;
|
||||
digits.put(units[i], Character.getNumericValue(reversed.charAt(i)));
|
||||
}
|
||||
|
||||
// 按照one到nine的顺序设置字段(从百万位到分位)
|
||||
Map<String, Object> digitFields = new HashMap<>();
|
||||
|
||||
// one: 百万位
|
||||
digitFields.put("one", digits.getOrDefault("百万位", 0));
|
||||
// two: 十万位
|
||||
digitFields.put("two", digits.getOrDefault("十万位", 0));
|
||||
// three: 万位
|
||||
digitFields.put("three", digits.getOrDefault("万位", 0));
|
||||
// four: 千位
|
||||
digitFields.put("four", digits.getOrDefault("千位", 0));
|
||||
// five: 百位
|
||||
digitFields.put("five", digits.getOrDefault("百位", 0));
|
||||
// six: 十位
|
||||
digitFields.put("six", digits.getOrDefault("十位", 0));
|
||||
// seven: 元位
|
||||
digitFields.put("seven", digits.getOrDefault("元", 0));
|
||||
// eight: 角
|
||||
digitFields.put("eight", jiaoDigit);
|
||||
// nine: 分
|
||||
digitFields.put("nine", fenDigit);
|
||||
|
||||
// 将数字字段添加到info中
|
||||
info.putAll(digitFields);
|
||||
|
||||
|
||||
List<ProcessTaskVO> doneTaskVos = new ArrayList<>();
|
||||
List<ProcessTask> doneTaskList = flowEngine.processTaskService().getDoneTaskList(info.getLong("instanceId"), null);
|
||||
for (ProcessTask doneTask : doneTaskList) {
|
||||
ProcessTaskVO taskVO = flowEngine.processTaskService().findById(doneTask.getId());
|
||||
doneTaskVos.add(taskVO);
|
||||
}
|
||||
|
||||
// 分工会审核
|
||||
doneTaskVos.stream().filter(task -> "分工会审核".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
HashMap<String, Object> approval = new HashMap<>();
|
||||
|
||||
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
approval.put("user", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("fgh", approval);
|
||||
});
|
||||
|
||||
// 协会负责人审核
|
||||
doneTaskVos.stream().filter(task -> "协会负责人审核".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
HashMap<String, Object> approval = new HashMap<>();
|
||||
|
||||
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
approval.put("user", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("xh", approval);
|
||||
});
|
||||
|
||||
// 校工会负责人审核
|
||||
doneTaskVos.stream().filter(task -> "校工会负责人审核".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
HashMap<String, Object> approval = new HashMap<>();
|
||||
|
||||
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
approval.put("user", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("xfzr", approval);
|
||||
});
|
||||
|
||||
// 校工会主席审核
|
||||
doneTaskVos.stream().filter(task -> "校工会主席审核".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
HashMap<String, Object> approval = new HashMap<>();
|
||||
|
||||
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
approval.put("user", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("xzx", approval);
|
||||
});
|
||||
|
||||
String budgetsStr = info.getString("budgets");
|
||||
List<ActivityBudgetVO> list = JSONUtil.parseArray(budgetsStr).toList(ActivityBudgetVO.class);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setRanking(i + 1);
|
||||
}
|
||||
|
||||
docData.put("budgets", list);
|
||||
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
Configure config = Configure.builder()
|
||||
.bind("budgets", policy)
|
||||
.build();
|
||||
|
||||
String fileName = Globals.AppName + "【" + info.getString("activityName") + "】报销凭证表.docx";
|
||||
|
||||
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("activity_reimbursement_voucher"), config).render(docData).writeAndClose(byteArrayOutputStream);
|
||||
CommonDownloadUtil.download(fileName, byteArrayOutputStream.toByteArray(), response);
|
||||
} catch (IOException e) {
|
||||
log.error("报销凭证表导出失败,id:{},错误信息:{}", id, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
+86
-1
@@ -1,11 +1,26 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
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.activity.declarereimbursement.reimbursement.service.ActivityReimbursementService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -15,10 +30,12 @@ import org.nutz.mvc.annotation.Ok;
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("活动申报,校工会负责人审核")
|
||||
@ApiOperation("活动报销,校工会负责人审核")
|
||||
@At("/platform/activityReimbursement/schoolPrincipal")
|
||||
public class ActivityReimbursementSchoolPrincipalController {
|
||||
|
||||
@Inject
|
||||
private ActivityReimbursementService activityReimbursementService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityReimbursement.schoolPrincipal")
|
||||
@@ -31,4 +48,72 @@ public class ActivityReimbursementSchoolPrincipalController {
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/reimbursement/schoolprincipal/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报销,校工会负责人审核列表")
|
||||
@SaCheckPermission("activityReimbursement.schoolPrincipal")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.mobile,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.planStartTime,
|
||||
info.planEndTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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 activity_reimbursement_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
|
||||
cnd.and("t.taskName", "=", "6dd2e8b3-fd0d-4b35-bb2a-1eef227cba96");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityReimbursementService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
}
|
||||
|
||||
+87
-1
@@ -1,11 +1,26 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
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.activity.declarereimbursement.reimbursement.service.ActivityReimbursementService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.vo.CommonPageParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -15,10 +30,13 @@ import org.nutz.mvc.annotation.Ok;
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("活动申报,校工会审核")
|
||||
@ApiOperation("活动报销,校工会审核")
|
||||
@At("/platform/activityReimbursement/schoolUnion")
|
||||
public class ActivityReimbursementSchoolUnionController {
|
||||
|
||||
@Inject
|
||||
private ActivityReimbursementService activityReimbursementService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activityReimbursement.schoolUnion")
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/reimbursement/schoolunion/index.html")
|
||||
@@ -30,4 +48,72 @@ public class ActivityReimbursementSchoolUnionController {
|
||||
@Ok("beetl:/platform/zhgh/activity/declarereimbursement/reimbursement/schoolunion/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("活动报销,校工会审核列表")
|
||||
@SaCheckPermission("activityReimbursement.schoolUnion")
|
||||
public Result pageData(CommonPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.userName,
|
||||
info.mobile,
|
||||
info.loginName,
|
||||
info.applyTime,
|
||||
info.activityName,
|
||||
info.activityAddress,
|
||||
info.planStartTime,
|
||||
info.planEndTime,
|
||||
info.declareUnitName,
|
||||
info.activityType,
|
||||
info.activityContent,
|
||||
info.activityNumber,
|
||||
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 activity_reimbursement_info 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();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
|
||||
cnd.and("t.taskName", "=", "47bfdf53-288c-4352-a403-0653483b54eb");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityReimbursementService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
}
|
||||
|
||||
+28
-1
@@ -1,5 +1,16 @@
|
||||
package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.interceptor;
|
||||
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowInterceptor;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.models.ActivityReimbursementInfo;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.json.Json;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -7,5 +18,21 @@ package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.intercept
|
||||
* @Date 2025/8/1 11:05
|
||||
* @注释
|
||||
*/
|
||||
public class ActivityReimbursementInterceptor {
|
||||
public class ActivityReimbursementInterceptor implements FlowInterceptor {
|
||||
|
||||
@Override
|
||||
public void intercept(Execution execution) {
|
||||
String formDataStr = execution.getArgs().getStr(FlowConst.FORM_DATA);
|
||||
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
ActivityReimbursementInfo reimbursementInfo = Json.fromJson(ActivityReimbursementInfo.class, formDataStr);
|
||||
reimbursementInfo.setDeclareId(reimbursementInfo.getId());
|
||||
// 设置流程变量
|
||||
execution.getArgs().set("type", reimbursementInfo.getActivityType());
|
||||
dao.insertOrUpdate(reimbursementInfo);
|
||||
|
||||
execution.getArgs().set(FlowConst.FORM_DATA, Json.toJson(reimbursementInfo));
|
||||
int instanceId = execution.getArgs().getInt(FlowConst.PROCESS_INSTANCE_ID_KEY);
|
||||
dao.update(ProcessInstance.class, Chain.make("businessNo", reimbursementInfo.getId()), Cnd.where(ProcessInstance::getId, "=", instanceId));
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -5,7 +5,10 @@ import com.budwk.app.zhgh.activity.declarereimbursement.declare.models.ActivityD
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -20,11 +23,32 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActivityReimbursementInfo extends ActivityDeclareInfo {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("申报id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String declareId;
|
||||
|
||||
@Column
|
||||
@Comment("实际总金额")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal actualMoney;
|
||||
|
||||
@Column
|
||||
@Comment("活动开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date startTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date endTime;
|
||||
|
||||
@Column
|
||||
@Comment("发票")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
|
||||
+4
@@ -2,6 +2,7 @@ package com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.models.ActivityReimbursementInfo;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
@@ -11,4 +12,7 @@ import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.models.Act
|
||||
* @注释
|
||||
*/
|
||||
public interface ActivityReimbursementService extends BaseService<ActivityReimbursementInfo> {
|
||||
|
||||
|
||||
Sql getActivityUserNumAndMoneySql(Integer startYear, Integer endYear, Boolean isActivityMoney);
|
||||
}
|
||||
|
||||
+35
@@ -4,6 +4,8 @@ import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.models.ActivityReimbursementInfo;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.reimbursement.service.ActivityReimbursementService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
@@ -18,4 +20,37 @@ public class ActivityReimbursementServiceImpl extends BaseServiceImpl<ActivityRe
|
||||
public ActivityReimbursementServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Sql getActivityUserNumAndMoneySql(Integer startYear, Integer endYear, Boolean isActivityMoney) {
|
||||
if (isActivityMoney) {
|
||||
return Sqls.create("""
|
||||
SELECT
|
||||
SUM(info.actualMoney)
|
||||
FROM
|
||||
activity_reimbursement_info info
|
||||
LEFT JOIN wf_process_instance ins ON info.id = ins.businessNo
|
||||
WHERE
|
||||
ins.state = 30
|
||||
AND info.activityType = @type
|
||||
AND info.`year` >= @startYear
|
||||
AND info.`year` <= @endYear
|
||||
""")
|
||||
.setParam("startYear", startYear).setParam("endYear", endYear);
|
||||
} else {
|
||||
return Sqls.create("""
|
||||
SELECT
|
||||
info.activityNumber AS activityNum
|
||||
FROM
|
||||
activity_reimbursement_info info
|
||||
LEFT JOIN wf_process_instance ins ON info.id = ins.businessNo
|
||||
WHERE
|
||||
ins.state = 30
|
||||
AND info.activityType = @type
|
||||
AND info.`year` >= @startYear
|
||||
AND info.`year` <= @endYear
|
||||
""").setParam("startYear", startYear).setParam("endYear", endYear);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -13,7 +13,9 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("费用预算")
|
||||
public class ActivityBudget {
|
||||
public class ActivityBudgetVO {
|
||||
|
||||
private Integer ranking;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
+4
-5
@@ -5,7 +5,6 @@ import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.declare.models.ActivityDeclareInfo;
|
||||
import com.budwk.app.zhgh.activity.declarereimbursement.enums.ActivityDeclareReimbursement;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
@@ -23,7 +22,7 @@ import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
@Data
|
||||
@ApiModel("通用分页参数")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CommonPageParam extends PageForm<ActivityDeclareInfo> {
|
||||
public class CommonPageParam extends PageForm {
|
||||
|
||||
private Integer year;
|
||||
|
||||
@@ -51,10 +50,10 @@ public class CommonPageParam extends PageForm<ActivityDeclareInfo> {
|
||||
RoleConstant.BRANCH_UNION_ADMIN.name(),
|
||||
RoleConstant.BRANCH_UNION_OPERATOR.name())) {
|
||||
cnd.and(prefix + "unionid", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
|
||||
if (AuthUtil.hasRoleOr(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_PRESIDENT.name())) {
|
||||
} else if (AuthUtil.hasRoleOr(RoleConstant.CLUB_MANAGER.name(), RoleConstant.CLUB_PRESIDENT.name())) {
|
||||
// cnd.and(prefix + "clubId", "=", );
|
||||
} else {
|
||||
cnd.andEX(prefix + "userId", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
} else {
|
||||
cnd.andEX(prefix + "unionId", "=", this.getUnionId());
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class FamilyUserServiceImpl extends BaseServiceImpl<FamilyBlackList> impl
|
||||
u.unionname,
|
||||
tsuc.courseName,
|
||||
tsuu.state,
|
||||
( SELECT count( 1 ) FROM family_user_course WHERE userId = tsuu.userId $var) tourseTotal,
|
||||
( SELECT count( 1 ) FROM family_user_course WHERE userId = tsuu.userId $var) courseTotal,
|
||||
( SELECT count( 1 ) FROM family_user_course WHERE userId = tsuu.userId AND isAttend = 0 and tsuu.state!=2 AND now()> courseEndTime $var) AS absentCount,
|
||||
if(tsubl.isDisabled=1,true,false) isDisabled,
|
||||
group_CONCAT( tsuc.courseName ) AS courseNames
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.constant;
|
||||
|
||||
import com.budwk.app.base.annotation.DictEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/11/18
|
||||
* @Description
|
||||
*/
|
||||
@Getter
|
||||
@DictEnum(key = "ColumnFormTypeEnum", name = "控件类型")
|
||||
@AllArgsConstructor
|
||||
public enum ColumnFormTypeEnum {
|
||||
|
||||
INPUT("INPUT", "输入框"),
|
||||
SELECT("SELECT", "选择框"),
|
||||
//RADIO("RADIO", "单选框"),//选项数组
|
||||
FILE("FILE", "文件");
|
||||
|
||||
private String code;
|
||||
private String description;
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 新建活动
|
||||
* @createTime 2022年03月07日 10:16:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Api(tags = "新建品牌活动")
|
||||
@At("/platform/literacy/manage/activity")
|
||||
public class LiteracyActivityAddController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private LiteracyActivityService literacySignUpActivityManageService;
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ApiOperation("品牌活动新增/修改")
|
||||
@SaCheckPermission("literacy.manage.activity")
|
||||
@SLog(tag = "品牌活动-活动管理", msg = "新增/修改活动")
|
||||
public Result doHandle(LiteracyActivity activity) {
|
||||
if (StrUtil.isBlank(activity.getId())) {
|
||||
literacySignUpActivityManageService.add(activity, null);
|
||||
} else {
|
||||
literacySignUpActivityManageService.edit(activity);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ApiOperation("获取分工会人数限制")
|
||||
@SaCheckPermission("literacy.manage.activity")
|
||||
public Result getUnionLimit(@Param(value = "activityScopeId") String activityScopeId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.name,
|
||||
gh.unioncode,
|
||||
(select count(1) from `vw_user` where unionid = gh.id $cnd) as teacherCount,
|
||||
NULL as ratio,
|
||||
NULL as limitCount
|
||||
FROM
|
||||
sys_union gh
|
||||
order by gh.unioncode
|
||||
""");
|
||||
if (StrUtil.isNotBlank(activityScopeId)) {
|
||||
sql.setVar("cnd", "AND id in (select userId from activity_user_scope where groupId = '" + activityScopeId + "')");
|
||||
}
|
||||
List<NutMap> list = literacySignUpActivityManageService.listMap(sql);
|
||||
return Result.success().addData(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ApiOperation("获取报名人员数量")
|
||||
@SaCheckPermission("literacy.manage.activity")
|
||||
public Result getRegisterUserCount(@Param(value = "courseId") String courseId) {
|
||||
return Result.success().addData(dao.count(LiteracyUser.class, Cnd.where("courseId", "=", courseId)));
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ApiOperation("获取历史活动列表")
|
||||
@SaCheckPermission("literacy.manage.activity")
|
||||
public Result getHistoricalActList() {
|
||||
List<LiteracyActivity> query = dao.query(LiteracyActivity.class, Cnd.NEW().desc("activityStartTime"));
|
||||
return Result.success().addData(query);
|
||||
}
|
||||
}
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivityCourse;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动报名")
|
||||
@At("/platform/literacy/manage/apply")
|
||||
public class LiteracyActivityApplyController {
|
||||
|
||||
@Inject
|
||||
private LiteracyActivityService literacyActivityService;
|
||||
@Inject
|
||||
private SysDictService dictService;
|
||||
@Inject
|
||||
private LiteracyActivityStatisticsService statisticsService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("literacy.manage.apply")
|
||||
@Ok("beetl:/platform/zhgh/activity/literacy/apply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动查询")
|
||||
@SaCheckPermission("literacy.manage.apply")
|
||||
public Result activityData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("`year`", "=", year);
|
||||
//查询报名中
|
||||
if (activityType == 2) {
|
||||
cnd.and(new Static("now() > activitySignUpStartTime and now() < activitySignUpEndTime"));
|
||||
}//查询已结束的
|
||||
else if (activityType == 3) {
|
||||
cnd.and(new Static("now() > activityEndTime"));
|
||||
}
|
||||
|
||||
if (AuthUtil.hasRole("H04") && !AuthUtil.hasRoleOr("sysadmin, A06")) {
|
||||
cnd.and("activityMode", "=", 2).and("createdBy", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
Pagination pagination = literacyActivityService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
List<LiteracyActivity> literacyActivities = pagination.getList();
|
||||
Map<String, String> literacyTypeMap = dictService.getSubListByCode("LITERACY_SIGNUP_TYPE").stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
literacyActivities.forEach(v -> v.setLiteracyType(literacyTypeMap.get(v.getLiteracyType())));
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分活动查询")
|
||||
@SaCheckPermission("literacy.manage.apply")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "courseTypeId") String courseTypeId,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "assortTypes") String[] assortTypes) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.activityId,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseType,
|
||||
tsuc.courseLocationCoordinates,
|
||||
tsuc.courseReservedNumber,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.campus,
|
||||
tsuc.unionLimit,
|
||||
tsuc.isMobileSign,
|
||||
tsuc.signType,
|
||||
tsuc.isReceiveGift,
|
||||
tsuc.giftType,
|
||||
tsuc.reserveMode,
|
||||
tsuc.waitingNum,
|
||||
tsuc.assort,
|
||||
type.typeName,
|
||||
tsuc.courseIsLimitApply
|
||||
FROM
|
||||
`literacy_course` tsuc
|
||||
LEFT JOIN literacy_type type ON type.id = tsuc.courseType
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("type.id", "=", courseTypeId);
|
||||
cnd.and("tsuc.activityId", "=", activityId);
|
||||
if(Lang.isNotEmpty(assortTypes)) {
|
||||
cnd.and("tsuc.assort", "in", assortTypes);
|
||||
}
|
||||
|
||||
List<LiteracyCourse> courseArray = literacyActivityService.dao().query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
courseArray = literacyActivityService.filterCourseByHostUnion(courseArray);
|
||||
cnd.and("tsuc.id", "in", courseArray.stream().map(LiteracyCourse::getId).toList());
|
||||
|
||||
cnd.asc("tsuc.orderNum");
|
||||
cnd.asc("type.code");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = literacyActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
|
||||
courseList.forEach(c -> {
|
||||
c.put("hasRegisterNum", statisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
|
||||
c.put("hasWaitingNum", statisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
|
||||
//当前用户是否报过
|
||||
c.put("isSign", literacyActivityService.isSignCourseByUser(c.getString("id"), SecurityUtil.getUserId()));
|
||||
|
||||
if(StrUtil.isNotBlank(c.getString("unionLimit"))) {
|
||||
List<NutMap> unionLimit = Json.fromJsonAsList(NutMap.class, c.getString("unionLimit"));
|
||||
if(Lang.isNotEmpty(unionLimit)) {
|
||||
NutMap nutMap = unionLimit.stream().filter(o -> o.getString("id").equals(SecurityUtil.getUnionId())).findFirst().orElse(null);
|
||||
if(nutMap != null) {
|
||||
c.put("coursePeopleNumber", nutMap.getInt("limitCount"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取分活动时间")
|
||||
@SaCheckPermission("literacy.manage.apply")
|
||||
public Result getCourseTime(String id) {
|
||||
List<LiteracyActivityCourse> list = literacyActivityService.dao().query(LiteracyActivityCourse.class, Cnd.where("courseId", "=", id));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询分类标识集合")
|
||||
@SaCheckPermission("literacy.manage.apply")
|
||||
public Result queryCourseAssort(String activityId) {
|
||||
List<LiteracyCourse> courseList = literacyActivityService.dao().query(LiteracyCourse.class, Cnd.where(LiteracyCourse::getActivityId, "=", activityId).asc(LiteracyCourse::getOrderNum));
|
||||
if(Lang.isEmpty(courseList)) {
|
||||
return Result.success(new ArrayList<>());
|
||||
}
|
||||
List<String> assortList = courseList.stream().map(LiteracyCourse::getAssort).filter(StrUtil::isNotBlank).toList();
|
||||
return Result.success(assortList);
|
||||
}
|
||||
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.*;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训报名 活动管理
|
||||
* @createTime 2022年02月23日 09:57:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动管理")
|
||||
@At("/platform/literacy/manage/activity")
|
||||
public class LiteracyActivityController {
|
||||
|
||||
@Inject
|
||||
private LiteracyActivityService literacySignUpActivityManageService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("literacy.manage.activity")
|
||||
@Ok("beetl:/platform/zhgh/activity/literacy/manage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("literacy.manage.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityName") String activityName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
cnd.and(Cnd.likeEX("activityName", activityName));
|
||||
cnd.orderBy("createdAt", "desc");
|
||||
return Result.success().addData(literacySignUpActivityManageService.pageData(pageForm, cnd));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动删除")
|
||||
@SaCheckPermission("literacy.manage.activity")
|
||||
@SLog(tag = "品牌活动-活动管理", msg = "删除活动")
|
||||
public Result onDelete(String id) {
|
||||
Trans.exec(() -> {
|
||||
literacySignUpActivityManageService.delete(id);
|
||||
dao.clear(LiteracyCourse.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(LiteracyActivityCourse.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(LiteracyUser.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(LiteracyUserCourse.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(LiteracyActivity.class, Cnd.where("id", "=", id));
|
||||
dao.clear(LiteracyTypeLimit.class, Cnd.where("activityId", "=", id));
|
||||
dao.delete(Sys_home_activity.class, id);
|
||||
});
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动状态变更")
|
||||
@SaCheckPermission("literacy.manage.activity")
|
||||
public Result activityStatusChange(LiteracyActivity activity) {
|
||||
literacySignUpActivityManageService.updateActivityStatus(activity);
|
||||
dao.update(Sys_home_activity.class,
|
||||
Chain.make("enable", !activity.isDisabled()),
|
||||
Cnd.where("id", "=", activity.getId()));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询单个活动")
|
||||
@SaCheckPermission("literacy.manage.activity")
|
||||
public Result findOne(@Param("id") @NotNull String id) {
|
||||
NutMap dataMap = literacySignUpActivityManageService.findOne(id, null, "");
|
||||
String activityStartTime = dataMap.getString("activityStartTime");
|
||||
String activityEndTime = dataMap.getString("activityEndTime");
|
||||
if(StrUtil.isNotBlank(activityStartTime) && StrUtil.isNotBlank(activityEndTime)) {
|
||||
dataMap.put("activityTime", List.of(activityStartTime, activityEndTime));
|
||||
} else {
|
||||
dataMap.put("activityTime", new ArrayList<>());
|
||||
}
|
||||
|
||||
String activitySignUpStartTime = dataMap.getString("activitySignUpStartTime");
|
||||
String activitySignUpEndTime = dataMap.getString("activitySignUpEndTime");
|
||||
if(StrUtil.isNotBlank(activitySignUpStartTime) && StrUtil.isNotBlank(activitySignUpEndTime)) {
|
||||
dataMap.put("activitySignTime", List.of(activitySignUpStartTime, activitySignUpEndTime));
|
||||
} else {
|
||||
dataMap.put("activitySignTime", new ArrayList<>());
|
||||
}
|
||||
|
||||
List<NutMap> courseList = dataMap.getList("courseList", NutMap.class);
|
||||
|
||||
//查询所有的课程类型
|
||||
List<LiteracyType> literacySignUpTypeList = dao.query(LiteracyType.class, Cnd.NEW());
|
||||
Map<String, String> typeMap = literacySignUpTypeList.stream().collect(Collectors.toMap(LiteracyType::getId, LiteracyType::getTypeName));
|
||||
|
||||
courseList.forEach(v -> {
|
||||
|
||||
List<NutMap> courseTimeList = v.getList("courseTimeList", NutMap.class);
|
||||
//选择课程日期 下拉框
|
||||
List<String> setUpCourseData = courseTimeList.stream().map(cd -> cd.getString("courseDate")).distinct().collect(Collectors.toList());
|
||||
v.put("setUpCourseData", setUpCourseData);
|
||||
|
||||
courseTimeList.forEach(ct -> {
|
||||
String courseStartTime = DateUtil.format(ct.getTime("courseStartTime"), "HH:mm");
|
||||
String courseEndTime = DateUtil.format(ct.getTime("courseEndTime"), "HH:mm");
|
||||
ct.put("courseStartTime", courseStartTime);
|
||||
ct.put("courseEndTime", courseEndTime);
|
||||
});
|
||||
|
||||
v.put("courseTypeName", typeMap.get(v.getString("courseType")));
|
||||
});
|
||||
|
||||
return Result.success().addData(dataMap);
|
||||
}
|
||||
|
||||
}
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.annotation.ColType;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/9/22
|
||||
* @Description
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "活动类型管理")
|
||||
@At("/platform/literacy/manage/type")
|
||||
public class LiteracyTypeController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("literacy.manage.type")
|
||||
@Ok("beetl:/platform/zhgh/activity/literacy/type/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("literacy.manage.type")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "typeName") String typeName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
select * from literacy_type $condition
|
||||
""");
|
||||
if (Strings.isNotBlank(typeName)) {
|
||||
cnd.and("typeName", "like", "%" + typeName + "%");
|
||||
}
|
||||
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.asc("xh");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
Cnd c = Cnd.NEW();
|
||||
c.and("typeId", "=", item.getString("id"));
|
||||
c.asc("columnIndex");
|
||||
List<LiteracyMobileSignColumn> signColumns = dao.query(LiteracyMobileSignColumn.class, c);
|
||||
item.put("literacyMobileSignColumnList", signColumns);
|
||||
|
||||
});
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型新增")
|
||||
@SaCheckPermission("literacy.manage.type")
|
||||
@SLog(tag = "品牌活动-类型管理", msg = "活动类型新增")
|
||||
public Result doAdd(@Param("data") String data) throws Exception {
|
||||
LiteracyType type = Json.fromJson(LiteracyType.class, data);
|
||||
int count = dao.count(LiteracyType.class, Cnd.where("code", "=", type.getCode()));
|
||||
if (count > 0) {
|
||||
return Result.error("编码重复!");
|
||||
}
|
||||
int totalCount = dao.count(LiteracyType.class);
|
||||
type.setXh(totalCount + 1);
|
||||
dao.insertWith(type, "literacyMobileSignColumnList");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型修改")
|
||||
@SaCheckPermission("literacy.manage.type")
|
||||
@SLog(tag = "品牌活动-类型管理", msg = "活动类型修改")
|
||||
public Result doEdit(LiteracyType type) {
|
||||
int count = dao.count(LiteracyType.class, Cnd.where("code", "=", type.getCode()).and("id", "!=", type.getId()));
|
||||
if (count > 0) {
|
||||
return Result.error("编码重复!");
|
||||
}
|
||||
dao.update(type);
|
||||
dao.clear(LiteracyMobileSignColumn.class, Cnd.where("typeId", "=", type.getId()));
|
||||
dao.insertLinks(type, "literacyMobileSignColumnList");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("活动类型删除")
|
||||
@SaCheckPermission("literacy.manage.type")
|
||||
@SLog(tag = "品牌活动-类型管理", msg = "活动类型删除")
|
||||
public Object doDelete(@Param(value = "id") String id) {
|
||||
dao.clear(LiteracyType.class, Cnd.where("id", "=", id));
|
||||
dao.clear(LiteracyMobileSignColumn.class, Cnd.where("typeId", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("排序号变更")
|
||||
@SaCheckPermission("literacy.manage.type")
|
||||
public Object xhChange(String id, Integer xh, boolean toDown) {
|
||||
if (toDown) {
|
||||
LiteracyType next = dao.fetch(LiteracyType.class, Cnd.where("xh", "=", xh + 1));
|
||||
next.setXh(next.getXh() - 1);
|
||||
dao.update(next);
|
||||
dao.update(LiteracyType.class, Chain.make("xh", xh + 1), Cnd.where("id", "=", id));
|
||||
} else {
|
||||
LiteracyType pre = dao.fetch(LiteracyType.class, Cnd.where("xh", "=", xh - 1));
|
||||
pre.setXh(pre.getXh() + 1);
|
||||
dao.update(pre);
|
||||
dao.update(LiteracyType.class, Chain.make("xh", xh - 1), Cnd.where("id", "=", id));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取所有类型")
|
||||
@SaCheckLogin
|
||||
public Result getAllType(@Param(value = "id") String id) {
|
||||
List<LiteracyType> literacyTypeList = dao.query(LiteracyType.class, Cnd.NEW().andEX("id", "=", id).asc("xh"));
|
||||
dao.fetchLinks(literacyTypeList, "literacyMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
return Result.success().addData(literacyTypeList);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("自定义表单字段类型")
|
||||
@SaCheckPermission("literacy.manage.type")
|
||||
public Result getColumnType() {
|
||||
List<String> names = EnumUtil.getNames(ColType.class);
|
||||
names.add("JSON");
|
||||
return Result.success(names);
|
||||
}
|
||||
}
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivityCourse;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUserCourse;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/9/21
|
||||
* @Description 人员调整
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "品牌活动人员调整")
|
||||
@At("/platform/literacy/manage/userAdjust")
|
||||
public class LiteracyUserAdjustController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private LiteracyActivityService literacyActivityManageService;
|
||||
@Inject
|
||||
private LiteracyActivityStatisticsService literacyActivityStatisticsService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("literacy.manage.activity.adjust")
|
||||
@Ok("beetl:/platform/zhgh/activity/literacy/userAdjust/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动list
|
||||
* @param year 年度
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("活动列表")
|
||||
@SaCheckPermission("literacy.manage.activity.adjust")
|
||||
public Result activityList(@Param(value = "year") Integer year) {
|
||||
List<LiteracyActivity> activityList = dao.query(LiteracyActivity.class, Cnd.NEW().andEX("year", "=", year).andEX("isDisabled", "=", false).desc("activityStartTime"));
|
||||
return Result.success(activityList);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("literacy.manage.activity.adjust")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Pagination pagination = literacyActivityStatisticsService.pageData(pageForm, activityId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("子活动查询")
|
||||
@SaCheckPermission("literacy.manage.activity.adjust")
|
||||
public Result getCourse(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseType,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.courseReservedNumber,
|
||||
tsuc.waitingNum,
|
||||
tsuc.reserveMode
|
||||
FROM
|
||||
`literacy_course` tsuc
|
||||
WHERE
|
||||
tsuc.activityId = @activityId
|
||||
ORDER BY courseName asc
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
List<NutMap> courseList = baseService.listMap(sql);
|
||||
courseList.forEach(c -> {
|
||||
c.put("registerNum", literacyActivityStatisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
|
||||
c.put("hasWaitingNum", literacyActivityStatisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
|
||||
});
|
||||
return Result.success(courseList);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("报名用户列表")
|
||||
@SaCheckPermission("literacy.manage.activity.adjust")
|
||||
public Result registerUserList(@Param("courseId") String courseId,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "searchName") String searchName,
|
||||
@Param(value = "searchKeyword") String searchKeyword) {
|
||||
List<NutMap> list = literacyActivityStatisticsService.registerUserList(courseId, unionId, unitId, searchName, searchKeyword);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("人员调整")
|
||||
@SaCheckPermission("literacy.manage.activity.adjust")
|
||||
@SLog(tag = "品牌活动-人员调整", msg = "人员调整")
|
||||
public Result adjust(String activityId, String oldCourseId, String newCourseId, String userId) {
|
||||
|
||||
Cnd oldCnd = Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", oldCourseId).and("userId", "=", userId);
|
||||
|
||||
Cnd newCnd = Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", newCourseId).and("userId", "=", userId);
|
||||
|
||||
//旧的报名信息
|
||||
LiteracyUser oldliteracyUser = dao.fetch(LiteracyUser.class, oldCnd);
|
||||
oldliteracyUser.setCourseId(newCourseId);
|
||||
oldliteracyUser.setSignUpTime(DateUtil.date());
|
||||
dao.update(oldliteracyUser);
|
||||
|
||||
//新的课程的信息,上课时间
|
||||
List<LiteracyActivityCourse> activityCourseList = dao.query(LiteracyActivityCourse.class, Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", newCourseId));
|
||||
//先清楚旧的信息
|
||||
dao.clear(LiteracyUserCourse.class, oldCnd);
|
||||
//添加新的信息
|
||||
List<LiteracyUserCourse> literacyUserCourseList = new ArrayList<>();
|
||||
activityCourseList.forEach(item -> {
|
||||
LiteracyUserCourse course = new LiteracyUserCourse();
|
||||
course.setActivityCourseId(activityId);
|
||||
course.setCourseId(newCourseId);
|
||||
course.setUserId(userId);
|
||||
course.setCourseStartTime(item.getCourseStartTime());
|
||||
course.setCourseEndTime(item.getCourseEndTime());
|
||||
course.setActivityCourseId(item.getId());
|
||||
literacyUserCourseList.add(course);
|
||||
});
|
||||
dao.insert(literacyUserCourseList);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除报名人员")
|
||||
@SaCheckPermission("literacy.manage.activity.adjust")
|
||||
@SLog(tag = "品牌活动-人员调整", msg = "删除报名人员")
|
||||
public Result deleteSignUser(String activityId, String courseId, String userId) {
|
||||
|
||||
//删除
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("activityId", "=", activityId);
|
||||
cnd.and("courseId", "=", courseId);
|
||||
cnd.and("userId", "=", userId);
|
||||
|
||||
dao.clear(LiteracyUser.class, cnd);
|
||||
dao.clear(LiteracyUserCourse.class, cnd);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+347
@@ -0,0 +1,347 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.controller.manage;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyBlackListService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 人员管理
|
||||
* @createTime 2022年03月07日 14:27:00
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "亲子活动人员黑名单")
|
||||
@At("/platform/literacy/userManage")
|
||||
public class LiteracyUserBlackListManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private LiteracyBlackListService literacyBlackListService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("literacy.user.activity")
|
||||
@Ok("beetl:/platform/zhgh/activity/literacy/userManage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("literacy.user.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "courseId") String courseId,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "userKeyWord") String userKeyWord) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tsuu.activityId", "=", activityId);
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
cnd.andEX("act.year", "=", year);
|
||||
if (StrUtil.isNotBlank(userKeyWord)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
cnd.and(seg.andLike("u.username", userKeyWord).orLike("u.loginname", userKeyWord));
|
||||
}
|
||||
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
Pagination pagination = literacyBlackListService.pageData(pageForm, cnd, activityId, courseId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("报名人员处理")
|
||||
@SaCheckPermission("literacy.user.activity")
|
||||
@SLog(tag = "品牌活动-人员管理", msg = "报名人员处理")
|
||||
public Result doHandleUser(@Param("userId") String userId) {
|
||||
literacyBlackListService.doHandleUser(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("根据活动Id获取子活动")
|
||||
@SaCheckPermission("literacy.user.activity")
|
||||
public Result getCourseByActivityId(@Param("activityId") String activityId) {
|
||||
List<LiteracyCourse> list = dao.query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取子活动具体时间")
|
||||
@SaCheckPermission("literacy.user.activity")
|
||||
public Result attendClassRecord(String userId) {
|
||||
literacyBlackListService.attendClassRecord(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取候补人员")
|
||||
@SaCheckPermission("literacy.user.activity")
|
||||
public Result getReserveUser(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.* ,
|
||||
(select signUpTime from literacy_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as signUpTime,
|
||||
(select state from literacy_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as state,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile,
|
||||
u.unitName,
|
||||
u.unionName
|
||||
FROM
|
||||
literacy_user_course uc LEFT JOIN `vw_user` u on uc.userId = u.id
|
||||
WHERE uc.courseId = @courseId and uc.isAttend = false HAVING state = 2 order by signUpTime desc
|
||||
""").setParam("courseId", courseId);
|
||||
return Result.success(literacyBlackListService.listMap(sql));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("补充人员")
|
||||
@SaCheckPermission("literacy.user.activity")
|
||||
@SLog(tag = "品牌活动-人员管理", msg = "补充人员")
|
||||
public Result reserveSingUp(String[] ids, String courseId) {
|
||||
//先查询这个课程有多少个未签到的人员
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.* ,
|
||||
(select signUpTime from literacy_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as signUpTime,
|
||||
(select state from literacy_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as state
|
||||
FROM
|
||||
literacy_user_course uc
|
||||
WHERE uc.courseId = @courseId and uc.isAttend = false HAVING state = 1 order by signUpTime desc
|
||||
""").setParam("courseId", courseId);
|
||||
List<NutMap> list = literacyBlackListService.listMap(sql);
|
||||
if(ids.length > list.size()) {
|
||||
return Result.error("您选择了" + ids.length + "位,未签到人员只有" + list.size() + "位");
|
||||
}
|
||||
//ids的长度为几,就搞几个
|
||||
List<NutMap> mapList = list.subList(0, ids.length);
|
||||
List<String> idList = mapList.stream().map(o -> o.getString("userId")).collect(Collectors.toList());
|
||||
//将这几个没签到的设置为4
|
||||
dao.update(LiteracyUser.class, Chain.make("state", 4), Cnd.where("courseId", "=", courseId)
|
||||
.and("userId", "in", idList));
|
||||
//将补充的设置为1
|
||||
dao.update(LiteracyUser.class, Chain.make("state", 1), Cnd.where("courseId", "=", courseId)
|
||||
.and("userId", "in", ids));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出签到人员")
|
||||
public void exportSignPerson(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) {
|
||||
LiteracyActivity activity = dao.fetch(LiteracyActivity.class, activityId);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.*,
|
||||
DATE_FORMAT(uc.courseStartTime, '%Y-%m-%d %H:%i:%s') as courseStartTimeExcel,
|
||||
DATE_FORMAT(uc.courseEndTime, '%Y-%m-%d %H:%i:%s') as courseEndTimeExcel,
|
||||
DATE_FORMAT(uc.attendTime, '%Y-%m-%d %H:%i:%s') as attendTimeExcel,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
u.sex
|
||||
FROM
|
||||
literacy_user_course uc
|
||||
left join literacy_course course on uc.courseId = course.id
|
||||
left join `vw_user` u on u.id = uc.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("uc.activityId", "=", activityId);
|
||||
cnd.and("course.isMobileSign", "=", true);
|
||||
cnd.desc("isAttend").desc("attendTime");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> userList = literacyBlackListService.listMap(sql);
|
||||
|
||||
List<LiteracyCourse> courseList = dao.query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("开始时间", "courseStartTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("结束时间", "courseEndTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("是否签到", "isAttend", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("签到时间", "attendTimeExcel", 22));
|
||||
|
||||
for (LiteracyCourse c : courseList) {
|
||||
String courseId = c.getId();
|
||||
String courseName = c.getCourseName();
|
||||
List<NutMap> v = userList.stream().filter(x -> x.getString("courseId").equals(courseId)).collect(Collectors.toList());
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setSheetName(courseName);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>(excelCommonExportEntity);
|
||||
for (NutMap userSignData : v) {
|
||||
if(!userSignData.getBoolean("isAttend")) {
|
||||
userSignData.put("isAttend", "未签到");
|
||||
userSignData.put("attendTimeExcel", "未签到");
|
||||
}else {
|
||||
userSignData.put("isAttend", "已签到");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> userExportMap = new HashMap<>();
|
||||
userExportMap.put("name", courseName);
|
||||
userExportMap.put("title", userExportParams);
|
||||
userExportMap.put("entity", currentEntities);
|
||||
userExportMap.put("data", v);
|
||||
|
||||
sheetsList.add(userExportMap);
|
||||
}
|
||||
try {
|
||||
String fileName = activity.getActivityName() + "签到人员名单.xls";
|
||||
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", disposition);
|
||||
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
for (Map<String, Object> map : sheetsList) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
service.createSheetForMap(workbook,(ExportParams) map.get("title"),(List<ExcelExportEntity>) map.get("entity"),(Collection<?>) map.get("data"));
|
||||
}
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出领取人员")
|
||||
public void exportGiftPerson(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) {
|
||||
LiteracyActivity activity = dao.fetch(LiteracyActivity.class, activityId);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.*,
|
||||
DATE_FORMAT(uc.courseStartTime, '%Y-%m-%d %H:%i:%s') as courseStartTimeExcel,
|
||||
DATE_FORMAT(uc.courseEndTime, '%Y-%m-%d %H:%i:%s') as courseEndTimeExcel,
|
||||
DATE_FORMAT(uc.receiveTime, '%Y-%m-%d %H:%i:%s') as receiveTimeExcel,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
u.sex
|
||||
FROM
|
||||
literacy_user_course uc
|
||||
left join literacy_course course on uc.courseId = course.id
|
||||
left join `vw_user` u on u.id = uc.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("uc.activityId", "=", activityId);
|
||||
cnd.and("course.isReceiveGift", "=", true).and("course.giftType" ,"=", 1);
|
||||
cnd.desc("isReceive").desc("receiveTime");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> userList = literacyBlackListService.listMap(sql);
|
||||
|
||||
List<LiteracyCourse> courseList = dao.query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("开始时间", "courseStartTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("结束时间", "courseEndTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("是否领取", "isReceive", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("领取时间", "receiveTimeExcel", 22));
|
||||
|
||||
for (LiteracyCourse c : courseList) {
|
||||
String courseId = c.getId();
|
||||
String courseName = c.getCourseName();
|
||||
List<NutMap> v = userList.stream().filter(x -> x.getString("courseId").equals(courseId)).collect(Collectors.toList());
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setSheetName(courseName);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>(excelCommonExportEntity);
|
||||
for (NutMap userSignData : v) {
|
||||
if(!userSignData.getBoolean("isReceive")) {
|
||||
userSignData.put("isReceive", "未领取");
|
||||
userSignData.put("receiveTimeExcel", "未领取");
|
||||
}else {
|
||||
userSignData.put("isReceive", "已领取");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> userExportMap = new HashMap<>();
|
||||
userExportMap.put("name", courseName);
|
||||
userExportMap.put("title", userExportParams);
|
||||
userExportMap.put("entity", currentEntities);
|
||||
userExportMap.put("data", v);
|
||||
|
||||
sheetsList.add(userExportMap);
|
||||
}
|
||||
try {
|
||||
String fileName = activity.getActivityName() + "礼品领取人员名单.xls";
|
||||
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", disposition);
|
||||
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
for (Map<String, Object> map : sheetsList) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
service.createSheetForMap(workbook,(ExportParams) map.get("title"),(List<ExcelExportEntity>) map.get("entity"),(Collection<?>) map.get("data"));
|
||||
}
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+373
@@ -0,0 +1,373 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.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.literacy.models.*;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
|
||||
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/literacyActivity")
|
||||
public class MLiteracyActivityController {
|
||||
|
||||
private static final String REDIS_KEY_PREFIX = "m_literacy_activity";
|
||||
private final ReentrantLock lock = new ReentrantLock(true);
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private LiteracyActivityService literacyActivityService;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
@Inject
|
||||
private LiteracyActivityStatisticsService statisticsService;
|
||||
|
||||
@At("/literacyList")
|
||||
@Ok("beetl:/platform/zhghh5/activity/literacy/literacyList/index.html")
|
||||
@SaCheckPermission("h5.literacy.sign")
|
||||
public void literacyList() {
|
||||
}
|
||||
|
||||
@At("/literacyInfo")
|
||||
@Ok("beetl:/platform/zhghh5/activity/literacy/literacyInfo/index.html")
|
||||
@SaCheckPermission("h5.literacy.sign")
|
||||
public void literacyInfo() {
|
||||
}
|
||||
|
||||
@At("/activityInfo")
|
||||
@Ok("beetl:/platform/zhghh5/activity/literacy/activityInfo/index.html")
|
||||
@SaCheckPermission("h5.literacy.sign")
|
||||
public void activityInfo() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("h5.literacy.sign")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityStatus") int activityStatus,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType) {
|
||||
Pagination pagination = literacyActivityService.mPageData(pageForm, year, activityStatus, activityType);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id 活动id
|
||||
* @param tabIndex 0全部 1我的
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("查询单个活动")
|
||||
@SaCheckPermission("h5.literacy.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<LiteracyUser> mySignCourseList = dao.query(LiteracyUser.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("activityId", "=", id));
|
||||
List<String> mySignCourseIdList = mySignCourseList.stream().map(LiteracyUser::getCourseId).collect(Collectors.toList());
|
||||
cnd.and("id", "in", mySignCourseIdList);
|
||||
}
|
||||
NutMap nutMap = literacyActivityService.findOne(id, cnd, fromMode);
|
||||
List<LiteracyCourse> courseList = nutMap.getAsList("courseList", LiteracyCourse.class);
|
||||
courseList.forEach(v -> {
|
||||
if (v.getCourseIsLimitApply() != null && v.getCourseIsLimitApply() && v.getIsSign()) {
|
||||
LiteracyActivityCourse course = dao.fetch(LiteracyActivityCourse.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.literacy.sign")
|
||||
public Object getCourseTimeSelectList(String courseId) {
|
||||
// 查课程的时间段
|
||||
List<LiteracyActivityCourse> courseList = dao.query(LiteracyActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
|
||||
// 查课程的报名人数
|
||||
List<LiteracyUserCourse> applyUserList = dao.query(LiteracyUserCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
// 按照课程下面时间段去分组
|
||||
Map<String, List<LiteracyUserCourse>> collectMap = applyUserList.stream().collect(Collectors.groupingBy(LiteracyUserCourse::getActivityCourseId));
|
||||
List<NutMap> list = courseList.stream().map(v -> {
|
||||
String id = v.getId();
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
List<LiteracyUserCourse> literacyUserCourses = collectMap.get(id);
|
||||
int remainingNum = v.getCourseLimitNum() != null ? v.getCourseLimitNum() : 0;
|
||||
if (Lang.isNotEmpty(literacyUserCourses)) {
|
||||
remainingNum = v.getCourseLimitNum() - literacyUserCourses.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.literacy.sign")
|
||||
@SLog(tag = "品牌活动-活动报名", msg = "活动报名")
|
||||
public Result doSignUp(LiteracyUser literacyUser) {
|
||||
try {
|
||||
lock.lock();
|
||||
boolean courseByUser = literacyActivityService.isSignCourseByUser(literacyUser.getCourseId(), SecurityUtil.getUserId());
|
||||
if(courseByUser) {
|
||||
return Result.error("您已报过该活动");
|
||||
}
|
||||
//判断人数
|
||||
int number = 0;
|
||||
LiteracyCourse course = literacyActivityService.dao().fetch(LiteracyCourse.class, literacyUser.getCourseId());
|
||||
LiteracyType type = literacyActivityService.dao().fetch(LiteracyType.class, course.getCourseType());
|
||||
if(type != null) {
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mobileColumnsValue = literacyUser.getMobileColumnsValue();
|
||||
NutMap map = mobileColumnsValue.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
number = map != null ? map.getInt("columnValue") : 0;
|
||||
}
|
||||
}
|
||||
boolean signFull = literacyActivityService.isSignFull(course, number);
|
||||
if(signFull) {
|
||||
return Result.error("当前报名人数已满");
|
||||
}
|
||||
boolean signFullByUnionId = literacyActivityService.isSignFullByUnionId(course, number);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error("该活动您所在的分工会名额不足");
|
||||
}
|
||||
literacyActivityService.doSignUp(literacyUser);
|
||||
return Result.success("报名成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.success("报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("取消报名")
|
||||
@SaCheckPermission("h5.literacy.sign")
|
||||
@SLog(tag = "品牌活动-活动报名", msg = "取消报名")
|
||||
public Result cancelSignUp(@Param("activityId") String activityId, @Param("courseId") String courseId) {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
//取消分两种情况
|
||||
//第一种没有设置分工会人数限制,那么将候补的人按时间倒叙往上补
|
||||
//第二种如果设置了分工会人数限制,那么只将本分工会的候补人员按照时间倒叙往上补,如果本分工会没有候补人员,则名额空出来,由校工会手动调整
|
||||
LiteracyActivity activity = dao.fetch(LiteracyActivity.class, activityId);
|
||||
LiteracyCourse course = dao.fetch(LiteracyCourse.class, courseId);
|
||||
LiteracyType type = dao.fetch(LiteracyType.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<LiteracyUser> signUpUsers = dao.query(LiteracyUser.class, cnd);
|
||||
int thisSignUpUserCount = dao.count(LiteracyUser.class,
|
||||
Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId)
|
||||
.and("state", "in", List.of(1, 3)));
|
||||
if (!signUpUsers.isEmpty() && thisSignUpUserCount > 0) {
|
||||
LiteracyUser literacyUser = signUpUsers.get(0);
|
||||
literacyUser.setState(1);
|
||||
dao.update(literacyUser);
|
||||
Sys_user user = dao.fetch(Sys_user.class, literacyUser.getUserId());
|
||||
//msgApi.sendTextMsg("【" + activity.getActivityName() + "】已候补成功,请按时参加活动!", user.getLoginname());
|
||||
}
|
||||
}
|
||||
//删除报名记录
|
||||
dao.clear("literacy_user_course", Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId));
|
||||
|
||||
dao.clear("literacy_user", Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("签到")
|
||||
@SaCheckPermission("h5.literacy.sign")
|
||||
@SLog(tag = "品牌活动-活动报名", msg = "签到")
|
||||
public Result doQd(@Param("id") String id, @Param("courseId") String courseId, @Param("point") Double[] points) {
|
||||
LiteracyCourse course = dao.fetch(LiteracyCourse.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("请到签到点位附近签到");
|
||||
// }
|
||||
// }
|
||||
literacyActivityService.doQd(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到信息
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("获取签到信息")
|
||||
@SaCheckPermission("h5.literacy.sign")
|
||||
public Result getQdInfoList(@Param("activityId") String activityId) {
|
||||
List<NutMap> list = literacyActivityService.qdInfoByUserId(SecurityUtil.getUserId(), activityId);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("验证是否能报名")
|
||||
@SaCheckPermission("h5.literacy.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;
|
||||
LiteracyCourse course = dao.fetch(LiteracyCourse.class, courseId);
|
||||
LiteracyActivity activity = dao.fetch(LiteracyActivity.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 = literacyActivityService.isSignCourseByUser(courseId, SecurityUtil.getUserId());
|
||||
if(courseByUser) {
|
||||
return Result.error("抱歉,您已经报名");
|
||||
}
|
||||
|
||||
//判断活动人数
|
||||
boolean signFull = literacyActivityService.isSignFull(course, currentFamilyNumber);
|
||||
if(signFull) {
|
||||
return Result.error("名额剩余数量不足");
|
||||
}
|
||||
|
||||
//判断活动限制
|
||||
boolean signCourse = literacyActivityService.isSignCourse(course, activity);
|
||||
if(!signCourse) {
|
||||
if(activity.getRestrictLimit() != 3) {
|
||||
return Result.error("您选择的类型已达上限,不能再报该类型的了");
|
||||
} else {
|
||||
return Result.error(activity.getActivityName() + "限制报" + activity.getLimitNum() + "个活动,已达上限");
|
||||
}
|
||||
}
|
||||
|
||||
//判断分工会人数限制
|
||||
boolean signFullByUnionId = literacyActivityService.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.literacy.sign")
|
||||
public Object validateSourceSignUp(String activityCourseId, String courseId) {
|
||||
try {
|
||||
lock.lock();
|
||||
// 该时间段下已报名的人数
|
||||
int count = dao.count(LiteracyUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId)
|
||||
.and("courseId", "=", courseId));
|
||||
// 获取改时间段下的活动课程限制报名人数
|
||||
LiteracyActivityCourse course = dao.fetch(LiteracyActivityCourse.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.literacy.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(LiteracyUserCourse.class, Chain.make("isAttend", true)
|
||||
.add("attendTime", new Date()), Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.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/literacyActivityScannerQrCode")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MLiteracyActivityScannerQrCodeController {
|
||||
|
||||
/*@Inject
|
||||
private WxTokenUtil;
|
||||
|
||||
@Inject
|
||||
private literacyActivityService literacyActivityService;
|
||||
|
||||
@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 literacy_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 literacy_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 literacy_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap signInfo = literacyActivityService.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(literacyUserCourse.class, chain, Cnd.where("id", "=", signId));
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from literacy_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap signInfo = literacyActivityService.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(literacyUserCourse.class, chain, Cnd.where("id", "=", signId));
|
||||
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from literacy_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap signInfo = literacyActivityService.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);
|
||||
}*/
|
||||
|
||||
}
|
||||
+254
@@ -0,0 +1,254 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.controller.statistics;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import com.budwk.app.sys.utils.SysFileMinIoUtil;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyType;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训报名 统计
|
||||
* @createTime 2022年02月23日 09:57:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "品牌活动统计")
|
||||
@At("/platform/literacy/statistics/activity")
|
||||
public class LiteracyActivityStatisticsController {
|
||||
|
||||
@Inject
|
||||
private LiteracyActivityService literacyActivityManageService;
|
||||
@Inject
|
||||
private LiteracyActivityStatisticsService literacyActivityStatisticsService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("literacy.statistics.activity")
|
||||
@Ok("beetl:/platform/zhgh/activity/literacy/statistics/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("literacy.statistics.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Pagination pagination = literacyActivityStatisticsService.pageData(pageForm, activityId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动list
|
||||
*
|
||||
* @param year 年度
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("活动列表")
|
||||
@SaCheckPermission("literacy.statistics.activity")
|
||||
public Result activityList(@Param(value = "year") Integer year) {
|
||||
List<LiteracyActivity> list = dao.query(LiteracyActivity.class, Cnd.NEW().andEX("year", "=", year).desc("activityStartTime"));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班报名人员list
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("报名人员列表")
|
||||
@SaCheckPermission("literacy.statistics.activity")
|
||||
public Result registerUserList(@Param(value = "courseId") String courseId) {
|
||||
return Result.success(literacyActivityStatisticsService.registerUserList(courseId));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("报名动态列")
|
||||
@SaCheckPermission("literacy.statistics.activity")
|
||||
public Object getTaleColumnInfo(@Param(value = "courseId") String courseId) {
|
||||
return Result.success(literacyActivityStatisticsService.getTaleColumnInfo(courseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班上课签到信息
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("获取签到信息")
|
||||
@SaCheckPermission("literacy.statistics.activity")
|
||||
public Result getSignInfo(@Param("courseId") String courseId) {
|
||||
return Result.success(literacyActivityStatisticsService.getSignInfo(courseId));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("开放报名")
|
||||
@SaCheckPermission("literacy.statistics.activity")
|
||||
public Result signChange(@Param("courseId") String courseId, @Param("openOtherUnion") Boolean openOtherUnion) {
|
||||
dao.update(LiteracyCourse.class, Chain.make("openOtherUnion", openOtherUnion)
|
||||
, Cnd.where("id", "=", courseId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出签到名单")
|
||||
@SaCheckPermission("literacy.statistics.activity")
|
||||
public void exportSignUser(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
LiteracyActivity activity = dao.fetch(LiteracyActivity.class, activityId);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ts.*,
|
||||
CONCAT(DATE_FORMAT(ac.courseStartTime, '%H:%i:%s'),'至',DATE_FORMAT(ac.courseEndTime, '%H:%i:%s')) AS courseTime,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
ifnull(ts.mobile, u.mobile) as mobile,
|
||||
u.birthday,
|
||||
tsc.courseName
|
||||
FROM
|
||||
literacy_user ts
|
||||
left join literacy_activity_course ac on ts.activityCourseId = ac.id
|
||||
left join `vw_user` u on u.id = ts. userId
|
||||
left join literacy_course tsc on tsc.id = ts.courseId
|
||||
WHERE
|
||||
ts.activityId = @activityId
|
||||
""").setParam("activityId", activityId);
|
||||
List<NutMap> userList = literacyActivityManageService.listMap(sql);
|
||||
|
||||
List<LiteracyCourse> courseList = dao.query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
List<LiteracyType> literacyTypeList = dao.query(LiteracyType.class, Cnd.NEW());
|
||||
dao.fetchLinks(literacyTypeList, "literacyMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
Map<String, LiteracyType> typeMap = literacyTypeList.stream().collect(Collectors.toMap(LiteracyType::getId, o -> o));
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("手机号", "mobile", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("生日", "birthday", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("报名时段", "courseTime", 20));
|
||||
|
||||
for (LiteracyCourse c : courseList) {
|
||||
String k = c.getCourseName();
|
||||
List<NutMap> v = userList.stream().filter(x -> x.getString("courseName").equals(k)).collect(Collectors.toList());
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setSheetName(k);
|
||||
userExportParams.setType(ExcelType.HSSF);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>();
|
||||
currentEntities.addAll(excelCommonExportEntity);
|
||||
|
||||
LiteracyType signUpType = typeMap.get(c.getCourseType());
|
||||
if (Lang.isNotEmpty(signUpType.getLiteracyMobileSignColumnList())) {
|
||||
for (LiteracyMobileSignColumn column : signUpType.getLiteracyMobileSignColumnList()) {
|
||||
ExcelExportEntity entity = new ExcelExportEntity();
|
||||
entity.setName(column.getColumnName());
|
||||
entity.setKey(column.getColumnCode());
|
||||
entity.setWidth(20);
|
||||
if (column.getColumnFormType().equals("FILE")) {
|
||||
entity.setType(2);
|
||||
entity.setExportImageType(2);
|
||||
}
|
||||
currentEntities.add(entity);
|
||||
}
|
||||
}
|
||||
for (NutMap userSignData : v) {
|
||||
String mobileColumnsValueStr = userSignData.getString("mobileColumnsValue");
|
||||
if (StrUtil.isNotBlank(mobileColumnsValueStr)) {
|
||||
List<NutMap> mobileColumnsValue = Json.fromJsonAsList(NutMap.class, mobileColumnsValueStr);
|
||||
for (NutMap cv : mobileColumnsValue) {
|
||||
if (!"FILE".equals(cv.getString("columnFormType"))) {
|
||||
userSignData.put(cv.getString("columnCode"), cv.getString("columnValue"));
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(cv.getString("columnValue"))) {
|
||||
List<JSONObject> columnValue = Json.fromJsonAsList(JSONObject.class, cv.getString("columnValue"));
|
||||
if (columnValue.size() == 1) {
|
||||
JSONObject sysFile = columnValue.get(0);
|
||||
Sys_file file = dao.fetch(Sys_file.class, Cnd.where(Sys_file::getDownloadPath, "=", sysFile.get("url")));
|
||||
byte[] imageBytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath());
|
||||
if (imageBytes.length > 0) {
|
||||
userSignData.put(cv.getString("columnCode"), imageBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> userExportMap = new HashMap<>();
|
||||
userExportMap.put("name", k);
|
||||
userExportMap.put("title", userExportParams);
|
||||
userExportMap.put("entity", currentEntities);
|
||||
userExportMap.put("data", v);
|
||||
|
||||
sheetsList.add(userExportMap);
|
||||
}
|
||||
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
for (Map<String, Object> map : sheetsList) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
service.createSheetForMap(workbook, (ExportParams) map.get("title"), (List<ExcelExportEntity>) map.get("entity"), (Collection<?>) map.get("data"));
|
||||
}
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
|
||||
CommonDownloadUtil.download(activity.getActivityName() + "报名人员名单" + ".xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.services.SysHomeConvert;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训报名活动
|
||||
* @createTime 2022年02月23日 08:57:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LiteracyActivity extends BaseModel implements Serializable, SysHomeConvert {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("活动名称")
|
||||
private String activityName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("年度")
|
||||
private Integer year;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动报名开始时间")
|
||||
private Date activitySignUpStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动报名开始时间")
|
||||
private Date activitySignUpEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动开始时间")
|
||||
private Date activityStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动结束时间")
|
||||
private Date activityEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否禁用")
|
||||
private boolean isDisabled;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "longtext")
|
||||
@Comment("活动介绍")
|
||||
private String introduce;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
@Comment("活动限制标识")
|
||||
private Integer restrictLimit;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
@Comment("活动限制报名个数")
|
||||
private Integer limitNum;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("活动封面")
|
||||
private String cover;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("微信群二维码")
|
||||
private String wechat;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("上课前是否通知")
|
||||
private boolean notice;
|
||||
|
||||
@Column
|
||||
@Comment("活动范围Id")
|
||||
@ColDefine(type = ColType.INT, width = 32)
|
||||
private Integer activityGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("活动范围名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 40)
|
||||
private String activityGroupName;
|
||||
|
||||
/**
|
||||
* 所有的培训班
|
||||
*/
|
||||
@Many(field = "activityId")
|
||||
private List<LiteracyCourse> courseList;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<LiteracyTypeLimit> typeLimits;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String literacyType;
|
||||
|
||||
@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/literacy/manage/apply");
|
||||
sysHomeActivity.setH5Url("/platform/mobile/literacyActivity/literacyList");
|
||||
if (Lang.isNotEmpty(this.getActivitySignUpStartTime())) {
|
||||
sysHomeActivity.setStartDate(this.getActivitySignUpStartTime());
|
||||
sysHomeActivity.setEndDate(this.getActivitySignUpEndTime());
|
||||
}
|
||||
sysHomeActivity.setAllowUserGroupId(this.getActivityGroupId());
|
||||
sysHomeActivity.setEnable(!this.isDisabled());
|
||||
sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
|
||||
return sysHomeActivity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 活动下的课程
|
||||
* @createTime 2022年02月23日 09:26:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LiteracyActivityCourse {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程ID")
|
||||
private String courseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程开始时间")
|
||||
private Date courseStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程结束时间")
|
||||
private Date courseEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATE)
|
||||
@Comment("课程时间")
|
||||
private Date courseDate;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
@Comment("限制人数")
|
||||
private Integer courseLimitNum;
|
||||
|
||||
private Integer hasRegisterNum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 黑名单
|
||||
* @createTime 2022年03月07日 14:32:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
public class LiteracyBlackList {
|
||||
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否禁用")
|
||||
private Boolean isDisabled;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训班信息
|
||||
* @createTime 2022年02月23日 09:04:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LiteracyCourse extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("课程名称")
|
||||
private String courseName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("课程人数")
|
||||
private int coursePeopleNumber;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Default(value = "0")
|
||||
@Comment("预留名额")
|
||||
private int courseReservedNumber;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("课程地点")
|
||||
private String courseLocation;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程类型")
|
||||
private String courseType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("课程地点坐标")
|
||||
private List<Double> courseLocationCoordinates;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("课程讲师")
|
||||
private String courseInstructor;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("校区")
|
||||
private String campus;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("报名人数是否限制")
|
||||
private Boolean courseIsLimitApply;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("序号")
|
||||
private int orderNum;
|
||||
|
||||
@Many(field = "courseId")
|
||||
private List<LiteracyActivityCourse> courseTimeList;
|
||||
|
||||
//已报人数
|
||||
private Integer hasRegisterNum;
|
||||
|
||||
private Boolean isBringFamily;
|
||||
|
||||
private Boolean isAddFamily;
|
||||
|
||||
//是否报过该课程
|
||||
private Boolean isSign;
|
||||
|
||||
//还能报该类型的课程吗
|
||||
private Boolean canSignThisCourseType;
|
||||
|
||||
@Column
|
||||
@Comment("分工会人数限制")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> unionLimit;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("移动端是否签到")
|
||||
private boolean isMobileSign;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("签到方式 1.扫描二维码签到 2.被扫 3.gps签到")
|
||||
private Integer signType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("移动端是否签收礼品")
|
||||
private boolean isReceiveGift;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("领取礼品方式 1.扫描二维码 2.线下")
|
||||
private Integer giftType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("预留名额方式 1.报名人员减少模式 2.报名人数不变模式")
|
||||
private Integer reserveMode;
|
||||
|
||||
@Column
|
||||
@Comment("承办工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String hostUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("对内报名时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String interTime;
|
||||
|
||||
@Column
|
||||
@Comment("是否开放给其他工会")
|
||||
@ColDefine(type = ColType.BOOLEAN, width = 4)
|
||||
private Boolean openOtherUnion;
|
||||
|
||||
@Column
|
||||
@Comment("分类标识")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String assort;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Default(value = "0")
|
||||
@Comment("候补名额数")
|
||||
private Integer waitingNum;
|
||||
|
||||
//候补已报人数
|
||||
private Integer hasWaitingNum;
|
||||
|
||||
private String courseTimeName;
|
||||
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Table("literacy_mobile_sign_column")
|
||||
@Data
|
||||
public class LiteracyMobileSignColumn {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* train_sign_up_type id
|
||||
*/
|
||||
@Column
|
||||
@Comment("类型id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeId;
|
||||
|
||||
@Column
|
||||
@Comment("字段名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnName;
|
||||
|
||||
@Column
|
||||
@Comment("字段编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnCode;
|
||||
|
||||
@Column
|
||||
@Comment("字段值")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnValue;
|
||||
|
||||
@Column
|
||||
@Comment("字段类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnType;
|
||||
|
||||
@Column
|
||||
@Comment("下拉框的值")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> selectValues;
|
||||
|
||||
@Column
|
||||
@Comment("是否必填")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isRequired;
|
||||
|
||||
@Column
|
||||
@Comment("控件类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnFormType;
|
||||
|
||||
@Column
|
||||
@Comment("文件个数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer fileNumber;
|
||||
|
||||
@Column
|
||||
@Comment("文件类型")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> fileType;
|
||||
|
||||
@Column
|
||||
@Comment("序号")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer columnIndex;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author 赵欣雨
|
||||
* @date 2020/8/18 9:16
|
||||
*/
|
||||
@Data
|
||||
@Table("literacy_type")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LiteracyType extends BaseModel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("类型编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 80)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("类型名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 80)
|
||||
private String typeName;
|
||||
|
||||
@Column
|
||||
@Comment("序号")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer xh;
|
||||
|
||||
@Column
|
||||
@Comment("是否携带家属")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isBringFamily;
|
||||
|
||||
@Column
|
||||
@Comment("家属纳入总人数")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isAddFamily;
|
||||
|
||||
@Column
|
||||
@Comment("本人纳入总人数")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("1")
|
||||
private Boolean selfAddFamily;
|
||||
|
||||
@Many(field = "typeId")
|
||||
private List<LiteracyMobileSignColumn> literacyMobileSignColumnList;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/9/22
|
||||
* @Description
|
||||
*/
|
||||
@Table("literacy_type_limit")
|
||||
@Data
|
||||
public class LiteracyTypeLimit implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeId;
|
||||
|
||||
@Column
|
||||
@Comment("限制个数")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private int limitNum;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 报名人员 报名记录
|
||||
* @createTime 2022年02月23日 09:34:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableIndexes({@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSEID", fields = {"courseId"}, unique = false)})
|
||||
public class LiteracyUser implements Serializable {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程ID")
|
||||
private String courseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户ID")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("工会ID")
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("单位ID")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("工会")
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("单位")
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("联系方式")
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("报名时间")
|
||||
private Date signUpTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动课程时段id")
|
||||
private String activityCourseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("手机端报名字段和值")
|
||||
private List<NutMap> mobileColumnsValue;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("用户报名状态(1.正常 2.待报名成功 3.也是正常,但是是从2变为1的 4.废弃[就是没签到的意思])")
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 用户课程表
|
||||
* @createTime 2022年02月23日 09:38:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableIndexes({
|
||||
@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSE_USERID", fields = {"userId"}, unique = false),
|
||||
@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSE_COURSEID", fields = {"courseId"}, unique = false)
|
||||
})
|
||||
public class LiteracyUserCourse implements Serializable {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程ID")
|
||||
private String courseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户ID")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程开始时间")
|
||||
private Date courseStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程结束时间")
|
||||
private Date courseEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否上课")
|
||||
private boolean isAttend;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("上课打卡时间")
|
||||
private Date attendTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否领取礼品")
|
||||
private Boolean isReceive;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("领取礼品时间")
|
||||
private Date receiveTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("签到扫码人员id(二维码模式)")
|
||||
private String signScannerCodeUserId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("礼品扫码人员id(二维码模式)")
|
||||
private String giftScannerCodeUserId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("关联literacy_sign_up_activity_course表的id")
|
||||
private String activityCourseId;
|
||||
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年02月23日 17:14:00
|
||||
*/
|
||||
public interface LiteracyActivityService extends BaseService<LiteracyActivity> {
|
||||
|
||||
/**
|
||||
* 添加活动
|
||||
*
|
||||
* @param activity 活动信息
|
||||
* @param course 培训班信息
|
||||
*/
|
||||
void add(LiteracyActivity activity, LiteracyCourse course);
|
||||
|
||||
/**
|
||||
* 编辑活动
|
||||
*
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void edit(LiteracyActivity activity);
|
||||
|
||||
/**
|
||||
* 更新活动状态
|
||||
*
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void updateActivityStatus(LiteracyActivity activity);
|
||||
|
||||
/**
|
||||
* 查询单条活动信息
|
||||
*
|
||||
* @param id 活动ID
|
||||
* @return 返回的数据与前端符合
|
||||
*/
|
||||
NutMap findOne(String id, Cnd cnd, String fromMode);
|
||||
|
||||
/**
|
||||
* pc分页查询
|
||||
*
|
||||
* @param pageForm
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd);
|
||||
|
||||
|
||||
/**
|
||||
* 手机端分页查询
|
||||
*
|
||||
* @param pageForm 分页
|
||||
* @param year 年度
|
||||
* @param activityStatus 报名状态 0全部 1进行中 2结束
|
||||
* @return
|
||||
*/
|
||||
Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType);
|
||||
|
||||
/**
|
||||
* 手机端报名
|
||||
*
|
||||
* @param trainSignUpUser 活动ID
|
||||
*/
|
||||
void doSignUp(LiteracyUser trainSignUpUser) throws Exception;
|
||||
|
||||
/**
|
||||
* 异步插入每个报名成功人员的课程数据
|
||||
*
|
||||
* @param activityId
|
||||
* @param courseId
|
||||
* @param userId
|
||||
*/
|
||||
void asyncInsertUserCourse(String activityId, String courseId, String userId);
|
||||
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
* @return
|
||||
*/
|
||||
boolean isSignFullByUnionId(LiteracyCourse course, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 该培训班是否报满
|
||||
*/
|
||||
boolean isSignFull(LiteracyCourse course, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 还能报该类型的培训班吗 比如书画班最多报一项 健身班两项
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourse(LiteracyCourse course, LiteracyActivity activity);
|
||||
|
||||
/**
|
||||
* 当前用户是否已报过该培训班
|
||||
*
|
||||
* @param courseId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourseByUser(String courseId, String userId);
|
||||
|
||||
/**
|
||||
* 手机端签到
|
||||
*
|
||||
* @param id 每个培训班每节课每个用户的记录ID
|
||||
*/
|
||||
void doQd(String id);
|
||||
|
||||
/**
|
||||
* 某个用户的签到信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param activityId 活动id
|
||||
*/
|
||||
List<NutMap> qdInfoByUserId(String userId, String activityId);
|
||||
|
||||
List<LiteracyCourse> filterCourseByHostUnion(List<LiteracyCourse> courseList);
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 报名统计service
|
||||
* @createTime 2022年03月03日 10:00:00
|
||||
*/
|
||||
public interface LiteracyActivityStatisticsService extends BaseService<LiteracyUser> {
|
||||
|
||||
/**
|
||||
* 统计分页
|
||||
*
|
||||
* @param pageForm
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, String activityId);
|
||||
|
||||
/**
|
||||
* 该课程下的报名人员信息
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> registerUserList(String courseId);
|
||||
|
||||
List<NutMap> getTaleColumnInfo(String courseId);
|
||||
|
||||
/**
|
||||
* 该课程下的报名人员信息
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> registerUserList(String courseId, String unionId, String unitId, String searchName, String searchKeyword);
|
||||
|
||||
/**
|
||||
* 获取每个课程的签到情况
|
||||
*
|
||||
* @param courseId
|
||||
* @return k->每个培训班每节课的上课时间 v->上课记录list
|
||||
*/
|
||||
Map<String, List<NutMap>> getSignInfo(String courseId);
|
||||
|
||||
/**
|
||||
* 报名人员list 导出
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> baoMingUserList(String activityId);
|
||||
|
||||
int queryCourseCount(String courseId, String courseType);
|
||||
|
||||
int queryCourseWaitCount(String courseId, String courseType);
|
||||
|
||||
int queryCourseCount(String courseId, String courseType, String unionId);
|
||||
|
||||
int queryCourseWaitCount(String courseId, String courseType, String unionId);
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyBlackList;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年03月07日 14:29:00
|
||||
*/
|
||||
public interface LiteracyBlackListService extends BaseService<LiteracyBlackList> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param pageForm 分页
|
||||
* @return Pagination
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd, String activityId, String courseId);
|
||||
|
||||
/**
|
||||
* 拉黑、解封用户
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void doHandleUser(String userId);
|
||||
|
||||
/**
|
||||
* 上课记录
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> attendClassRecord(String userId);
|
||||
|
||||
|
||||
}
|
||||
+473
@@ -0,0 +1,473 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.*;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.async.Async;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年02月23日 17:14:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class LiteracyActivityServiceImpl extends BaseServiceImpl<LiteracyActivity> implements LiteracyActivityService {
|
||||
|
||||
@Inject
|
||||
private LiteracyActivityStatisticsService statisticsService;
|
||||
|
||||
public LiteracyActivityServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void add(LiteracyActivity activity, LiteracyCourse course) {
|
||||
|
||||
dao().insert(activity);
|
||||
|
||||
//插入类型限制
|
||||
List<LiteracyTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> v.setActivityId(activity.getId()));
|
||||
dao().insert(typeLimits);
|
||||
|
||||
List<LiteracyCourse> courseList = activity.getCourseList();
|
||||
for (LiteracyCourse v : courseList) {
|
||||
v.setActivityId(activity.getId());
|
||||
v.setOpenOtherUnion(false);
|
||||
dao().insert(v);
|
||||
this.setCourseTimeAndInsert(v);
|
||||
}
|
||||
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void edit(LiteracyActivity activity) {
|
||||
|
||||
//修改活动
|
||||
update(activity);
|
||||
|
||||
//修改类型限制
|
||||
List<LiteracyTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> v.setActivityId(activity.getId()));
|
||||
if(Lang.isNotEmpty(typeLimits)) {
|
||||
insertOrUpdate(typeLimits);
|
||||
}
|
||||
|
||||
List<LiteracyCourse> courseList = activity.getCourseList();
|
||||
courseList.forEach(v -> {
|
||||
v.setActivityId(activity.getId());
|
||||
dao().insertOrUpdate(v);
|
||||
if (Lang.isNotEmpty(v.getCourseTimeList())) {
|
||||
this.setCourseTimeAndInsert(v);
|
||||
}
|
||||
});
|
||||
|
||||
//查询原来的活动
|
||||
List<LiteracyCourse> oldCourseList = dao().query(LiteracyCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
//原来的培训班id
|
||||
List<String> oldCourseIdList = oldCourseList.stream().map(LiteracyCourse::getId).toList();
|
||||
|
||||
//原来的上课时间
|
||||
List<LiteracyActivityCourse> oldActCourseTimeList = dao().query(LiteracyActivityCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
|
||||
//现在的上课时间
|
||||
List<String> nowCourseTimeListId = new ArrayList<>();
|
||||
activity.getCourseList().forEach(v -> {
|
||||
if (v.getCourseTimeList() != null) {
|
||||
nowCourseTimeListId.addAll(v.getCourseTimeList().stream().map(LiteracyActivityCourse::getId).toList());
|
||||
}
|
||||
});
|
||||
|
||||
List<String> deleteCourseTimeListId = oldActCourseTimeList.stream().map(LiteracyActivityCourse::getId).filter(id -> !nowCourseTimeListId.contains(id)).collect(Collectors.toList());
|
||||
List<String> courseIdList = courseList.stream().map(LiteracyCourse::getId).collect(Collectors.toList());
|
||||
|
||||
//删除关联的培训班
|
||||
List<String> deleteIdList = oldCourseIdList.stream().filter(v -> !courseIdList.contains(v)).collect(Collectors.toList());
|
||||
dao().clear(LiteracyCourse.class, Cnd.where("id", "in", deleteIdList));
|
||||
|
||||
dao().clear(LiteracyActivityCourse.class, Cnd.where("id", "in", deleteCourseTimeListId));
|
||||
dao().clear(LiteracyUser.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
dao().clear(LiteracyUserCourse.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
|
||||
//查询修改过培训时间的记录
|
||||
Sql tsuucSql = Sqls.create("""
|
||||
SELECT
|
||||
tsuuc.id,
|
||||
tsuac.courseStartTime,
|
||||
tsuac.courseEndTime
|
||||
FROM
|
||||
`literacy_user_course` tsuuc
|
||||
LEFT JOIN literacy_activity_course tsuac ON tsuac.id = tsuuc.activityCourseId
|
||||
where tsuuc.courseStartTime != tsuac.courseStartTime or tsuuc.courseEndTime != tsuac.courseEndTime
|
||||
""");
|
||||
List<NutMap> tsuucList = listMap(tsuucSql);
|
||||
tsuucList.forEach(v -> {
|
||||
Chain chain = Chain.make("courseStartTime", v.getTime("courseStartTime"));
|
||||
chain.add("courseEndTime", v.getTime("courseEndTime"));
|
||||
Cnd cnd = Cnd.where("id", "=", v.getString("id"));
|
||||
dao().update("literacy_user_course", chain, cnd);
|
||||
});
|
||||
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
} else {
|
||||
dao().delete(Sys_home_activity.class, activity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private void setCourseTimeAndInsert(LiteracyCourse course) {
|
||||
course.getCourseTimeList().forEach(courseTime -> {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(courseTime.getCourseDate());
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH);
|
||||
int day = calendar.get(Calendar.DATE);
|
||||
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
startCalendar.setTime(courseTime.getCourseStartTime());
|
||||
startCalendar.set(year, month, day);
|
||||
courseTime.setCourseStartTime(startCalendar.getTime());
|
||||
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(courseTime.getCourseEndTime());
|
||||
endCalendar.set(year, month, day);
|
||||
courseTime.setCourseEndTime(endCalendar.getTime());
|
||||
|
||||
courseTime.setActivityId(course.getActivityId());
|
||||
courseTime.setCourseId(course.getId());
|
||||
dao().insertOrUpdate(courseTime);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void updateActivityStatus(LiteracyActivity activity) {
|
||||
updateIgnoreNull(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap findOne(String id, Cnd cnd, String fromMode) {
|
||||
if (Lang.isEmpty(cnd)) {
|
||||
cnd = Cnd.NEW();
|
||||
}
|
||||
|
||||
cnd.asc("orderNum").asc("campus").desc("courseLocation").asc("courseType").asc("courseName");
|
||||
List<LiteracyCourse> courseArray = dao().query(LiteracyCourse.class, cnd.and("activityId", "=", id));
|
||||
|
||||
if (StrUtil.isNotBlank(fromMode) && "mobile".equals(fromMode)) {
|
||||
courseArray = this.filterCourseByHostUnion(courseArray);
|
||||
}
|
||||
|
||||
LiteracyActivity activity = fetchLinks(dao().fetch(LiteracyActivity.class, id), "^(conditionStructure|typeLimits)$");
|
||||
activity.setCourseList(courseArray);
|
||||
|
||||
List<LiteracyCourse> courseList = activity.getCourseList();
|
||||
|
||||
courseList.forEach(c -> {
|
||||
if (StrUtil.isNotBlank(c.getCourseType())) {
|
||||
dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
int courseCount = statisticsService.queryCourseCount(c.getId(), c.getCourseType());
|
||||
c.setHasRegisterNum(courseCount);
|
||||
int courseWaitCount = statisticsService.queryCourseWaitCount(c.getId(), c.getCourseType());
|
||||
c.setHasWaitingNum(courseWaitCount);
|
||||
//当前用户是否报过
|
||||
c.setIsSign(isSignCourseByUser(c.getId(), SecurityUtil.getUserId()));
|
||||
}
|
||||
});
|
||||
return Lang.obj2nutmap(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd) {
|
||||
Pagination pagination = listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "^(courseList)$");
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
switch (activityStatus) {
|
||||
case 2 -> {
|
||||
cnd.and(new Static("activitySignUpStartTime < now()"));
|
||||
cnd.and(new Static("activitySignUpEndTime > now()"));
|
||||
}
|
||||
case 3 -> {
|
||||
cnd.and(new Static("activityStartTime < now()"));
|
||||
cnd.and(new Static("activityEndTime > now()"));
|
||||
}
|
||||
case 4 -> cnd.and(new Static("activityEndTime < now()"));
|
||||
case 5 -> cnd.and(new Static("activityStartTime < now()"));
|
||||
case 6 -> cnd.and(new Static("activityStartTime > now()"));
|
||||
}
|
||||
if (activityType != null && activityType == 1) {
|
||||
cnd.and(new Static("id in (select activityId from literacy_user where userId = '%s')".formatted(SecurityUtil.getUserId())));
|
||||
}
|
||||
cnd.and("isDisabled", "=", 0);
|
||||
cnd.orderBy("activityEndTime", "desc");
|
||||
cnd.orderBy("isDisabled", "desc");
|
||||
cnd.orderBy("createdAt", "desc");
|
||||
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doSignUp(LiteracyUser literacyUser) throws Exception {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
|
||||
//查询课程
|
||||
LiteracyCourse course = dao().fetch(LiteracyCourse.class, literacyUser.getCourseId());
|
||||
LiteracyType type = dao().fetch(LiteracyType.class, course.getCourseType());
|
||||
//如果这个课程的预留名额方式为报名人数不变
|
||||
if (course.getReserveMode() == 2) {
|
||||
//如果当前报名+已报小于这个课程限制人数
|
||||
//课程已报人数
|
||||
int normalCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType());
|
||||
//+1是算自己
|
||||
int hasRegisterNum = type.getSelfAddFamily() ? normalCount + 1 : 0;
|
||||
literacyUser.setState((hasRegisterNum + course.getCourseReservedNumber()) > course.getCoursePeopleNumber() ? 2 : 1);
|
||||
} else {
|
||||
literacyUser.setState(1);
|
||||
}
|
||||
|
||||
View_user user = dao().fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
literacyUser.setUnionId(SecurityUtil.getUnionId());
|
||||
literacyUser.setUnionName(user.getUnionName());
|
||||
literacyUser.setUnitId(SecurityUtil.getUnitId());
|
||||
literacyUser.setUnitName(user.getUnitName());
|
||||
literacyUser.setUserId(userId);
|
||||
literacyUser.setSignUpTime(new Date());
|
||||
|
||||
dao().insert(literacyUser);
|
||||
|
||||
if (StrUtil.isNotBlank(literacyUser.getActivityCourseId())) {
|
||||
LiteracyActivityCourse fetch = dao().fetch(LiteracyActivityCourse.class, literacyUser.getActivityCourseId());
|
||||
LiteracyUserCourse userCourse = new LiteracyUserCourse();
|
||||
userCourse.setActivityId(literacyUser.getActivityId());
|
||||
userCourse.setCourseId(literacyUser.getCourseId());
|
||||
userCourse.setUserId(literacyUser.getUserId());
|
||||
userCourse.setCourseStartTime(fetch.getCourseStartTime());
|
||||
userCourse.setCourseEndTime(fetch.getCourseEndTime());
|
||||
userCourse.setAttend(false);
|
||||
userCourse.setAttendTime(null);
|
||||
userCourse.setActivityCourseId(fetch.getId());
|
||||
dao().insert(userCourse);
|
||||
} else {
|
||||
asyncInsertUserCourse(literacyUser.getActivityId(), literacyUser.getCourseId(), literacyUser.getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void asyncInsertUserCourse(String activityId, String courseId, String userId) {
|
||||
log.info("异步插入{}的上课信息,课程ID为{},活动ID为{}", userId, courseId, activityId);
|
||||
List<LiteracyActivityCourse> courseList = dao().query(LiteracyActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
List<LiteracyUserCourse> list = new ArrayList<>();
|
||||
courseList.forEach(v -> {
|
||||
LiteracyUserCourse userCourse = new LiteracyUserCourse();
|
||||
userCourse.setActivityId(activityId);
|
||||
userCourse.setCourseId(courseId);
|
||||
userCourse.setUserId(userId);
|
||||
userCourse.setCourseStartTime(v.getCourseStartTime());
|
||||
userCourse.setCourseEndTime(v.getCourseEndTime());
|
||||
userCourse.setAttend(false);
|
||||
userCourse.setAttendTime(null);
|
||||
userCourse.setActivityCourseId(v.getId());
|
||||
list.add(userCourse);
|
||||
});
|
||||
dao().insert(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isSignFullByUnionId(LiteracyCourse course, Integer currentFamilyNumber) {
|
||||
List<NutMap> unionLimit = course.getUnionLimit();
|
||||
if (Lang.isEmpty(unionLimit)) {
|
||||
return false;
|
||||
}
|
||||
String unionId = SecurityUtil.getUnionId();
|
||||
NutMap unionLimitMap = unionLimit.stream().filter(v -> v.getString("id").equals(unionId)).findAny().orElse(null);
|
||||
if (Lang.isEmpty(unionLimitMap)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LiteracyType type = dao().fetch(LiteracyType.class, course.getCourseType());
|
||||
//分工会限制人数
|
||||
int limitCount = unionLimitMap.getInt("limitCount");
|
||||
|
||||
//该课程已经报名的总人数
|
||||
int hasSignCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType(), unionId);
|
||||
int hasWaitCount = statisticsService.queryCourseWaitCount(course.getId(), course.getCourseType());
|
||||
|
||||
//+1是算自己
|
||||
int current = type.getSelfAddFamily() ? 1 : 0;
|
||||
currentFamilyNumber = type.getIsBringFamily() && type.getIsAddFamily() ? currentFamilyNumber : 0;
|
||||
//如果还有正常名额
|
||||
if(limitCount - hasSignCount > 0) {
|
||||
return (hasSignCount + current + currentFamilyNumber) > limitCount;
|
||||
} else {
|
||||
return (hasWaitCount + current + currentFamilyNumber) > course.getWaitingNum();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignFull(LiteracyCourse course, Integer currentFamilyNumber) {
|
||||
//课程限制人数
|
||||
int coursePeopleNumber = course.getCoursePeopleNumber();
|
||||
if (coursePeopleNumber == 0) {
|
||||
return true;
|
||||
}
|
||||
//查询课程对应的类型
|
||||
LiteracyType type = dao().fetch(LiteracyType.class, course.getCourseType());
|
||||
//课程已报人数
|
||||
int hasSignCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType());
|
||||
int hasWaitCount = statisticsService.queryCourseWaitCount(course.getId(), course.getCourseType());
|
||||
|
||||
//+1是算自己
|
||||
int current = type.getSelfAddFamily() ? 1 : 0;
|
||||
currentFamilyNumber = type.getIsBringFamily() && type.getIsAddFamily() ? currentFamilyNumber : 0;
|
||||
//如果还有正常名额
|
||||
if(coursePeopleNumber - hasSignCount > 0) {
|
||||
return (hasSignCount + current + currentFamilyNumber + course.getCourseReservedNumber()) > coursePeopleNumber;
|
||||
} else {
|
||||
return (hasWaitCount + current + currentFamilyNumber) > course.getWaitingNum();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignCourse(LiteracyCourse course, LiteracyActivity activity) {
|
||||
//培训班类型
|
||||
String courseType = course.getCourseType();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count( tsus.id )
|
||||
FROM
|
||||
`literacy_user` tsus
|
||||
LEFT JOIN literacy_course tsuc ON tsuc.id = tsus.courseId
|
||||
WHERE
|
||||
tsuc.courseType = @courseType
|
||||
AND tsus.userId = @userId
|
||||
AND tsus.activityId = @activityId
|
||||
""");
|
||||
sql.setParam("courseType", courseType);
|
||||
sql.setParam("activityId", activity.getId());
|
||||
sql.setParam("userId", SecurityUtil.getUserId());
|
||||
int hasRegisterNum = count(sql);
|
||||
|
||||
//第一种无限制报名
|
||||
if (activity.getRestrictLimit() == null || activity.getRestrictLimit() == 1) {
|
||||
return true;
|
||||
} else if (activity.getRestrictLimit() == 2) {
|
||||
LiteracyTypeLimit literacyTypeLimit = dao().fetch(LiteracyTypeLimit.class, Cnd.where("typeId", "=", courseType).and("activityId", "=", activity.getId()));
|
||||
if (literacyTypeLimit == null) {
|
||||
return true;
|
||||
}
|
||||
//此类型的班最多可报几项
|
||||
int personMaxRegisterNum = literacyTypeLimit.getLimitNum();
|
||||
if (personMaxRegisterNum == 0) {
|
||||
return true;
|
||||
}
|
||||
return hasRegisterNum < personMaxRegisterNum;
|
||||
} else if (activity.getRestrictLimit() == 3) {
|
||||
//第三种,限制报几个,不跟类型挂钩
|
||||
int aCount = dao().count(LiteracyUser.class, Cnd.where("activityId", "=", activity.getId()).and("userId", "=", SecurityUtil.getUserId()));
|
||||
return aCount < activity.getLimitNum();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignCourseByUser(String courseId, String userId) {
|
||||
return dao().count(LiteracyUser.class, Cnd.where("courseId", "=", courseId).and("userId", "=", userId)) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doQd(String id) {
|
||||
NutMap updateMap = NutMap.NEW();
|
||||
updateMap.put("isAttend", true);
|
||||
updateMap.put("attendTime", new Date());
|
||||
dao().update(LiteracyUserCourse.class, Chain.from(updateMap), Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> qdInfoByUserId(String userId, String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
t.courseLocationCoordinates,
|
||||
t.isMobileSign,
|
||||
t.signType,
|
||||
t.isReceiveGift,
|
||||
t.giftType,
|
||||
(select state from literacy_user su where su.activityId = c.activityId and su.courseId = c.courseId and su.userId = c.userId) as state
|
||||
FROM
|
||||
`literacy_user_course` c
|
||||
LEFT JOIN literacy_course t ON t.id = c.courseId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("c.activityId", "=", activityId);
|
||||
cnd.and("c.userId", "=", userId);
|
||||
cnd.asc("c.courseStartTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LiteracyCourse> filterCourseByHostUnion(List<LiteracyCourse> courseList) {
|
||||
if (Lang.isEmpty(courseList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return courseList.stream().filter(o -> {
|
||||
if (StrUtil.isBlank(o.getInterTime()) || o.getOpenOtherUnion() == null || o.getOpenOtherUnion()) {
|
||||
return true;
|
||||
} else {
|
||||
if (SecurityUtil.getUnionId().equals(o.getHostUnionId())) {
|
||||
return true;
|
||||
} else {
|
||||
int compare = cn.hutool.core.date.DateUtil.compare(cn.hutool.core.date.DateUtil.date(), cn.hutool.core.date.DateUtil.parse(o.getInterTime()), "yyyy-MM-dd HH:mm");
|
||||
return compare >= 0;
|
||||
}
|
||||
}
|
||||
}).toList();
|
||||
}
|
||||
}
|
||||
+260
@@ -0,0 +1,260 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyType;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年03月03日 10:02:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class LiteracyActivityStatisticsServiceImpl extends BaseServiceImpl<LiteracyUser> implements LiteracyActivityStatisticsService {
|
||||
|
||||
public LiteracyActivityStatisticsServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseReservedNumber,
|
||||
type.typeName as courseType,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.reserveMode,
|
||||
tsuc.isMobileSign,
|
||||
tsuc.hostUnionId,
|
||||
tsuc.interTime,
|
||||
tsuc.waitingNum,
|
||||
tsuc.openOtherUnion,
|
||||
tsuc.courseType as cType
|
||||
FROM
|
||||
`literacy_course` tsuc
|
||||
LEFT JOIN
|
||||
literacy_type type on tsuc.courseType = type.id
|
||||
WHERE
|
||||
tsuc.activityId = @activityId
|
||||
ORDER BY tsuc.orderNum
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
courseList.forEach(c -> {
|
||||
c.put("registerNum", queryCourseCount(c.getString("id"), c.getString("cType")));
|
||||
c.put("hasWaitingNum", queryCourseWaitCount(c.getString("id"), c.getString("cType")));
|
||||
});
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> registerUserList(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
tsuu.unionId,
|
||||
tsuu.unionName,
|
||||
tsuu.unitId,
|
||||
tsuu.unitName,
|
||||
ifnull(tsuu.mobile, u.mobile) as mobile,
|
||||
tsuu.signUpTime,
|
||||
tsuu.state,
|
||||
tsuu.mobileColumnsValue
|
||||
FROM
|
||||
literacy_user tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
$condition
|
||||
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
list.forEach(o -> {
|
||||
List<NutMap> mobileColumnsValue = Json.fromJsonAsList(NutMap.class, o.getString("mobileColumnsValue"));
|
||||
if(Lang.isNotEmpty(mobileColumnsValue)) {
|
||||
mobileColumnsValue.forEach(m -> {
|
||||
o.put(m.getString("columnCode"), m.getString("columnValue"));
|
||||
});
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getTaleColumnInfo(String courseId) {
|
||||
LiteracyCourse course = dao().fetch(LiteracyCourse.class, courseId);
|
||||
LiteracyType upType = dao().fetch(LiteracyType.class, course.getCourseType());
|
||||
dao().fetchLinks(upType, "literacyMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
|
||||
List<LiteracyMobileSignColumn> columnList = upType.getLiteracyMobileSignColumnList();
|
||||
List<NutMap> columnTableList = columnList.stream().map(o -> NutMap.NEW().setv("label", o.getColumnName()).setv("prop", o.getColumnCode())).collect(Collectors.toList());
|
||||
return columnTableList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> registerUserList(String courseId, String unionId, String unitId, String searchName, String searchKeyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuu.id,
|
||||
u.id as userId,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
ifnull(tsuu.mobile, u.mobile) as mobile,
|
||||
tsuu.signUpTime,
|
||||
tsuu.state
|
||||
FROM
|
||||
literacy_user tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
$condition
|
||||
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
if (StrUtil.isNotBlank(searchKeyword)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.andLike("username", searchKeyword).orLike("loginname", searchKeyword);
|
||||
cnd.and(group);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<NutMap>> getSignInfo(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuuc.courseStartTime,
|
||||
tsuuc.courseEndTime,
|
||||
tsuuc.isAttend,
|
||||
tsuuc.attendTime,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.unionname
|
||||
FROM
|
||||
`literacy_user_course` tsuuc
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuuc.userId
|
||||
WHERE
|
||||
tsuuc.courseId = @courseId
|
||||
""");
|
||||
sql.setParam("courseId", courseId);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
Map<String, List<NutMap>> courseTimeMap = list.stream().map(v -> {
|
||||
String courseTime = v.getString("courseStartTime") + " 至 " + v.getString("courseEndTime");
|
||||
v.put("courseTime", courseTime);
|
||||
return v;
|
||||
}).collect(Collectors.groupingBy(v -> v.getString("courseTime")));
|
||||
|
||||
// 使用Stream API进行降序排序
|
||||
Map<String, List<NutMap>> sortedDataMap = courseTimeMap.entrySet().stream()
|
||||
.sorted(Map.Entry.comparingByKey(Comparator.reverseOrder()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
|
||||
|
||||
return sortedDataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> baoMingUserList(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
uc.courseName,
|
||||
uc.campus
|
||||
FROM
|
||||
`literacy_user` uu
|
||||
RIGHT JOIN literacy_course uc ON uc.id = uu.courseId
|
||||
LEFT JOIN `vw_user` u ON u.id = uu.userId
|
||||
WHERE
|
||||
uc.activityId = @activityId
|
||||
ORDER BY u.unitCode,u.unioncode,u.sex
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseCount(String courseId, String courseType) {
|
||||
return this.queryCourseCount(courseId, courseType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseWaitCount(String courseId, String courseType) {
|
||||
return this.queryCourseWaitCount(courseId, courseType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseCount(String courseId, String courseType, String unionId) {
|
||||
return this.calcSignCount(courseId, courseType, unionId, List.of(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryCourseWaitCount(String courseId, String courseType, String unionId) {
|
||||
return this.calcSignCount(courseId, courseType, unionId, List.of(2));
|
||||
}
|
||||
|
||||
private int calcSignCount(String courseId, String courseType, String unionId, List<Integer> stateList) {
|
||||
if(StrUtil.isBlank(courseId) || StrUtil.isBlank(courseType)) {
|
||||
return 0;
|
||||
}
|
||||
LiteracyType type = dao().fetch(LiteracyType.class, courseType);
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<LiteracyUser> signUpUsers = dao().query(LiteracyUser.class, Cnd.where("courseId", "=", courseId)
|
||||
.and("state", "in", stateList)
|
||||
.andEX("unionId", "=", unionId));
|
||||
signUpUsers.forEach(item -> {
|
||||
if (type.getSelfAddFamily()) {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
}
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mobileColumnsValue = item.getMobileColumnsValue();
|
||||
NutMap map = mobileColumnsValue.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
int number = map != null ? map.getInt("columnValue") : 0;
|
||||
hasRegisterNum.addAndGet(number);
|
||||
}
|
||||
});
|
||||
return hasRegisterNum.get();
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.budwk.app.zhgh.activity.literacy.service.impl;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.activity.literacy.models.LiteracyBlackList;
|
||||
import com.budwk.app.zhgh.activity.literacy.service.LiteracyBlackListService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Criteria;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年03月07日 14:29:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class LiteracyUserServiceImpl extends BaseServiceImpl<LiteracyBlackList> implements LiteracyBlackListService {
|
||||
|
||||
public LiteracyUserServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd, String activityId, String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id AS userId,
|
||||
u.username,
|
||||
u.loginname,
|
||||
ifnull(tsuu.mobile, u.mobile) as mobile,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
tsuc.courseName,
|
||||
tsuu.state,
|
||||
( SELECT count( 1 ) FROM literacy_user_course WHERE userId = tsuu.userId $var) courseTotal,
|
||||
( SELECT count( 1 ) FROM literacy_user_course WHERE userId = tsuu.userId AND isAttend = 0 and tsuu.state!=2 AND now()> courseEndTime $var) AS absentCount,
|
||||
if(tsubl.isDisabled=1,true,false) isDisabled,
|
||||
group_CONCAT( tsuc.courseName ) AS courseNames
|
||||
FROM
|
||||
`literacy_user` tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
LEFT JOIN literacy_activity act on act.id = tsuu.activityId
|
||||
LEFT JOIN literacy_course tsuc ON tsuc.id = tsuu.courseId
|
||||
LEFT JOIN literacy_black_list tsubl on tsubl.userId = tsuu.userId
|
||||
$condition
|
||||
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 )
|
||||
""");
|
||||
cnd.groupBy("tsuu.userId");
|
||||
Criteria varCnd = Cnd.cri();
|
||||
varCnd.where().setTop(false);
|
||||
varCnd.where().andEX("activityId", "=", activityId);
|
||||
varCnd.where().andEX("courseId", "=", courseId);
|
||||
if (!varCnd.where().isEmpty()) {
|
||||
sql.vars().set("var", "and " + varCnd.toSql(null));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doHandleUser(String userId) {
|
||||
LiteracyBlackList blackRecord = dao().fetch(LiteracyBlackList.class, Cnd.where("userId", "=", userId));
|
||||
if (Lang.isEmpty(blackRecord)) {
|
||||
LiteracyBlackList blackList = new LiteracyBlackList();
|
||||
blackList.setUserId(userId);
|
||||
blackList.setIsDisabled(true);
|
||||
dao().insert(blackList);
|
||||
} else {
|
||||
// blackRecord.setIsDisabled(!blackRecord.getIsDisabled());
|
||||
// dao().update(blackRecord);
|
||||
dao().delete(blackRecord);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> attendClassRecord(String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.courseName,
|
||||
uc.courseStartTime,
|
||||
courseEndTime,
|
||||
uc.isAttend,
|
||||
uc.attendTime
|
||||
FROM
|
||||
`literacy_user_course` uc
|
||||
LEFT JOIN literacy_course c ON c.id = uc.courseId
|
||||
WHERE
|
||||
uc.userId = @userId
|
||||
""");
|
||||
sql.setParam("userId", userId);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class TrainSignUpUserServiceImpl extends BaseServiceImpl<TrainSignUpBlack
|
||||
u.unionname,
|
||||
tsuc.courseName,
|
||||
tsuu.state,
|
||||
( SELECT count( 1 ) FROM train_sign_up_user_course WHERE userId = tsuu.userId $var) tourseTotal,
|
||||
( SELECT count( 1 ) FROM train_sign_up_user_course WHERE userId = tsuu.userId $var) courseTotal,
|
||||
( SELECT count( 1 ) FROM train_sign_up_user_course WHERE userId = tsuu.userId AND isAttend = 0 and tsuu.state!=2 AND now()> courseEndTime $var) AS absentCount,
|
||||
if(tsubl.isDisabled=1,true,false) isDisabled,
|
||||
group_CONCAT( tsuc.courseName ) AS courseNames
|
||||
|
||||
+1
@@ -128,6 +128,7 @@ public class ClubUserJoinApplyController {
|
||||
Dict args = Dict.create();
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, clubUserApply);
|
||||
args.set("clubId", clubUserApply.getClubId());
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("XHRH", clubUserApply.getId(), SecurityUtil.getUserId(), args);
|
||||
|
||||
// 自动完成第一个申请任务
|
||||
|
||||
+6
-2
@@ -27,6 +27,7 @@ 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 javax.validation.Valid;
|
||||
|
||||
@@ -49,7 +50,8 @@ public class ClubUserJoinMineController {
|
||||
|
||||
@At
|
||||
@SaCheckPermission("club.join.mine")
|
||||
public Result pageData(@Valid PageForm pageForm){
|
||||
public Result pageData(@Valid PageForm pageForm,
|
||||
@Param("year") Integer year){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
@@ -83,6 +85,7 @@ public class ClubUserJoinMineController {
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
cnd.andEX("year(info.applyDate)", "=", year);
|
||||
cnd.groupBy("info.id");
|
||||
cnd.desc("info.applyDate");
|
||||
sql.setCondition(cnd);
|
||||
@@ -117,7 +120,8 @@ public class ClubUserJoinMineController {
|
||||
u.unionName,
|
||||
u.technicalTitle,
|
||||
u.education,
|
||||
u.academicDegree
|
||||
u.academicDegree,
|
||||
u.position
|
||||
FROM
|
||||
club_user_apply cua
|
||||
LEFT JOIN vw_user u ON u.id = cua.userId
|
||||
|
||||
+2
-2
@@ -337,8 +337,8 @@ public class ClubStatisticsController {
|
||||
sum( CASE WHEN cu.userId is not null $myCondition THEN 1 ELSE 0 END ) AS total,
|
||||
sum( CASE WHEN su.userState in ('在职', '在岗') $myCondition THEN 1 ELSE 0 END ) AS `work`,
|
||||
sum( CASE WHEN su.userState in ('退休') $myCondition THEN 1 ELSE 0 END ) AS retire,
|
||||
sum( CASE WHEN su.sex = '男' $myCondition THEN 1 ELSE 0 END ) AS man,
|
||||
sum( CASE WHEN su.sex = '女' $myCondition THEN 1 ELSE 0 END ) AS woman,
|
||||
sum( CASE WHEN su.sex like '%男%' $myCondition THEN 1 ELSE 0 END ) AS man,
|
||||
sum( CASE WHEN su.sex like '%女%' $myCondition THEN 1 ELSE 0 END ) AS woman,
|
||||
sum( CASE WHEN cu.roleCode != 'CLUB_MEMBER' AND 1 = 1 $myCondition THEN 1 ELSE 0 END ) AS governing_body
|
||||
FROM
|
||||
sys_club club
|
||||
|
||||
@@ -27,9 +27,6 @@ public class ClubUserImportVo {
|
||||
@ExcelProperty("姓名")
|
||||
private String username;
|
||||
|
||||
@ExcelProperty("协会职务")
|
||||
private String clubPosition;
|
||||
|
||||
@ExcelIgnore
|
||||
private String errorInfo;
|
||||
}
|
||||
|
||||
@@ -18,4 +18,8 @@ public class ClubUserJoinVo extends ClubUserApply {
|
||||
private String unionName;
|
||||
private String sex;
|
||||
private String mobile;
|
||||
private String technicalTitle;
|
||||
private String education;
|
||||
private String academicDegree;
|
||||
private String position;
|
||||
}
|
||||
|
||||
+2
@@ -114,6 +114,8 @@ public class ArticleClubApprovalController {
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = articleService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
|
||||
+3
-1
@@ -102,7 +102,9 @@ public class ArticleExamineController {
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "27f618b9-bff8-4382-87c9-d9abd9f5963c");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
|
||||
+4
@@ -86,6 +86,10 @@ public class ArticleMineController {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("info.createdBy", "=", SecurityUtil.getUserId());
|
||||
cnd.andEX("YEAR(info.submitTime)", "=", pageForm.getYear());
|
||||
// 添加标题模糊查询,仅当标题不为空时
|
||||
if (pageForm.getTitle() != null && !pageForm.getTitle().trim().isEmpty()) {
|
||||
cnd.andEX("info.title", "LIKE", "%" + pageForm.getTitle().trim() + "%");
|
||||
}
|
||||
cnd.desc("info.submitTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = articleService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
+23
-4
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
||||
import com.budwk.app.zhgh.dayofficework.article.param.ArticleInfoPageParam;
|
||||
import com.budwk.app.zhgh.dayofficework.article.service.ArticleService;
|
||||
import com.budwk.app.zhgh.dayofficework.article.vo.ArticleInfoPageVO;
|
||||
@@ -42,15 +43,34 @@ public class ArticleQueryController {
|
||||
public Result pageData(@Valid ArticleInfoPageParam pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
info.id,
|
||||
info.title,
|
||||
info.userName,
|
||||
info.loginName,
|
||||
info.unitName,
|
||||
info.unionName,
|
||||
info.submitTime,
|
||||
info.origin,
|
||||
ins.id AS instanceId,
|
||||
ins.processDefineId instanceProcessDefineId
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime
|
||||
FROM
|
||||
article info
|
||||
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
|
||||
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.and("ins.state","=", ProcessInstanceStateEnum.FINISHED.getCode());
|
||||
cnd.andEX("YEAR(info.submitTime)", "=", pageForm.getYear());
|
||||
if (StrUtil.isNotBlank(pageForm.getTitle())) {
|
||||
cnd.and(Cnd.likeEX("info.title", pageForm.getTitle()));
|
||||
@@ -65,7 +85,6 @@ public class ArticleQueryController {
|
||||
}else{
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<ArticleInfoPageVO> pageVO = articleService.listPageVO(pageForm, sql, ArticleInfoPageVO.class);
|
||||
|
||||
+5
-1
@@ -2,12 +2,14 @@ package com.budwk.app.zhgh.dayofficework.article.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.bpm.service.BpmService;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.controllers.open.commons.service.CommonService;
|
||||
import com.budwk.app.zhgh.dayofficework.article.param.ArticleInfoPageParam;
|
||||
@@ -87,7 +89,9 @@ public class ArticleSchoolUnionApprovalController {
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "749b6917-58ba-4564-8701-4bd2491fcb98");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
|
||||
+3
@@ -87,6 +87,7 @@ public class ArticleWriteController {
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, article);
|
||||
args.set("origin", article.getOrigin());
|
||||
args.set("clubId",article.getClubId());
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("XWTG", article.getId(), SecurityUtil.getUserId(), args);
|
||||
|
||||
// 自动完成第一个申请任务
|
||||
@@ -109,6 +110,8 @@ public class ArticleWriteController {
|
||||
Dict dict = Dict.create();
|
||||
dict.set(FlowConst.PROCESS_TASK_ID_KEY, taskId);
|
||||
dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.RE_APPLY.getCode());
|
||||
dict.set("origin", article.getOrigin());
|
||||
dict.set("clubId",article.getClubId());
|
||||
flowCommonService.executeTask(dict);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package com.budwk.app.zhgh.dayofficework.article.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.zhgh.dayofficework.article.models.Article;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -10,7 +9,7 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "稿件分页查询参数")
|
||||
public class ArticleInfoPageParam extends PageForm<Article> {
|
||||
public class ArticleInfoPageParam extends PageForm {
|
||||
|
||||
@ApiModelProperty("稿件标题")
|
||||
private String title;
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class EvaluateActivityController {
|
||||
@At
|
||||
@SaCheckPermission("evaluation.activity")
|
||||
@ApiOperation("获取评优评先活动列表")
|
||||
public Result pageData(@Valid PageForm<EvaluateActivity> pageForm, Integer year, String searchKeyword) {
|
||||
public Result pageData(@Valid PageForm pageForm, Integer year, String searchKeyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
eva.*,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.budwk.app.zhgh.dayofficework.evaluation.vo;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.zhgh.dayofficework.evaluation.models.EvaluateApply;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -10,7 +9,7 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("评优评先分页参数")
|
||||
@Data
|
||||
public class EvaluatePageForm extends PageForm<EvaluateApply> {
|
||||
public class EvaluatePageForm extends PageForm {
|
||||
|
||||
@ApiModelProperty("年度")
|
||||
private Integer year;
|
||||
|
||||
+2
-4
@@ -32,9 +32,7 @@ import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -85,8 +83,8 @@ public class MeetingOnlineController {
|
||||
cnd.andEX("info.typeId", "=", typeId);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("info.meetingName", pageForm.getSearchKeyword());
|
||||
seg.orLike("info.location", pageForm.getSearchKeyword());
|
||||
seg.orLike("info.name", pageForm.getSearchKeyword());
|
||||
seg.orLike("info.address", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.desc("info.createTime");
|
||||
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
package com.budwk.app.zhgh.dayofficework.meeting.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.model.MeetingInfo;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.model.MeetingTimePeriodUser;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.model.MeetingType;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.service.MeetingInfoService;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.service.MeetingUserService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
|
||||
import com.budwk.app.zhgh.democratic.workercongress.models.Worker_congress_delegate;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @ClassName MeetingStatisticsController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/8/29 17:59
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "会议统计")
|
||||
@At("/platform/meeting/statistics")
|
||||
public class MeetingStatisticsController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MeetingInfoService infoService;
|
||||
@Inject
|
||||
private SysRoleService roleService;
|
||||
@Inject
|
||||
private MeetingUserService userService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("meeting.statistics")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/meeting/statistics/index.html")
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("meeting.statistics")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param("year") Integer year,
|
||||
@Param("typeId") String typeId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name as typeName,
|
||||
@qrCodeUrl as qrCodeUrl
|
||||
FROM
|
||||
meeting_info info
|
||||
LEFT JOIN meeting_type type ON type.id = info.typeId
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("qrCodeUrl", "");
|
||||
cnd.andEX("year(info.createTime)", "=", year);
|
||||
cnd.andEX("info.typeId", "=", typeId);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("info.name", pageForm.getSearchKeyword());
|
||||
seg.orLike("info.address", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.desc("info.createTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = infoService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取会议时间段")
|
||||
@SaCheckPermission("meeting.statistics")
|
||||
public Result view(String meetingId) {
|
||||
MeetingInfo info = dao.fetch(MeetingInfo.class, meetingId);
|
||||
MeetingType type = dao.fetch(MeetingType.class, info.getTypeId());
|
||||
|
||||
if("JDHHY".equals(type.getDesignId())) {
|
||||
List<NutMap> listMap = userService.queryMeetingCount(
|
||||
meetingId,
|
||||
"teacher_congress_delegate",
|
||||
RoleConstant.TEACHER_CONGRESS_DELEGATE_FORMAL.name(),
|
||||
RoleConstant.TEACHER_CONGRESS_DELEGATE_ATTENDANCE.name(),
|
||||
info.getTeacherCongressSessionId()
|
||||
);
|
||||
return Result.success(listMap);
|
||||
} else if("GDHHY".equals(type.getDesignId())) {
|
||||
List<NutMap> listMap = userService.queryMeetingCount(
|
||||
meetingId,
|
||||
"worker_congress_delegate",
|
||||
RoleConstant.WORKER_CONGRESS_DELEGATE_FORMAL.name(),
|
||||
RoleConstant.WORKER_CONGRESS_DELEGATE_ATTENDANCE.name(),
|
||||
info.getWorkerCongressSessionId()
|
||||
);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取人员名单")
|
||||
@SaCheckPermission("meeting.statistics")
|
||||
public Result queryUserTable(PageForm pageForm,
|
||||
String meetingId,
|
||||
String type,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String periodId) {
|
||||
MeetingInfo info = dao.fetch(MeetingInfo.class, meetingId);
|
||||
MeetingType meetingType = dao.fetch(MeetingType.class, info.getTypeId());
|
||||
|
||||
Pagination pagination = userService.queryUserTable(pageForm, info, meetingType, type, unionId, unitId, periodId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("meeting.statistics")
|
||||
public void exportUser(@Param(value = "periodId") String periodId,
|
||||
@Param(value = "meetingId") String meetingId,
|
||||
@Param(value = "exportColumns") NutMap[] exportColumns,
|
||||
HttpServletResponse response) {
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entityList.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitName", 30));
|
||||
entityList.add(new ExcelExportEntity("分工会", "unionName", 35));
|
||||
|
||||
MeetingInfo info = dao.fetch(MeetingInfo.class, meetingId);
|
||||
MeetingType meetingType = dao.fetch(MeetingType.class, info.getTypeId());
|
||||
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
for (NutMap exportColumn : exportColumns) {
|
||||
List<NutMap> listMap = userService.queryUserTable(info, meetingType, exportColumn.getString("prop"), periodId);
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setTitle(exportColumn.getString("label"));
|
||||
exportParams.setSheetName(exportColumn.getString("label"));
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
service.createSheetForMap(workbook, exportParams, entityList, listMap);
|
||||
}
|
||||
|
||||
CommonDownloadUtil.download("人员列表.xlsx", workbook, response);
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.budwk.app.zhgh.dayofficework.meeting.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.model.MeetingInfo;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.model.MeetingTimePeriodUser;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.model.MeetingType;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName MeetingUserService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/9/1 10:46
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface MeetingUserService extends BaseService<MeetingTimePeriodUser> {
|
||||
|
||||
Pagination queryUserTable(PageForm pageForm,
|
||||
MeetingInfo info,
|
||||
MeetingType meetingType,
|
||||
String type,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String periodId);
|
||||
|
||||
List<NutMap> queryUserTable(MeetingInfo info, MeetingType meetingType, String type, String periodId);
|
||||
|
||||
List<NutMap> queryMeetingCount(String meetingId, String tableName, String formalRoleCode, String attendanceRoleCode, String sessionId);
|
||||
|
||||
<T> List<String> queryDelegateIds(Class<T> delegateClass, String sessionId, String roleCode);
|
||||
}
|
||||
+8
-8
@@ -84,18 +84,18 @@ public class MeetingOnlineServiceImpl extends BaseServiceImpl<MeetingInfo> imple
|
||||
MeetingTimePeriod timePeriod = dao().fetch(MeetingTimePeriod.class, timePeriodId);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
(select count(1) from meeting_time_period_user where timePeriodId = @timePeriodId) as shouldComeNumber,
|
||||
(select count(1) from meeting_time_period_user where timePeriodId = @timePeriodId and (joinStatus is null or (joinStatus is not null ) and signStatus is null)) as actualComeNumber,
|
||||
(select count(1) from meeting_time_period_user where timePeriodId = @timePeriodId and signStatus = 1) as signInNumber,
|
||||
(select count(1) from meeting_time_period_user where timePeriodId = @timePeriodId and joinStatus = 0 ) as leaveNumber
|
||||
(select count(1) from meeting_time_period_user where timePeriodId = @timePeriodId) as totalCount,
|
||||
(select count(1) from meeting_time_period_user where timePeriodId = @timePeriodId and joinStatus = 1 and signStatus = 0) as noComeCount,
|
||||
(select count(1) from meeting_time_period_user where timePeriodId = @timePeriodId and signStatus = 1) as comeCount,
|
||||
(select count(1) from meeting_time_period_user where timePeriodId = @timePeriodId and joinStatus = 0) as leaveCount
|
||||
""");
|
||||
sql.setParam("timePeriodId", timePeriodId);
|
||||
NutMap dataMap = (NutMap) Daos.query(dao(), sql.toString(), Sqls.callback.map());
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.add(Map.of("label", "应到人数", "key", "shouldComeNumber", "value", dataMap.getInt("shouldComeNumber", 0)));
|
||||
list.add(Map.of("label", "未到人数", "key", "actualComeNumber", "value", dataMap.getInt("actualComeNumber", 0)));
|
||||
list.add(Map.of("label", "签到人数", "key", "signInNumber", "value", dataMap.getInt("signInNumber", 0)));
|
||||
list.add(Map.of("label", "应到人数", "key", "totalCount", "value", dataMap.getInt("totalCount", 0)));
|
||||
list.add(Map.of("label", "未到人数", "key", "noComeCount", "value", dataMap.getInt("noComeCount", 0)));
|
||||
list.add(Map.of("label", "签到人数", "key", "comeCount", "value", dataMap.getInt("comeCount", 0)));
|
||||
|
||||
//如果是教代会,就查询签到的正式代表和列席代表各多少人
|
||||
MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, timePeriod.getMeetingId());
|
||||
@@ -118,7 +118,7 @@ public class MeetingOnlineServiceImpl extends BaseServiceImpl<MeetingInfo> imple
|
||||
Worker_congress_delegate.class
|
||||
);
|
||||
}
|
||||
list.add(Map.of("label", "请假人数", "key", "leaveNumber", "value", dataMap.getInt("leaveNumber", 0)));
|
||||
list.add(Map.of("label", "请假人数", "key", "leaveCount", "value", dataMap.getInt("leaveCount", 0)));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
package com.budwk.app.zhgh.dayofficework.meeting.service.impl;
|
||||
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.model.MeetingInfo;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.model.MeetingTimePeriodUser;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.model.MeetingType;
|
||||
import com.budwk.app.zhgh.dayofficework.meeting.service.MeetingUserService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
|
||||
import com.budwk.app.zhgh.democratic.workercongress.models.Worker_congress_delegate;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @ClassName MeetingUserServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/9/1 10:47
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MeetingUserServiceImpl extends BaseServiceImpl<MeetingTimePeriodUser> implements MeetingUserService {
|
||||
|
||||
@Inject
|
||||
private SysRoleService roleService;
|
||||
|
||||
public MeetingUserServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination queryUserTable(PageForm pageForm, MeetingInfo info, MeetingType meetingType, String type, String unionId, String unitId, String periodId) {
|
||||
Sql sql = this.generateSql(pageForm, info, meetingType.getDesignId(), type, unionId, unitId, periodId);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> queryUserTable(MeetingInfo info, MeetingType meetingType, String type, String periodId) {
|
||||
Sql sql = this.generateSql(null, info, meetingType.getDesignId(), type, null, null, periodId);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> queryMeetingCount(String meetingId, String tableName, String formalRoleCode, String attendanceRoleCode, String sessionId) {
|
||||
Sys_role formalRole = roleService.getByCode(formalRoleCode);
|
||||
Sys_role attendanceRole = roleService.getByCode(attendanceRoleCode);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
mtp.*,
|
||||
count( mtpu.id ) AS totalCount,
|
||||
sum( CASE WHEN mtpu.joinStatus = 0 THEN 1 ELSE 0 END ) AS leaveCount,
|
||||
sum( CASE WHEN mtpu.signStatus = 1 THEN 1 ELSE 0 END ) AS comeCount,
|
||||
sum( CASE WHEN mtpu.joinStatus = 1 AND mtpu.signStatus = 0 THEN 1 ELSE 0 END ) AS noComeCount,
|
||||
sum( CASE WHEN (mtpu.signStatus = 1) AND (d.roleId = @formalRole) AND d.sessionId = @sessionId THEN 1 ELSE 0 END) as formalRoleCount,
|
||||
sum( CASE WHEN (mtpu.signStatus = 1) AND (d.roleId = @attendanceRole) AND d.sessionId = @sessionId THEN 1 ELSE 0 END) as attendanceRoleCount
|
||||
FROM
|
||||
meeting_time_period mtp
|
||||
LEFT JOIN meeting_time_period_user mtpu ON mtpu.timePeriodId = mtp.id
|
||||
LEFT JOIN $tableName d on d.userId = mtpu.userId and d.sessionId = @sessionId
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("formalRole", formalRole.getId());
|
||||
sql.setParam("attendanceRole", attendanceRole.getId());
|
||||
sql.setParam("sessionId", sessionId);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("mtp.meetingId", "=", meetingId);
|
||||
cnd.desc("mtp.startTime");
|
||||
cnd.groupBy("mtp.id");
|
||||
|
||||
sql.setVar("tableName", tableName);
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<String> queryDelegateIds(Class<T> delegateClass, String sessionId, String roleCode) {
|
||||
Sys_role role = roleService.getByCode(roleCode);
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
// 查询代表
|
||||
List<T> list = dao().query(delegateClass, Cnd.where("sessionId", "=", sessionId));
|
||||
for (T delegate : list) {
|
||||
try {
|
||||
// 获取 roleId 字段值
|
||||
Field roleIdField = delegateClass.getDeclaredField("roleId");
|
||||
roleIdField.setAccessible(true);
|
||||
String roleId = (String) roleIdField.get(delegate);
|
||||
|
||||
// 获取 userId 字段值
|
||||
Field userIdField = delegateClass.getDeclaredField("userId");
|
||||
userIdField.setAccessible(true);
|
||||
String userId = (String) userIdField.get(delegate);
|
||||
|
||||
if(Objects.equals(roleId, role.getId())) {
|
||||
result.add(userId);
|
||||
}
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Sql generateSql(PageForm pageForm,
|
||||
MeetingInfo info,
|
||||
String designId,
|
||||
String type,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String periodId) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
mtpu.*,
|
||||
u.sex,
|
||||
u.mobile
|
||||
from
|
||||
meeting_time_period_user mtpu
|
||||
left join vw_user u on u.id = mtpu.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
switch (type) {
|
||||
case "comeCount" -> cnd.and(MeetingTimePeriodUser::getSignStatus, "=", true);
|
||||
case "formalRoleCount" -> {
|
||||
cnd.and(MeetingTimePeriodUser::getSignStatus, "=", true);
|
||||
if ("JDHHY".equals(designId)) {
|
||||
cnd.and(MeetingTimePeriodUser::getUserId, "in", this.queryDelegateIds(Teacher_congress_delegate.class, info.getTeacherCongressSessionId(), RoleConstant.TEACHER_CONGRESS_DELEGATE_FORMAL.name()));
|
||||
} else if ("GDHHY".equals(designId)) {
|
||||
cnd.and(MeetingTimePeriodUser::getUserId, "in", this.queryDelegateIds(Worker_congress_delegate.class, info.getWorkerCongressSessionId(), RoleConstant.WORKER_CONGRESS_DELEGATE_FORMAL.name()));
|
||||
}
|
||||
}
|
||||
case "attendanceRoleCount" -> {
|
||||
cnd.and(MeetingTimePeriodUser::getSignStatus, "=", true);
|
||||
if ("JDHHY".equals(designId)) {
|
||||
cnd.and(MeetingTimePeriodUser::getUserId, "in", this.queryDelegateIds(Teacher_congress_delegate.class, info.getTeacherCongressSessionId(), RoleConstant.TEACHER_CONGRESS_DELEGATE_ATTENDANCE.name()));
|
||||
} else if ("GDHHY".equals(designId)) {
|
||||
cnd.and(MeetingTimePeriodUser::getUserId, "in", this.queryDelegateIds(Worker_congress_delegate.class, info.getWorkerCongressSessionId(), RoleConstant.WORKER_CONGRESS_DELEGATE_ATTENDANCE.name()));
|
||||
}
|
||||
}
|
||||
case "leaveCount" -> cnd.and(MeetingTimePeriodUser::getJoinStatus, "=", false);
|
||||
case "noComeCount" -> cnd.and(MeetingTimePeriodUser::getJoinStatus, "=", true).and(MeetingTimePeriodUser::getSignStatus, "=", false);
|
||||
}
|
||||
cnd.and(MeetingTimePeriodUser::getTimePeriodId, "=", periodId);
|
||||
cnd.andEX("mtpu.unitId", "=", unitId);
|
||||
cnd.andEX("mtpu.unionId", "=", unionId);
|
||||
if (pageForm != null && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("mtpu.userName", pageForm.getSearchKeyword());
|
||||
seg.orLike("mtpu.loginName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.desc("mtpu.unitId");
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package com.budwk.app.zhgh.dayofficework.site.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
||||
@@ -54,7 +55,7 @@ public class SiteApplyServiceImpl extends BaseServiceImpl<SiteApply> implements
|
||||
sql.setCondition(cnd);
|
||||
List<SiteApply> applyList = listEntity(sql);
|
||||
long hasReserve = applyList.stream().filter(o -> o.getApplyUserId().equals(SecurityUtil.getUserId())).count();
|
||||
if(hasReserve > 0) {
|
||||
if(StrUtil.isBlank(apply.getId()) && hasReserve > 0) {
|
||||
return Map.of(false, "您已预约该时间段");
|
||||
}
|
||||
int count = applyList.stream().mapToInt(SiteApply::getJoinCount).sum();
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import lombok.EqualsAndHashCode;
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class GrassrootsCongressPageForm extends PageForm<GrassrootsCongressPageForm> {
|
||||
public class GrassrootsCongressPageForm extends PageForm {
|
||||
|
||||
private Integer year;
|
||||
|
||||
|
||||
+40
-4
@@ -10,6 +10,7 @@ import com.budwk.app.zhgh.democratic.proposal.service.ProposalExportService;
|
||||
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;
|
||||
@@ -48,7 +49,34 @@ public class ProposalExportComprehensiveController {
|
||||
@SaCheckPermission("proposal.query.comprehensive")
|
||||
@ApiOperation(value = "分页列表")
|
||||
public Result pageData(@Valid @Param("pageForm") ProposalQueryComprehensiveParam pageForm) {
|
||||
Sql sql = proposalExportService.exportComprehensiveSql(pageForm);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
COUNT(p.consolidationIds) > 0 AS isConsolidation,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.displayName curTaskName,
|
||||
JSON_UNQUOTE(JSON_EXTRACT(caseTasks.variable, '$.tf_hostUnitName')) AS masterUnitName,
|
||||
caseTasks.variable->>'$.tf_helpUnitNameStr' AS slaveUnitNames
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_consolidation p ON JSON_CONTAINS(p.consolidationIds, JSON_QUOTE(info.id))
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN teacher_congress_delegate tcde on tcde.loginName = info.createUserLoginName
|
||||
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
|
||||
LEFT JOIN (SELECT processInstanceId, MAX(finishTime) AS finishTime FROM wf_process_task WHERE taskName = '9846ab38-40c5-4093-bafc-a9b3b443338b' AND taskState = 20 GROUP BY processInstanceId) latestTasks ON latestTasks.processInstanceId = ins.id
|
||||
LEFT JOIN wf_process_task caseTasks ON caseTasks.processInstanceId = ins.id AND caseTasks.taskName = '9846ab38-40c5-4093-bafc-a9b3b443338b' AND caseTasks.taskState = 20 AND caseTasks.finishTime = latestTasks.finishTime
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
@@ -60,10 +88,10 @@ public class ProposalExportComprehensiveController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出提案汇总表excel")
|
||||
@ApiOperation("导出汇总表excel")
|
||||
@SaCheckPermission("proposal.query.comprehensive")
|
||||
public void exportProposalSummaryAsExcel(@Valid @Param("pageForm") ProposalQueryComprehensiveParam pageForm, HttpServletResponse response){
|
||||
proposalExportService.exportProposalSummaryAsExcel(pageForm, response);
|
||||
public void exportSummaryAsExcel(@Valid @Param("pageForm") ProposalQueryComprehensiveParam pageForm, HttpServletResponse response){
|
||||
proposalExportService.exportSummaryAsExcel(pageForm, response);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,4 +119,12 @@ public class ProposalExportComprehensiveController {
|
||||
proposalExportService.exportFeedBackAsZip(pageForm, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出征集表ZIP")
|
||||
@SaCheckPermission("proposal.query.comprehensive")
|
||||
public void exportCollectZip(@Valid @Param("pageForm") ProposalQueryComprehensiveParam pageForm, HttpServletResponse response){
|
||||
proposalExportService.exportCollectZip(pageForm, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class ProposalQueryComprehensiveController {
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.displayName curTaskName,
|
||||
JSON_UNQUOTE(JSON_EXTRACT(caseTasks.variable, '$.tf_hostUnitName')) AS masterUnitName,
|
||||
JSON_EXTRACT(caseTasks.variable, '$.tf_helpUnitNames') AS slaveUnitNames
|
||||
caseTasks.variable->>'$.tf_helpUnitNameStr' AS slaveUnitNames
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_consolidation p ON JSON_CONTAINS(p.consolidationIds, JSON_QUOTE(info.id))
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class ProposalQueryHistoryController {
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.displayName curTaskName,
|
||||
JSON_UNQUOTE(JSON_EXTRACT(caseTasks.variable, '$.tf_hostUnitName')) AS masterUnitName,
|
||||
JSON_EXTRACT(caseTasks.variable, '$.tf_helpUnitNames') AS slaveUnitNames
|
||||
caseTasks.variable->>'$.tf_helpUnitNameStr' AS slaveUnitNames
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_consolidation p ON JSON_CONTAINS(p.consolidationIds, JSON_QUOTE(info.id))
|
||||
|
||||
+11
-5
@@ -91,11 +91,12 @@ public class ProposalQueryUnitReplyController {
|
||||
for (String underTakeId : underTakeIds) {
|
||||
NutMap tableRow = NutMap.NEW();
|
||||
tableRow.put("id", underTakeId);
|
||||
if(undertakeMap.get(underTakeId) == null){
|
||||
continue;
|
||||
}
|
||||
tableRow.put("name", undertakeMap.get(underTakeId).getName());
|
||||
|
||||
//找出承办提案总数
|
||||
// long sum = caseTasks.stream().filter(v -> (Json.fromJson(NutMap.class, v.getVariable())).getString("tf_hostUnitId").equals(underTakeId) || (Json.fromJson(NutMap.class, v.getVariable())).getAsList("helpUnitIds", String.class).contains(underTakeId)).map(ProcessTask::getProcessInstanceId).collect(Collectors.toSet()).size();
|
||||
|
||||
long sum = caseTasks.stream()
|
||||
.filter(v -> {
|
||||
NutMap variable = Json.fromJson(NutMap.class, v.getVariable());
|
||||
@@ -115,17 +116,22 @@ public class ProposalQueryUnitReplyController {
|
||||
.distinct()
|
||||
.count();
|
||||
|
||||
//找出主办提案数量
|
||||
// 主办提案数量
|
||||
long hostSum = masterUnitTasks.stream().map(v -> Json.fromJson(NutMap.class, v.getVariable())).filter(variable -> underTakeId.equals(variable.getString("unitId")) && variable.getBoolean("isMaster")).count();
|
||||
//主办已答复的数量
|
||||
// 主办已答复的数量
|
||||
long hostReplySum = masterUnitTasks.stream().filter(v -> Objects.equals(v.getTaskState(), ProcessTaskStateEnum.FINISHED.getCode())).map(v -> Json.fromJson(NutMap.class, v.getVariable())).filter(variable -> underTakeId.equals(variable.getString("unitId")) && variable.getBoolean("isMaster")).count();
|
||||
//主办未答复的数量
|
||||
// 主办未答复的数量
|
||||
long hostNoReplySum = hostSum - hostReplySum;
|
||||
|
||||
|
||||
// 协办提案数量
|
||||
long slaveSum = slaveUnitTasks.stream().map(v -> Json.fromJson(NutMap.class, v.getVariable())).filter(variable -> underTakeId.equals(variable.getString("unitId")) && !variable.getBoolean("isMaster")).count();
|
||||
|
||||
tableRow.put("sum", sum);
|
||||
tableRow.put("hostSum", hostSum);
|
||||
tableRow.put("hostReplySum", hostReplySum);
|
||||
tableRow.put("hostNoReplySum", hostNoReplySum);
|
||||
tableRow.put("slaveSum", slaveSum);
|
||||
|
||||
// if (slaveNeedReply) {
|
||||
// //协办提案数量
|
||||
|
||||
@@ -112,6 +112,11 @@ public class ProposalInfo extends BaseModel {
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String excerpt;
|
||||
|
||||
@Column
|
||||
@Comment("调研情况")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String researchFindings;
|
||||
|
||||
@Column
|
||||
@Comment("案由")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.budwk.app.zhgh.democratic.proposal.param;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -13,7 +12,7 @@ import org.nutz.dao.Cnd;
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ProposalSearchParam extends PageForm<ProposalInfo> {
|
||||
public class ProposalSearchParam extends PageForm {
|
||||
|
||||
private String name;
|
||||
private String code;
|
||||
|
||||
+23
-1
@@ -6,6 +6,7 @@ import com.budwk.app.zhgh.democratic.proposal.param.ProposalQueryComprehensivePa
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
@@ -18,6 +19,7 @@ public interface ProposalExportService extends BaseService<ProposalInfo> {
|
||||
|
||||
/**
|
||||
* 某些页面的公共SQL,用于导出或者综合查询
|
||||
*
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
@@ -25,13 +27,15 @@ public interface ProposalExportService extends BaseService<ProposalInfo> {
|
||||
|
||||
/**
|
||||
* 导出提案汇总表excel
|
||||
*
|
||||
* @param pageForm
|
||||
* @param response
|
||||
*/
|
||||
void exportProposalSummaryAsExcel(ProposalQueryComprehensiveParam pageForm, HttpServletResponse response);
|
||||
void exportSummaryAsExcel(ProposalQueryComprehensiveParam pageForm, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导出提案立案汇总表excel
|
||||
*
|
||||
* @param pageForm
|
||||
* @param response
|
||||
*/
|
||||
@@ -39,6 +43,7 @@ public interface ProposalExportService extends BaseService<ProposalInfo> {
|
||||
|
||||
/**
|
||||
* 导出提案统计表zip
|
||||
*
|
||||
* @param pageForm
|
||||
* @param response
|
||||
*/
|
||||
@@ -46,8 +51,25 @@ public interface ProposalExportService extends BaseService<ProposalInfo> {
|
||||
|
||||
/**
|
||||
* 导出反馈表
|
||||
*
|
||||
* @param pageForm
|
||||
* @param response
|
||||
*/
|
||||
void exportFeedBackAsZip(ProposalQueryComprehensiveParam pageForm, HttpServletResponse response);
|
||||
|
||||
|
||||
/**
|
||||
* 导出征集表docx
|
||||
* @param id
|
||||
* @param byteArrayOutputStream
|
||||
*/
|
||||
void exportCollectDocx(String id, ByteArrayOutputStream byteArrayOutputStream);
|
||||
|
||||
/**
|
||||
* 导出征集表zip
|
||||
*
|
||||
* @param pageForm
|
||||
* @param response
|
||||
*/
|
||||
void exportCollectZip(ProposalQueryComprehensiveParam pageForm, HttpServletResponse response);
|
||||
}
|
||||
|
||||
+8
@@ -32,6 +32,14 @@ public interface ProposalCommonService extends BaseService<ProposalInfo> {
|
||||
*/
|
||||
void exportProposalFeedBackAsDocx(String id,ByteArrayOutputStream byteArrayOutputStream);
|
||||
|
||||
|
||||
/**
|
||||
* 导出征集表
|
||||
* @param id
|
||||
* @param byteArrayOutputStream
|
||||
*/
|
||||
void exportCollectAsDocx(String id, ByteArrayOutputStream byteArrayOutputStream);
|
||||
|
||||
/**
|
||||
* 根据提案id查询团长
|
||||
*
|
||||
|
||||
+80
-181
@@ -18,11 +18,17 @@ import com.budwk.app.bpm.models.BpmProcessTask;
|
||||
import com.budwk.app.bpm.service.BpmService;
|
||||
import com.budwk.app.bpm.vo.BpmProcessTaskVo;
|
||||
import com.budwk.app.bpm.vo.BpmTaskApprovalRecordVo;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalConsolidation;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_session;
|
||||
@@ -204,187 +210,6 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
|
||||
docData.put("info", info);
|
||||
|
||||
//查询附议人信息
|
||||
BpmProcessInstance bpmProcessInstance = dao().fetch(BpmProcessInstance.class, Cnd.where(BpmProcessInstance::getProcessInstanceBusinessId, "=", id));
|
||||
BpmProcessTask lastestWriteTask = dao().fetch(BpmProcessTask.class, Cnd.where(BpmProcessTask::getProcessInstanceId, "=", bpmProcessInstance.getId())
|
||||
.and(BpmProcessTask::getTaskStatus, "=", BpmProcessTaskStatusEnum.COMPLETE.name())
|
||||
.and(BpmProcessTask::getProcessTaskNodeCode, "=", 10)
|
||||
.and(BpmProcessTask::getDelFlag, "=", 0)
|
||||
.desc(BpmProcessTask::getEndOn)
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(lastestWriteTask)) {
|
||||
String lastestWriteTaskId = lastestWriteTask.getId();
|
||||
List<BpmProcessTask> seconderTasks = dao().query(BpmProcessTask.class, Cnd.where(BpmProcessTask::getPrevTaskId, "=", lastestWriteTaskId)
|
||||
.and(BpmProcessTask::getProcessInstanceId, "=", bpmProcessInstance.getId())
|
||||
.and(BpmProcessTask::getTaskStatus, "!=", BpmProcessTaskStatusEnum.REVOKE.name())
|
||||
.and(BpmProcessTask::getDelFlag, "=", 0)
|
||||
.asc(BpmProcessTask::getCreatedOn)
|
||||
);
|
||||
List<HashMap<String, Object>> seconders = seconderTasks.stream().filter(v -> v.getTaskStatus().equals(BpmProcessTaskStatusEnum.COMPLETE.name()) && ObjectUtil.isNotEmpty(v.getExtVariable().getStr("bpmTaskApprovalType").equals("PASS"))).map(v -> {
|
||||
HashMap<String, Object> seconderApproval = new HashMap<>();
|
||||
seconderApproval.put("userName", v.getCreateVariable().getStr("userName"));
|
||||
seconderApproval.put("loginName", v.getCreateVariable().getStr("loginName"));
|
||||
seconderApproval.put("unitName", v.getCreateVariable().getStr("unitName"));
|
||||
return seconderApproval;
|
||||
}).toList();
|
||||
|
||||
docData.put("seconders", seconders);
|
||||
}
|
||||
|
||||
//审批记录
|
||||
List<BpmTaskApprovalRecordVo> nodeTasks = bpmService.getNodeTasks(BpmProcessConstant.PROPOSAL, id);
|
||||
|
||||
//团长审核
|
||||
nodeTasks.stream().filter(v -> v.getNodeCode() == 30)
|
||||
.flatMap(v -> v.getTasks().stream())
|
||||
.max(Comparator.comparing(BpmProcessTaskVo::getEndOn))
|
||||
.ifPresent(v -> {
|
||||
HashMap<String, Object> delegationApproval = new HashMap<>();
|
||||
delegationApproval.put("date", DateUtil.format(v.getEndOn(), "yyyy年MM月dd日"));
|
||||
delegationApproval.put("user", v.getActualOwnerUserName());
|
||||
if (ObjectUtil.isNotEmpty(v.getExtVariable())) {
|
||||
delegationApproval.put("opinion", v.getExtVariable().getStr("approvalOpinion"));
|
||||
delegationApproval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(v.getExtVariable().getStr("approvalSignature")));
|
||||
}
|
||||
docData.put("tz", delegationApproval);
|
||||
});
|
||||
|
||||
//委员会立案
|
||||
nodeTasks.stream().filter(v -> v.getNodeCode() == 60)
|
||||
.flatMap(v -> v.getTasks().stream())
|
||||
.max(Comparator.comparing(BpmProcessTaskVo::getEndOn))
|
||||
.ifPresent(v -> {
|
||||
HashMap<String, Object> committeeApproval = new HashMap<>();
|
||||
committeeApproval.put("date", DateUtil.format(v.getEndOn(), "yyyy年MM月dd日"));
|
||||
committeeApproval.put("user", v.getActualOwnerUserName());
|
||||
if (ObjectUtil.isNotEmpty(v.getExtVariable())) {
|
||||
committeeApproval.put("opinion", v.getExtVariable().getStr("approvalOpinion"));
|
||||
committeeApproval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(v.getExtVariable().getStr("approvalSignature")));
|
||||
committeeApproval.put("hostUnit", v.getExtVariable().getStr("hostUnit"));
|
||||
if (ObjectUtil.isNotEmpty(v.getExtVariable().getBeanList("helpUnits", String.class))) {
|
||||
committeeApproval.put("helpUnits", String.join("、", v.getExtVariable().getBeanList("helpUnits", String.class)));
|
||||
}
|
||||
}
|
||||
docData.put("wyh", committeeApproval);
|
||||
});
|
||||
|
||||
//委员会确认承办单位
|
||||
nodeTasks.stream().filter(v -> v.getNodeCode() == 70)
|
||||
.flatMap(v -> v.getTasks().stream())
|
||||
.max(Comparator.comparing(BpmProcessTaskVo::getEndOn))
|
||||
.ifPresent(v -> {
|
||||
HashMap<String, Object> committeeConfirm = new HashMap<>();
|
||||
committeeConfirm.put("date", DateUtil.format(v.getEndOn(), "yyyy年MM月dd日"));
|
||||
committeeConfirm.put("user", v.getActualOwnerUserName());
|
||||
if (ObjectUtil.isNotEmpty(v.getExtVariable())) {
|
||||
committeeConfirm.put("opinion", v.getExtVariable().getStr("approvalOpinion"));
|
||||
committeeConfirm.put("sign", sysOfficeTemplateUtil.createPictureRenderData(v.getExtVariable().getStr("approvalSignature")));
|
||||
committeeConfirm.put("hostUnit", v.getExtVariable().getStr("hostUnit"));
|
||||
if (ObjectUtil.isNotEmpty(v.getExtVariable().getBeanList("helpUnits", String.class))) {
|
||||
committeeConfirm.put("helpUnits", String.join("、", v.getExtVariable().getBeanList("helpUnits", String.class)));
|
||||
}
|
||||
}
|
||||
docData.put("wyhConfirm", committeeConfirm);
|
||||
});
|
||||
|
||||
//主办单位答复
|
||||
nodeTasks.stream().filter(v -> v.getNodeCode() == 80)
|
||||
.flatMap(v -> v.getTasks().stream())
|
||||
.filter(v1 -> ObjectUtil.isNotEmpty(v1.getCreateVariable()) && v1.getCreateVariable().getBool("isMaster"))
|
||||
.max(Comparator.comparing(BpmProcessTaskVo::getEndOn))
|
||||
.ifPresent(v -> {
|
||||
HashMap<String, Object> masterUnderTakeReply = new HashMap<>();
|
||||
masterUnderTakeReply.put("name", v.getCreateVariable().getStr("underTakeName"));
|
||||
masterUnderTakeReply.put("date", DateUtil.format(v.getEndOn(), "yyyy年MM月dd日"));
|
||||
masterUnderTakeReply.put("user", v.getActualOwnerUserName());
|
||||
if (ObjectUtil.isNotEmpty(v.getExtVariable())) {
|
||||
masterUnderTakeReply.put("opinion", v.getExtVariable().getStr("approvalOpinion"));
|
||||
masterUnderTakeReply.put("implementState", v.getExtVariable().getStr("implementState"));
|
||||
masterUnderTakeReply.put("sign", sysOfficeTemplateUtil.createPictureRenderData(v.getExtVariable().getStr("approvalSignature")));
|
||||
}
|
||||
docData.put("zbdf", masterUnderTakeReply);
|
||||
});
|
||||
|
||||
//协办单位答复
|
||||
List<HashMap<String, Object>> slaveUnderTakeReplyList = new ArrayList<>();
|
||||
nodeTasks.stream().filter(v -> v.getNodeCode() == 80).flatMap(v -> v.getTasks().stream())
|
||||
.filter(v1 -> ObjectUtil.isNotEmpty(v1.getCreateVariable()) && !v1.getCreateVariable().getBool("isMaster"))
|
||||
.collect(Collectors.groupingBy(v1 -> v1.getCreateVariable().getStr("underTakeId")))
|
||||
.forEach((k, v1) -> {
|
||||
v1.stream().max(Comparator.comparing(BpmProcessTask::getEndOn)).ifPresent(v2 -> {
|
||||
HashMap<String, Object> slaveUnderTakeReply = new HashMap<>();
|
||||
slaveUnderTakeReply.put("name", v2.getCreateVariable().getStr("underTakeName"));
|
||||
slaveUnderTakeReply.put("date", DateUtil.format(v2.getEndOn(), "yyyy年MM月dd日"));
|
||||
slaveUnderTakeReply.put("user", v2.getActualOwnerUserName());
|
||||
if (ObjectUtil.isNotEmpty(v2.getExtVariable())) {
|
||||
slaveUnderTakeReply.put("opinion",HtmlUtil.cleanHtmlTag(StrUtil.blankToDefault(v2.getExtVariable().getStr("approvalOpinion"), "")));
|
||||
slaveUnderTakeReply.put("implementState", v2.getExtVariable().getStr("implementState"));
|
||||
slaveUnderTakeReply.put("sign", sysOfficeTemplateUtil.createPictureRenderData(v2.getExtVariable().getStr("approvalSignature")));
|
||||
}
|
||||
slaveUnderTakeReplyList.add(slaveUnderTakeReply);
|
||||
});
|
||||
});
|
||||
docData.put("xbdf", slaveUnderTakeReplyList);
|
||||
|
||||
//主办校领导审批
|
||||
nodeTasks.stream().filter(v -> v.getNodeCode() == 90)
|
||||
.flatMap(v -> v.getTasks().stream())
|
||||
.filter(v1 -> ObjectUtil.isNotEmpty(v1.getCreateVariable()) && v1.getCreateVariable().getBool("isMaster"))
|
||||
.max(Comparator.comparing(BpmProcessTaskVo::getEndOn))
|
||||
.ifPresent(v -> {
|
||||
HashMap<String, Object> masterLeaderApproval = new HashMap<>();
|
||||
masterLeaderApproval.put("date", DateUtil.format(v.getEndOn(), "yyyy年MM月dd日"));
|
||||
masterLeaderApproval.put("user", v.getActualOwnerUserName());
|
||||
if (ObjectUtil.isNotEmpty(v.getExtVariable())) {
|
||||
masterLeaderApproval.put("opinion", v.getExtVariable().getStr("approvalOpinion"));
|
||||
masterLeaderApproval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(v.getExtVariable().getStr("approvalSignature")));
|
||||
}
|
||||
docData.put("zbldsp", masterLeaderApproval);
|
||||
});
|
||||
|
||||
List<HashMap<String, Object>> slaveLeaderApprovalList = new ArrayList<>();
|
||||
|
||||
//协办校领导审批
|
||||
nodeTasks.stream().filter(v -> v.getNodeCode() == 90).flatMap(v -> v.getTasks().stream())
|
||||
.filter(v1 -> ObjectUtil.isNotEmpty(v1.getCreateVariable()) && !v1.getCreateVariable().getBool("isMaster"))
|
||||
.collect(Collectors.groupingBy(v1 -> v1.getCreateVariable().getStr("underTakeId")))
|
||||
.forEach((k, v1) -> {
|
||||
v1.stream().max(Comparator.comparing(BpmProcessTask::getEndOn)).ifPresent(v2 -> {
|
||||
HashMap<String, Object> slaveLeaderApproval = new HashMap<>();
|
||||
slaveLeaderApproval.put("name", v2.getCreateVariable().getStr("underTakeName"));
|
||||
slaveLeaderApproval.put("date", DateUtil.format(v2.getEndOn(), "yyyy年MM月dd日"));
|
||||
slaveLeaderApproval.put("user", v2.getActualOwnerUserName());
|
||||
if (ObjectUtil.isNotEmpty(v2.getExtVariable())) {
|
||||
slaveLeaderApproval.put("opinion", v2.getExtVariable().getStr("approvalOpinion"));
|
||||
slaveLeaderApproval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(v2.getExtVariable().getStr("approvalSignature")));
|
||||
}
|
||||
slaveLeaderApprovalList.add(slaveLeaderApproval);
|
||||
});
|
||||
});
|
||||
docData.put("xbldsp", slaveLeaderApprovalList);
|
||||
|
||||
//反馈评分
|
||||
nodeTasks.stream().filter(v -> v.getNodeCode() == 100)
|
||||
.flatMap(v -> v.getTasks().stream())
|
||||
.max(Comparator.comparing(BpmProcessTaskVo::getEndOn))
|
||||
.ifPresent(v -> {
|
||||
HashMap<String, Object> feedbackScore = new HashMap<>();
|
||||
feedbackScore.put("date", DateUtil.format(v.getEndOn(), "yyyy年MM月dd日"));
|
||||
feedbackScore.put("user", v.getActualOwnerUserName());
|
||||
if (ObjectUtil.isNotEmpty(v.getExtVariable())) {
|
||||
feedbackScore.put("opinion", v.getExtVariable().getStr("approvalOpinion"));
|
||||
String feedBackScore = v.getExtVariable().getStr("feedBackScore", "");
|
||||
feedbackScore.put("manyi", feedBackScore.equals("满意") ? "√" : "");
|
||||
feedbackScore.put("jibenmanyi", feedBackScore.equals("基本满意") ? "√" : "");
|
||||
feedbackScore.put("bumanyi", feedBackScore.equals("不满意") ? "√" : "");
|
||||
}
|
||||
docData.put("fk", feedbackScore);
|
||||
});
|
||||
|
||||
AttachmentRenderData attachmentRenderData = Attachments.ofLocal("C:\\Users\\zxy\\Desktop\\1.七届二次教代会提案反馈表(xxx部门).docx").create();
|
||||
docData.put("attachment", attachmentRenderData);
|
||||
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
|
||||
htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true);
|
||||
@@ -517,6 +342,80 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportCollectAsDocx(String id, ByteArrayOutputStream byteArrayOutputStream) {
|
||||
if (id == null || id.isEmpty()) {
|
||||
throw new BaseException("提案信息不存在");
|
||||
}
|
||||
|
||||
//基本信息
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.name,
|
||||
info.code,
|
||||
info.researchFindings,
|
||||
info.brief,
|
||||
info.measures,
|
||||
info.createUserName,
|
||||
tcde.unitName,
|
||||
tcde.mobile,
|
||||
type.name AS typeName,
|
||||
tcs.j,
|
||||
tcs.c,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN teacher_congress_delegate tcde on tcde.loginName = info.createUserLoginName
|
||||
WHERE info.id = @id
|
||||
""").setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
execute(sql);
|
||||
NutMap info = (NutMap) sql.getResult();
|
||||
HashMap<String, Object> docData = new HashMap<>(info);
|
||||
|
||||
//处理下富文本
|
||||
String brief = info.getString("brief");
|
||||
String measures = info.getString("measures");
|
||||
info.put("brief", sysOfficeTemplateUtil.convertRichTextToDocText(brief));
|
||||
info.put("measures", sysOfficeTemplateUtil.convertRichTextToDocText(measures));
|
||||
|
||||
// 高校
|
||||
info.put("schoolName", Globals.AppName);
|
||||
|
||||
// 附议人信息
|
||||
ProcessInstance instance = dao().fetch(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "=", id));
|
||||
|
||||
// 查询附议人信息
|
||||
ProcessTask inviteTask = dao().fetch(ProcessTask.class, Cnd.where(ProcessTask::getProcessInstanceId, "=", instance.getId())
|
||||
.and(ProcessTask::getTaskName, "=", "85b7b9bd-d706-48cb-99a1-ef1370fb1819")
|
||||
.and(ProcessTask::getTaskState, "in", List.of(ProcessTaskStateEnum.DOING.getCode(), ProcessTaskStateEnum.FINISHED.getCode()))
|
||||
.desc(ProcessTask::getCreatedAt));
|
||||
NutMap variable = Json.fromJson(NutMap.class, inviteTask.getVariable());
|
||||
List<NutMap> seconders = variable.getAsList(FlowConst.TASK_FORM_DATA_PREFIX + "seconder", NutMap.class);
|
||||
docData.put("seconders", seconders);
|
||||
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
|
||||
htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true);
|
||||
|
||||
Configure config = Configure.builder()
|
||||
.bind("seconders", policy)
|
||||
.bind("brief", htmlRenderPolicy)
|
||||
.bind("measures", htmlRenderPolicy)
|
||||
.build();
|
||||
|
||||
try {
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("proposal"), config).render(docData).writeAndClose(byteArrayOutputStream);
|
||||
} catch (IOException e) {
|
||||
log.error("提案导出失败{},提案id:{}", e.getMessage(), id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDelegationHeadByProposalId(String proposalId) {
|
||||
ProposalInfo proposalInfo = dao().fetch(ProposalInfo.class, proposalId);
|
||||
|
||||
+199
-24
@@ -8,40 +8,52 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalQueryComprehensiveParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalExportService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_session;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.ddr.poi.html.HtmlRenderPolicy;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ProposalExportServiceImpl
|
||||
* @Date 2024/10/10 10:28
|
||||
* @注释
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> implements ProposalExportService {
|
||||
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
@Inject
|
||||
private SysOfficeTemplateUtil sysOfficeTemplateUtil;
|
||||
|
||||
|
||||
public ProposalExportServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
@@ -139,37 +151,77 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportProposalSummaryAsExcel(ProposalQueryComprehensiveParam pageForm, HttpServletResponse response) {
|
||||
// 自定义导出 excel
|
||||
Sql sql = exportComprehensiveSql(pageForm);
|
||||
public void exportSummaryAsExcel(ProposalQueryComprehensiveParam pageForm, HttpServletResponse response) {
|
||||
// 基本信息查询
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.name,
|
||||
info.code,
|
||||
info.researchFindings,
|
||||
info.brief,
|
||||
info.measures,
|
||||
info.createUserName,
|
||||
tcde.unitName,
|
||||
tcde.mobile,
|
||||
type.name AS typeName,
|
||||
tcs.j,
|
||||
tcs.c,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN teacher_congress_delegate tcde on tcde.loginName = info.createUserLoginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
// 导出的数据
|
||||
List<NutMap> list = listMap(sql);
|
||||
for (NutMap row : list) {
|
||||
String content = HtmlUtil.cleanHtmlTag(StrUtil.blankToDefault(row.getString("masterUnderTakeReply"), ""));
|
||||
row.put("masterUnderTakeReply", content);
|
||||
// 添加序号,去除富文本,获取附议人
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).put("index", i + 1);
|
||||
list.get(i).put("brief",HtmlUtil.cleanHtmlTag(list.get(i).getString("brief")));
|
||||
list.get(i).put("measures",HtmlUtil.cleanHtmlTag(list.get(i).getString("measures")));
|
||||
|
||||
// 流程实例
|
||||
ProcessInstance instance = dao().fetch(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "=", list.get(i).getString("id")));
|
||||
|
||||
// 查询附议人信息
|
||||
ProcessTask inviteTask = dao().fetch(ProcessTask.class,
|
||||
Cnd.where(ProcessTask::getProcessInstanceId, "=", instance.getId())
|
||||
.and(ProcessTask::getTaskName, "=", "85b7b9bd-d706-48cb-99a1-ef1370fb1819")
|
||||
.and(ProcessTask::getTaskState, "in",
|
||||
List.of(ProcessTaskStateEnum.DOING.getCode(), ProcessTaskStateEnum.FINISHED.getCode()))
|
||||
.desc(ProcessTask::getCreatedAt));
|
||||
|
||||
if (inviteTask != null) {
|
||||
NutMap variable = Json.fromJson(NutMap.class, inviteTask.getVariable());
|
||||
List<NutMap> seconders = variable.getAsList(FlowConst.TASK_FORM_DATA_PREFIX + "seconder", NutMap.class);
|
||||
list.get(i).put("secondedUserNames", seconders.stream().map(v->v.getString("userName")).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("序号", "index", 10));
|
||||
exportEntities.add(new ExcelExportEntity("提案编号", "code", 20));
|
||||
exportEntities.add(new ExcelExportEntity("提案名称", "name", 20));
|
||||
exportEntities.add(new ExcelExportEntity("提案类别", "typeName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("提案摘要", "excerpt", 100));
|
||||
exportEntities.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("提案案由", "brief", 40));
|
||||
exportEntities.add(new ExcelExportEntity("代表调研情况", "researchFindings", 40));
|
||||
exportEntities.add(new ExcelExportEntity("代表建议措施", "measures", 40));
|
||||
exportEntities.add(new ExcelExportEntity("提案人", "createUserName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("附议人", "secondedUserNames", 40));
|
||||
exportEntities.add(new ExcelExportEntity("立案结果", "caseFilingResultName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("主办单位", "masterUnderTakeName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("协办单位", "slaveUnderTakeNamesStr", 30));
|
||||
exportEntities.add(new ExcelExportEntity("承办单位答复", "masterUnderTakeReply", 30));
|
||||
exportEntities.add(new ExcelExportEntity("备注", "remark", 30));
|
||||
exportEntities.add(new ExcelExportEntity("提案状态", "processInstanceNodeName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("提案人电话", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("附议人(两名)", "secondedUserNames", 20));
|
||||
exportEntities.add(new ExcelExportEntity("提案单位", "unitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("拟交办单位", "", 20));
|
||||
|
||||
Teacher_congress_session session = dao().fetch(Teacher_congress_session.class, pageForm.getSessionId());
|
||||
String title = StrUtil.format("第{}届教职工代表大会第{}次会议提案汇总表", session.getJ(), session.getC());
|
||||
String title = StrUtil.format("{}第{}{}教代会提案征集汇总表", Globals.AppName, session.getJ(), session.getC());
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
@@ -324,6 +376,129 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportCollectDocx(String id, ByteArrayOutputStream byteArrayOutputStream) {
|
||||
// 基本信息查询
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.name,
|
||||
info.code,
|
||||
info.researchFindings,
|
||||
info.brief,
|
||||
info.measures,
|
||||
info.createUserName,
|
||||
tcde.unitName,
|
||||
tcde.mobile,
|
||||
type.name AS typeName,
|
||||
tcs.j,
|
||||
tcs.c,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN teacher_congress_delegate tcde on tcde.loginName = info.createUserLoginName
|
||||
WHERE info.id = @id
|
||||
""").setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
execute(sql);
|
||||
|
||||
NutMap info = (NutMap) sql.getResult();
|
||||
// 处理富文本内容
|
||||
info.put("brief", sysOfficeTemplateUtil.convertRichTextToDocText(info.getString("brief")));
|
||||
info.put("measures", sysOfficeTemplateUtil.convertRichTextToDocText(info.getString("measures")));
|
||||
|
||||
// 添加高校信息
|
||||
info.put("schoolName", Globals.AppName);
|
||||
|
||||
// 创建docData,直接复用info中的数据
|
||||
HashMap<String, Object> docData = new HashMap<>(info);
|
||||
|
||||
// 流程实例
|
||||
ProcessInstance instance = dao().fetch(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "=", id));
|
||||
|
||||
if (instance != null) {
|
||||
// 查询附议人信息
|
||||
ProcessTask inviteTask = dao().fetch(ProcessTask.class,
|
||||
Cnd.where(ProcessTask::getProcessInstanceId, "=", instance.getId())
|
||||
.and(ProcessTask::getTaskName, "=", "85b7b9bd-d706-48cb-99a1-ef1370fb1819")
|
||||
.and(ProcessTask::getTaskState, "in",
|
||||
List.of(ProcessTaskStateEnum.DOING.getCode(), ProcessTaskStateEnum.FINISHED.getCode()))
|
||||
.desc(ProcessTask::getCreatedAt));
|
||||
|
||||
if (inviteTask != null) {
|
||||
NutMap variable = Json.fromJson(NutMap.class, inviteTask.getVariable());
|
||||
if (variable != null) {
|
||||
List<NutMap> seconders = variable.getAsList(FlowConst.TASK_FORM_DATA_PREFIX + "seconder", NutMap.class);
|
||||
docData.put("seconders", seconders != null ? seconders : Collections.emptyList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 配置渲染策略
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
|
||||
htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true);
|
||||
|
||||
Configure config = Configure.builder()
|
||||
.bind("seconders", policy)
|
||||
.bind("brief", htmlRenderPolicy)
|
||||
.bind("measures", htmlRenderPolicy)
|
||||
.build();
|
||||
|
||||
try {
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("proposal_collect"), config)
|
||||
.render(docData)
|
||||
.writeAndClose(byteArrayOutputStream);
|
||||
} catch (IOException e) {
|
||||
log.error("提案导出失败,提案id:{},错误信息:{}", id, e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportCollectZip(ProposalQueryComprehensiveParam pageForm, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.code,
|
||||
info.name
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN teacher_congress_delegate tcde on tcde.loginName = info.createUserLoginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
try {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(bos);
|
||||
for (NutMap proposalRow : list) {
|
||||
try (ByteArrayOutputStream docxByteArrayOutputStream = new ByteArrayOutputStream()) {
|
||||
exportCollectDocx(proposalRow.getString("id"), docxByteArrayOutputStream);
|
||||
ZipEntry zipEntry = new ZipEntry("征集表-" + proposalRow.getString("code") + "-" + proposalRow.getString("name") + ".docx");
|
||||
zipOutputStream.putNextEntry(zipEntry);
|
||||
docxByteArrayOutputStream.writeTo(zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
} catch (IOException e) {
|
||||
// 处理单个文件生成失败的情况
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
zipOutputStream.close();
|
||||
CommonDownloadUtil.download("提案征集表压缩包.zip", bos.toByteArray(), response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -3,7 +3,6 @@ package com.budwk.app.zhgh.democratic.suggestion.param;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.democratic.suggestion.models.SuggestionInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -13,7 +12,7 @@ import org.nutz.dao.Cnd;
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class SuggestionSearchParam extends PageForm<SuggestionInfo> {
|
||||
public class SuggestionSearchParam extends PageForm {
|
||||
|
||||
private String name;
|
||||
private String code;
|
||||
|
||||
+46
-2
@@ -10,6 +10,7 @@ import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.suggestionBox.service.SuggestionBoxService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
@@ -18,7 +19,9 @@ 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.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@@ -39,7 +42,7 @@ public class SuggestionXghController {
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result pageData(PageForm pageForm, String title, Integer year, boolean approval) {
|
||||
public Result pageData(PageForm pageForm, String taskId, String title, Integer year, boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
@@ -99,5 +102,46 @@ public class SuggestionXghController {
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("查询任务")
|
||||
public Result queryTask(@Valid @Param("taskId") String taskId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.title,
|
||||
info.userName,
|
||||
info.loginName,
|
||||
info.unitName,
|
||||
info.unionName,
|
||||
info.submitTime,
|
||||
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 suggestion_box 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
|
||||
WHERE t.id = @taskId
|
||||
""");
|
||||
sql.setParam("taskId", taskId);
|
||||
NutMap data = suggestionBoxService.fetchMap(sql);
|
||||
return Result.success(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.budwk.app.zhgh.mall.controller.buy;
|
||||
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MallBuyHomeController
|
||||
* @Date 2025/8/6 11:14
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/mall/buy/home")
|
||||
public class MallBuyHomeController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/mall/buy/home/index.html")
|
||||
// @SaCheckPermission("mall.category.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.budwk.app.zhgh.mall.controller.buy;
|
||||
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MallCartHomeController
|
||||
* @Date 2025/8/6 16:20
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/mall/buy/cart")
|
||||
public class MallCartHomeController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/mall/buy/cart/index.html")
|
||||
// @SaCheckPermission("mall.category.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package com.budwk.app.zhgh.mall.controller.manage.goods;
|
||||
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.mall.models.entity.goods.MallCategory;
|
||||
import com.budwk.app.zhgh.mall.param.goods.MallCategorySearchParams;
|
||||
import com.budwk.app.zhgh.mall.service.goods.MallCategoryService;
|
||||
import com.budwk.app.zhgh.mall.models.vo.goods.MallCategoryVO;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MallCategoryManagerController
|
||||
* @Date 2025/7/16 9:23
|
||||
* @注释 商品分类
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/mall/category/manage")
|
||||
public class MallCategoryManagerController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MallCategoryService categoryService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/mall/manage/goods/category/index.html")
|
||||
// @SaCheckPermission("mall.category.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询某分类下的全部子分类列表
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
@At("/all-children")
|
||||
// @SaCheckPermission("mall.category.manage")
|
||||
public Result list(@Valid String parentId){
|
||||
List<MallCategory> query = dao.query(MallCategory.class, Cnd.where("parentId", "=", parentId).asc("sortOrder"));
|
||||
return Result.success(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部分类列表
|
||||
* @param categorySearchParams
|
||||
* @return
|
||||
*/
|
||||
@At("/allChildren")
|
||||
// @SaCheckPermission("mall.category.manage")
|
||||
public Result list(MallCategorySearchParams categorySearchParams){
|
||||
List<MallCategoryVO> mallCategoryVOList = categoryService.listCategory(categorySearchParams);
|
||||
return Result.success(mallCategoryVOList);
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "商品分类", msg = "添加商品分类")
|
||||
// @SaCheckPermission("mall.category.manage")
|
||||
public Result saveCategory(MallCategory category){
|
||||
if (category.getParentId() != null && !"0".equals(category.getParentId())) {
|
||||
int count = dao.count(MallCategory.class, Cnd.where("id", "=", category.getParentId()));
|
||||
if (count == 0) {
|
||||
return Result.error("该分类名称已存在");
|
||||
}
|
||||
if (category.getLevel() >= 4) {
|
||||
return Result.error("最多为三级分类,添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
categoryService.saveCategory(category);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "商品分类", msg = "修改商品分类")
|
||||
// @SaCheckPermission("mall.category.manage")
|
||||
public Result updateCategory(@Valid MallCategoryVO category) {
|
||||
int count = dao.count(MallCategory.class, Cnd.where(MallCategory::getId, "=", category.getId()));
|
||||
if (count == 0) {
|
||||
return Result.error("该分类不存在");
|
||||
}
|
||||
|
||||
//判断父分类与子分类的状态是否一致
|
||||
if (category.getParentId() != null && !"0".equals(category.getParentId())) {
|
||||
MallCategory parentCategory = dao.fetch(MallCategory.class, Cnd.where(MallCategory::getId, "=", category.getParentId()));
|
||||
if (!parentCategory.getDelFlag().equals(category.getDelFlag())) {
|
||||
return Result.error("父分类与子分类状态不一致");
|
||||
}
|
||||
}
|
||||
|
||||
dao.update(category);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "商品分类", msg = "删除商品分类")
|
||||
// @SaCheckPermission("mall.category.manage")
|
||||
public Result delAllByIds(@Valid String id) {
|
||||
MallCategory category = new MallCategory();
|
||||
category.setParentId(id);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("level", "=", category.getLevel());
|
||||
cnd.andEX("name", "=", category.getName());
|
||||
cnd.andEX("parentId", "=", category.getParentId());
|
||||
cnd.andEX("id", "<>", category.getId());
|
||||
cnd.andEX("delFlag", "=", false);
|
||||
cnd.asc("sortOrder");
|
||||
List<MallCategory> list = dao.query(MallCategory.class, cnd);
|
||||
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
return Result.error("此类别下存在子类别不能删除");
|
||||
}
|
||||
|
||||
// int count = dao.count(MallGoods.class, Cnd.where(MallGoods::getCategoryPath, "=", category.getId()).and(MallGoods::getDelFlag, "=", false));
|
||||
// if (count > 0) {
|
||||
// return Result.error("此类别下存在商品不能删除");
|
||||
// }
|
||||
|
||||
dao.clear(MallCategory.class, Cnd.where(MallCategory::getId, "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "商品分类", msg = "后台 禁用/启用 分类")
|
||||
// @SaCheckPermission("mall.category.manage")
|
||||
public Result disable(@Valid String id, Boolean enableOperations){
|
||||
int count = dao.count(MallCategory.class, Cnd.where(MallCategory::getId, "=", id));
|
||||
if (count == 0) {
|
||||
return Result.error("商品分类不存在");
|
||||
}
|
||||
|
||||
categoryService.updateCategoryStatus(id, enableOperations);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.budwk.app.zhgh.mall.controller.manage.goods;
|
||||
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MallGoodsStoreController
|
||||
* @Date 2025/7/16 17:02
|
||||
* @注释 商品仓库管理
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/mall/goods/manage")
|
||||
public class MallGoodsManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/mall/goods/goodsManage.html")
|
||||
// @SaCheckPermission("mall.goods.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.budwk.app.zhgh.mall.controller.manage.goods;
|
||||
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.mall.models.dto.goods.MallGoodsOperationDTO;
|
||||
import com.budwk.app.zhgh.mall.models.vo.goods.MallGoodsVO;
|
||||
import com.budwk.app.zhgh.mall.service.goods.MallGoodsService;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:MallGoodsStoreController
|
||||
* @Date 2025/7/16 17:09
|
||||
* @注释 商品添加管理
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/mall/goods/store")
|
||||
public class MallGoodsStoreController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private MallGoodsService goodsService;
|
||||
|
||||
@At("")
|
||||
// @SaCheckPermission("mall.goods.store")
|
||||
@Ok("beetl:/platform/zhgh/mall/manage/goods/add/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
// @SaCheckPermission("mall.goods.store")
|
||||
@SLog(tag = "添加商品", msg = "商品名称:${args[0].goodsName}")
|
||||
public Result save(@Valid MallGoodsOperationDTO goodsOperationDTO) {
|
||||
goodsService.addGoods(goodsOperationDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
// @SaCheckPermission("mall.goods.store")
|
||||
@SLog(tag = "修改商品", msg = "商品名称:${args[0].goodsName}")
|
||||
public Result update(@Valid @Param("goodsOperationDTO") MallGoodsOperationDTO goodsOperationDTO, @Param("goodsId") String goodsId){
|
||||
goodsService.editGoods(goodsOperationDTO, goodsId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
// @SaCheckPermission("mall.goods.store")
|
||||
public Result getGoodsStoreById(@Valid String id){
|
||||
MallGoodsVO goodsVO = goodsService.getGoodsVO(id);
|
||||
return Result.success().addData(goodsVO);
|
||||
}
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.dto;
|
||||
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.entity.GoodsGalleryDO;
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.entity.GoodsParamsDO;
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.vo.ExchangeVO;
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.vo.GoodsMobileIntroVO;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品vo
|
||||
*
|
||||
* @author fk
|
||||
* @version v2.0
|
||||
* @since v7.0.0
|
||||
* 2018年3月21日 上午11:25:10
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class GoodsDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3922135264669953741L;
|
||||
|
||||
@ApiModelProperty("商品id")
|
||||
private Long goodsId;
|
||||
|
||||
@ApiModelProperty("分类id")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 用作显示
|
||||
*/
|
||||
@ApiModelProperty("分类名称")
|
||||
private String categoryName;
|
||||
|
||||
@ApiModelProperty("店铺分类id")
|
||||
@Min(value = 0, message = "店铺分类值不正确")
|
||||
private Long shopCatId;
|
||||
|
||||
@ApiModelProperty("品牌id")
|
||||
private Long brandId;
|
||||
|
||||
@ApiModelProperty("商品名称")
|
||||
@NotEmpty(message = "商品名称不能为空")
|
||||
private String goodsName;
|
||||
|
||||
@ApiModelProperty("商品编号")
|
||||
@Length(max = 30,message = "商品编号太长,不能超过30个字符")
|
||||
private String sn;
|
||||
|
||||
@ApiModelProperty("商品价格")
|
||||
@NotNull(message = "商品价格不能为空")
|
||||
@Min(value = 0, message = "商品价格不能为负数")
|
||||
@Max(value = 99999999, message = "商品价格不能超过99999999")
|
||||
private Double price;
|
||||
|
||||
@ApiModelProperty("成本价格")
|
||||
@NotNull(message = "成本价格不能为空")
|
||||
@Min(value = 0, message = "成本价格不能为负数")
|
||||
@Max(value = 99999999, message = "成本价格不能超过99999999")
|
||||
private Double cost;
|
||||
|
||||
@ApiModelProperty("市场价格")
|
||||
@NotNull(message = "市场价格不能为空")
|
||||
@Min(value = 0, message = "市场价格不能为负数")
|
||||
@Max(value = 99999999, message = "市场价格不能超过99999999")
|
||||
private Double mktprice;
|
||||
|
||||
@ApiModelProperty("重量")
|
||||
@NotNull(message = "商品重量不能为空")
|
||||
@Min(value = 0, message = "重量不能为负数")
|
||||
@Max(value = 99999999,message = "重量不能超过99999999")
|
||||
private Double weight;
|
||||
|
||||
@ApiModelProperty("谁承担运费0:买家承担,1:卖家承担")
|
||||
@NotNull(message = "承担运费不能为空")
|
||||
@Min(value = 0, message = "承担运费值不正确")
|
||||
@Max(value = 1, message = "承担运费值不正确")
|
||||
private Integer goodsTransfeeCharge;
|
||||
|
||||
@ApiModelProperty("详情")
|
||||
private String intro;
|
||||
|
||||
@ApiModelProperty("是否有规格0没有1有")
|
||||
private Integer haveSpec;
|
||||
|
||||
@ApiModelProperty("库存")
|
||||
@Max(value = 99999999, message = "库存不能超过99999999")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty("是否上架,1上架 0下架")
|
||||
@Min(value = 0, message = "是否上架值不正确")
|
||||
@Max(value = 1, message = "是否上架值不正确")
|
||||
private Integer marketEnable;
|
||||
|
||||
@ApiModelProperty("商品参数")
|
||||
@Valid
|
||||
private List<GoodsParamsDO> goodsParamsList;
|
||||
|
||||
@ApiModelProperty("商品相册")
|
||||
@NotNull(message = "商品相册图片不能为空")
|
||||
@Size(min = 1,message = "商品相册图片不能为空")
|
||||
private List<GoodsGalleryDO> goodsGalleryList;
|
||||
|
||||
@ApiModelProperty("积分兑换对象,不是积分兑换商品可以不传")
|
||||
private ExchangeVO exchange;
|
||||
|
||||
@ApiModelProperty("sku数据变化或者组合变化判断 0:没变化,1:变化")
|
||||
private Integer hasChanged;
|
||||
|
||||
@ApiModelProperty("seo标题")
|
||||
private String pageTitle;
|
||||
|
||||
@ApiModelProperty("seo关键字")
|
||||
private String metaKeywords;
|
||||
|
||||
@ApiModelProperty("seo描述")
|
||||
private String metaDescription;
|
||||
|
||||
@ApiModelProperty("商品的评论数量")
|
||||
private Integer commentNum;
|
||||
|
||||
@ApiModelProperty("运费模板id,不需要运费模板时值是0")
|
||||
private Long templateId;
|
||||
|
||||
@ApiModelProperty("商品是否审核")
|
||||
private Integer isAuth;
|
||||
|
||||
@ApiModelProperty("可用库存")
|
||||
private Integer enableQuantity;
|
||||
|
||||
@ApiModelProperty("商品移动端详情数据集合")
|
||||
private List<GoodsMobileIntroVO> introList;
|
||||
|
||||
@ApiModelProperty("商品视频")
|
||||
private String goodsVideo;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoodsDTO{" +
|
||||
"goodsId=" + goodsId +
|
||||
", categoryId=" + categoryId +
|
||||
", categoryName='" + categoryName + '\'' +
|
||||
", shopCatId=" + shopCatId +
|
||||
", brandId=" + brandId +
|
||||
", goodsName='" + goodsName + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", price=" + price +
|
||||
", cost=" + cost +
|
||||
", mktprice=" + mktprice +
|
||||
", weight=" + weight +
|
||||
", goodsTransfeeCharge=" + goodsTransfeeCharge +
|
||||
", intro='" + intro + '\'' +
|
||||
", haveSpec=" + haveSpec +
|
||||
", quantity=" + quantity +
|
||||
", marketEnable=" + marketEnable +
|
||||
", goodsParamsList=" + goodsParamsList +
|
||||
", goodsGalleryList=" + goodsGalleryList +
|
||||
", exchange=" + exchange +
|
||||
", hasChanged=" + hasChanged +
|
||||
", pageTitle='" + pageTitle + '\'' +
|
||||
", metaKeywords='" + metaKeywords + '\'' +
|
||||
", metaDescription='" + metaDescription + '\'' +
|
||||
", commentNum=" + commentNum +
|
||||
", templateId=" + templateId +
|
||||
", isAuth=" + isAuth +
|
||||
", enableQuantity=" + enableQuantity +
|
||||
", introList=" + introList +
|
||||
", goodsVideo='" + goodsVideo + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 品牌实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Table("mall_brand")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class BrandDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 9122931201151887L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long brandId;
|
||||
|
||||
/**
|
||||
* 品牌名称
|
||||
*/
|
||||
@Column
|
||||
@Comment("品牌名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 品牌图标
|
||||
*/
|
||||
@Column
|
||||
@Comment("品牌图标")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 是否删除,0删除1未删除
|
||||
*/
|
||||
@Column
|
||||
@Comment("是否删除")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer disabled;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[brandId=" + brandId + ", name=" + name + ", logo=" + logo + ", disabled=" + disabled + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 分类品牌关联表实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Comment("分类品牌关联表实体")
|
||||
@Table("mall_category_brand")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class CategoryBrandDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3315719881926878L;
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
@Column
|
||||
@Comment("品牌id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long brandId;
|
||||
|
||||
public CategoryBrandDO(Long categoryId, Long brandId) {
|
||||
super();
|
||||
this.categoryId = categoryId;
|
||||
this.brandId = brandId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CategoryBrandDO [categoryId=" + categoryId + ", brandId=" + brandId + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* 商品分类实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Comment("商品分类实体")
|
||||
@Table("mall_category")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class CategoryDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1964321416223565L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 分类父id
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类父id,顶级0")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 分类父子路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类父子路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String categoryPath;
|
||||
|
||||
/**
|
||||
* 该分类下商品数量
|
||||
*/
|
||||
@Column
|
||||
@Comment("该分类下商品数量")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer goodsCount;
|
||||
|
||||
/**
|
||||
* 分类排序
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类排序")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer categoryOrder;
|
||||
|
||||
/**
|
||||
* 分类图标
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类图标")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 是否显示 YES:是,NO:否
|
||||
*/
|
||||
@Column
|
||||
@Comment("是否显示 YES:是,NO:否")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String isShow;
|
||||
|
||||
/**
|
||||
* 分类广告图片
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类广告图片")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String advImage;
|
||||
|
||||
/**
|
||||
* 分类广告图片链接
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类广告图片链接")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String advImageLink;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
CategoryDO that = (CategoryDO) o;
|
||||
return Objects.equals(categoryId, that.categoryId) &&
|
||||
Objects.equals(name, that.name) &&
|
||||
Objects.equals(parentId, that.parentId) &&
|
||||
Objects.equals(categoryPath, that.categoryPath) &&
|
||||
Objects.equals(goodsCount, that.goodsCount) &&
|
||||
Objects.equals(categoryOrder, that.categoryOrder) &&
|
||||
Objects.equals(image, that.image) &&
|
||||
Objects.equals(isShow, that.isShow) &&
|
||||
Objects.equals(advImage, that.advImage) &&
|
||||
Objects.equals(advImageLink, that.advImageLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(categoryId, name, parentId, categoryPath, goodsCount, categoryOrder, image, isShow, advImage, advImageLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CategoryDO{" +
|
||||
"categoryId=" + categoryId +
|
||||
", name='" + name + '\'' +
|
||||
", parentId=" + parentId +
|
||||
", categoryPath='" + categoryPath + '\'' +
|
||||
", goodsCount=" + goodsCount +
|
||||
", categoryOrder=" + categoryOrder +
|
||||
", image='" + image + '\'' +
|
||||
", isShow='" + isShow + '\'' +
|
||||
", advImage='" + advImage + '\'' +
|
||||
", advImageLink='" + advImageLink + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 分类规格关联表实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("mall_category_spec")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class CategorySpecDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3127259064985991L;
|
||||
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 规格id
|
||||
*/
|
||||
@Column
|
||||
@Comment("规格id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long specId;
|
||||
|
||||
public CategorySpecDO(Long categoryId, Long specId) {
|
||||
super();
|
||||
this.categoryId = categoryId;
|
||||
this.specId = specId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CategorySpecDO [categoryId=" + categoryId + ", specId=" + specId + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,307 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.dto.GoodsDTO;
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.enums.GoodsType;
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.vo.GoodsMobileIntroVO;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 草稿商品实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("mall_draft_goods")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class DraftGoodsDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7646662730625878L;
|
||||
|
||||
/**
|
||||
* 草稿商品id
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long draftGoodsId;
|
||||
/**
|
||||
* 商品编号
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String sn;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String goodsName;
|
||||
/**
|
||||
* 商品品牌ID
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品品牌ID")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long brandId;
|
||||
/**
|
||||
* 商品分类ID
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品分类ID")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 商品重量
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品重量")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double weight;
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品详情")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private String intro;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品价格")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double price;
|
||||
/**
|
||||
* 商品成本价
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品成本价")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double cost;
|
||||
/**
|
||||
* 商品市场价
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品市场价")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double mktprice;
|
||||
/**
|
||||
* 商品类型
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String goodsType;
|
||||
/**
|
||||
* 是否开启规格
|
||||
*/
|
||||
@Column
|
||||
@Comment("是否开启规格")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer haveSpec;
|
||||
/**
|
||||
* 商品添加时间
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品添加时间")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long createTime;
|
||||
/**
|
||||
* 商品总库存
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品总库存")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 商品原始图片
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品原始图片")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String original;
|
||||
/**
|
||||
* 商品所属卖家ID
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品所属卖家ID")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long sellerId;
|
||||
/**
|
||||
* 商品所属店铺类目ID
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品所属店铺类目ID")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long shopCatId;
|
||||
/**
|
||||
* 商品运费模板ID
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品运费模板ID")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long templateId;
|
||||
/**
|
||||
* 是否为买家承担运费
|
||||
*/
|
||||
@Column
|
||||
@Comment("是否为买家承担运费")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer goodsTransfeeCharge;
|
||||
/**
|
||||
* 商品所属店铺名称
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品所属店铺名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String sellerName;
|
||||
/**
|
||||
* seo 标题
|
||||
*/
|
||||
@Column
|
||||
@Comment("seo 标题")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String pageTitle;
|
||||
/**
|
||||
* seo关键字
|
||||
*/
|
||||
@Column
|
||||
@Comment("seo关键字")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String metaKeywords;
|
||||
/**
|
||||
* seo描述
|
||||
*/
|
||||
@Column
|
||||
@Comment("seo描述")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private String metaDescription;
|
||||
/**
|
||||
* 积分商品需要的金额
|
||||
*/
|
||||
@Column
|
||||
@Comment("积分商品需要的金额")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double exchangeMoney;
|
||||
/**
|
||||
* 积分商品需要的积分
|
||||
*/
|
||||
@Column
|
||||
@Comment("积分商品需要的积分")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer exchangePoint;
|
||||
/**
|
||||
* 积分商品的分类id
|
||||
*/
|
||||
@Column
|
||||
@Comment("积分商品的分类id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long exchangeCategoryId;
|
||||
|
||||
/**
|
||||
* 商品移动端详情
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品移动端详情")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private String mobileIntro;
|
||||
|
||||
/**
|
||||
* 商品视频
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品视频")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String goodsVideo;
|
||||
|
||||
private List<String> galleryList;
|
||||
|
||||
public DraftGoodsDO(GoodsDTO goodsVO) {
|
||||
|
||||
this.draftGoodsId = goodsVO.getGoodsId();
|
||||
this.categoryId = goodsVO.getCategoryId();
|
||||
this.shopCatId = goodsVO.getShopCatId();
|
||||
this.brandId = goodsVO.getBrandId();
|
||||
this.goodsName = goodsVO.getGoodsName();
|
||||
this.sn = goodsVO.getSn();
|
||||
this.price = goodsVO.getPrice() == null ? 0 : goodsVO.getPrice();
|
||||
this.cost = goodsVO.getCost() == null ? 0 : goodsVO.getCost();
|
||||
this.mktprice = goodsVO.getMktprice() == null ? 0 : goodsVO.getMktprice();
|
||||
this.weight = goodsVO.getWeight() == null ? 0 : goodsVO.getWeight();
|
||||
this.goodsTransfeeCharge = goodsVO.getGoodsTransfeeCharge();
|
||||
this.intro = goodsVO.getIntro();
|
||||
this.haveSpec = goodsVO.getHaveSpec();
|
||||
if (goodsVO.getExchange() != null && goodsVO.getExchange().getEnableExchange() == 1) {
|
||||
this.goodsType = GoodsType.POINT.name();
|
||||
this.exchangeMoney = goodsVO.getExchange().getExchangeMoney();
|
||||
this.exchangePoint = goodsVO.getExchange().getExchangePoint();
|
||||
this.exchangeCategoryId = goodsVO.getExchange().getCategoryId();
|
||||
} else {
|
||||
this.goodsType = GoodsType.NORMAL.name();
|
||||
this.exchangeMoney = 0.00;
|
||||
this.exchangePoint = 0;
|
||||
this.exchangeCategoryId = 1L;
|
||||
}
|
||||
this.pageTitle = goodsVO.getPageTitle();
|
||||
this.metaKeywords = goodsVO.getMetaKeywords();
|
||||
this.metaDescription = goodsVO.getMetaDescription();
|
||||
this.templateId = goodsVO.getTemplateId();
|
||||
|
||||
List<GoodsMobileIntroVO> introList = goodsVO.getIntroList();
|
||||
if (introList != null && !introList.isEmpty()) {
|
||||
this.mobileIntro = JSONUtil.toJsonStr(introList);
|
||||
}
|
||||
|
||||
this.goodsVideo = goodsVO.getGoodsVideo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DraftGoodsDO{" +
|
||||
"draftGoodsId=" + draftGoodsId +
|
||||
", sn='" + sn + '\'' +
|
||||
", goodsName='" + goodsName + '\'' +
|
||||
", brandId=" + brandId +
|
||||
", categoryId=" + categoryId +
|
||||
", weight=" + weight +
|
||||
", intro='" + intro + '\'' +
|
||||
", price=" + price +
|
||||
", cost=" + cost +
|
||||
", mktprice=" + mktprice +
|
||||
", goodsType='" + goodsType + '\'' +
|
||||
", haveSpec=" + haveSpec +
|
||||
", createTime=" + createTime +
|
||||
", quantity=" + quantity +
|
||||
", original='" + original + '\'' +
|
||||
", sellerId=" + sellerId +
|
||||
", shopCatId=" + shopCatId +
|
||||
", templateId=" + templateId +
|
||||
", goodsTransfeeCharge=" + goodsTransfeeCharge +
|
||||
", sellerName='" + sellerName + '\'' +
|
||||
", pageTitle='" + pageTitle + '\'' +
|
||||
", metaKeywords='" + metaKeywords + '\'' +
|
||||
", metaDescription='" + metaDescription + '\'' +
|
||||
", exchangeMoney=" + exchangeMoney +
|
||||
", exchangePoint=" + exchangePoint +
|
||||
", exchangeCategoryId=" + exchangeCategoryId +
|
||||
", mobileIntro='" + mobileIntro + '\'' +
|
||||
", goodsVideo='" + goodsVideo + '\'' +
|
||||
", galleryList=" + galleryList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 草稿商品参数表实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("mall_draft_goods_params")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class DraftGoodsParamsDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1137617128769441L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long id;
|
||||
/**
|
||||
* 草稿ID
|
||||
*/
|
||||
@Column
|
||||
@Comment("草稿id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long draftGoodsId;
|
||||
/**
|
||||
* 参数ID
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long paramId;
|
||||
/**
|
||||
* 参数名
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String paramName;
|
||||
/**
|
||||
* 参数值
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数值")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String paramValue;
|
||||
|
||||
public DraftGoodsParamsDO(GoodsParamsDO param) {
|
||||
this.paramId = param.getParamId();
|
||||
this.paramName = param.getParamName();
|
||||
this.paramValue = param.getParamValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DraftGoodsParamsDO [id=" + id + ", draftGoodsId=" + draftGoodsId + ", paramId=" + paramId
|
||||
+ ", paramName=" + paramName + ", paramValue=" + paramValue + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.vo.GoodsSkuVO;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 草稿商品sku实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Table("mall_draft_goods_sku")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class DraftGoodsSkuDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 5684194304207265L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long draftSkuId;
|
||||
/**
|
||||
* 草稿id
|
||||
*/
|
||||
@Column
|
||||
@Comment("草稿id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long draftGoodsId;
|
||||
/**
|
||||
* 货号
|
||||
*/
|
||||
@Column
|
||||
@Comment("货号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String sn;
|
||||
/**
|
||||
* 总库存
|
||||
*/
|
||||
@Column
|
||||
@Comment("货号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
@Column
|
||||
@Comment("货号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private Double price;
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@Column
|
||||
@Comment("货号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String specs;
|
||||
/**
|
||||
* 成本
|
||||
*/
|
||||
@Column
|
||||
@Comment("货号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private Double cost;
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@Column
|
||||
@Comment("货号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private Double weight;
|
||||
|
||||
public DraftGoodsSkuDO() {
|
||||
}
|
||||
|
||||
public DraftGoodsSkuDO(GoodsSkuVO skuVO) {
|
||||
this.setDraftGoodsId(skuVO.getGoodsId());
|
||||
this.setSn(skuVO.getSn());
|
||||
this.setPrice(skuVO.getPrice());
|
||||
this.setCost(skuVO.getCost());
|
||||
this.setWeight(skuVO.getWeight());
|
||||
this.setQuantity(skuVO.getQuantity());
|
||||
this.setSpecs(skuVO.getSpecs());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DraftGoodsSkuDO [draftSkuId=" + draftSkuId + ", draftGoodsId=" + draftGoodsId + ", sn=" + sn
|
||||
+ ", quantity=" + quantity + ", price=" + price + ", specs=" + specs + ", cost=" + cost + ", weight="
|
||||
+ weight + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,481 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.dto.GoodsDTO;
|
||||
import com.budwk.app.zhgh.mall.manage.models.goods.vo.GoodsMobileIntroVO;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 商品实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("mall_goods")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class GoodsDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 9115135430405642L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long goodsId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String goodsName;
|
||||
/**
|
||||
* 商品编号
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String sn;
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
@Column
|
||||
@Comment("品牌id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long brandId;
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 商品类型normal普通point积分
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品类型NORMAL普通POINT积分")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String goodsType;
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@Column
|
||||
@Comment("重量")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double weight;
|
||||
/**
|
||||
* 上架状态 1上架 0下架
|
||||
*/
|
||||
@Column
|
||||
@Comment("上架状态 1上架 0下架")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer marketEnable;
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@Column
|
||||
@Comment("详情")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private String intro;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品价格")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double price;
|
||||
/**
|
||||
* 成本价格
|
||||
*/
|
||||
@Column
|
||||
@Comment("成本价格")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double cost;
|
||||
/**
|
||||
* 市场价格
|
||||
*/
|
||||
@Column
|
||||
@Comment("市场价格")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double mktprice;
|
||||
/**
|
||||
* 是否有规格0没有 1有
|
||||
*/
|
||||
@Column
|
||||
@Comment("是否有规格0没有 1有")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer haveSpec;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long createTime;
|
||||
/**
|
||||
* 最后修改时间
|
||||
*/
|
||||
@Column
|
||||
@Comment("最后修改时间")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long lastModify;
|
||||
/**
|
||||
* 浏览数量
|
||||
*/
|
||||
@Column
|
||||
@Comment("浏览数量")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer viewCount;
|
||||
/**
|
||||
* 购买数量
|
||||
*/
|
||||
@Column
|
||||
@Comment("购买数量")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer buyCount;
|
||||
/**
|
||||
* 是否被删除0 删除 1未删除
|
||||
*/
|
||||
@Column
|
||||
@Comment("是否被删除0 删除 1未删除")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer disabled;
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
@Column
|
||||
@Comment("库存")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 可用库存
|
||||
*/
|
||||
@Column
|
||||
@Comment("可用库存")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer enableQuantity;
|
||||
/**
|
||||
* 如果是积分商品需要使用的积分
|
||||
*/
|
||||
@Column
|
||||
@Comment("如果是积分商品需要使用的积分")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer point;
|
||||
/**
|
||||
* seo标题
|
||||
*/
|
||||
@Column
|
||||
@Comment("seo标题")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String pageTitle;
|
||||
/**
|
||||
* seo关键字
|
||||
*/
|
||||
@Column
|
||||
@Comment("seo关键字")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String metaKeywords;
|
||||
/**
|
||||
* seo描述
|
||||
*/
|
||||
@Column
|
||||
@Comment("seo描述")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String metaDescription;
|
||||
/**
|
||||
* 商品好评率
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品好评率")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double grade;
|
||||
/**
|
||||
* 缩略图路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("缩略图路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String thumbnail;
|
||||
/**
|
||||
* 大图路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("大图路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String big;
|
||||
/**
|
||||
* 小图路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("小图路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String small;
|
||||
/**
|
||||
* 原图路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("原图路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String original;
|
||||
/**
|
||||
* 卖家id
|
||||
*/
|
||||
@Column
|
||||
@Comment("卖家id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long sellerId;
|
||||
/**
|
||||
* 店铺分类id
|
||||
*/
|
||||
@Column
|
||||
@Comment("店铺分类id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long shopCatId;
|
||||
/**
|
||||
* 评论数量
|
||||
*/
|
||||
@Column
|
||||
@Comment("评论数量")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer commentNum;
|
||||
/**
|
||||
* 运费模板id
|
||||
*/
|
||||
@Column
|
||||
@Comment("运费模板id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long templateId;
|
||||
/**
|
||||
* 谁承担运费0:买家承担,1:卖家承担
|
||||
*/
|
||||
@Column
|
||||
@Comment("谁承担运费0:买家承担,1:卖家承担")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer goodsTransfeeCharge;
|
||||
/**
|
||||
* 卖家名字
|
||||
*/
|
||||
@Column
|
||||
@Comment("卖家名字")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String sellerName;
|
||||
/**
|
||||
* 0 需要审核 并且待审核,1 不需要审核 2需要审核 且审核通过 3 需要审核 且审核未通过
|
||||
*/
|
||||
@Column
|
||||
@Comment("0 待审核,1 审核通过 2 未通过")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer isAuth;
|
||||
/**
|
||||
* 审核信息
|
||||
*/
|
||||
@Column
|
||||
@Comment("审核信息")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String authMessage;
|
||||
|
||||
/**
|
||||
* 下架原因
|
||||
*/
|
||||
@Column
|
||||
@Comment("下架原因")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String underMessage;
|
||||
|
||||
@Column
|
||||
@Comment("是否自营0否 1是")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer selfOperated;
|
||||
|
||||
/**
|
||||
* 商品移动端详情
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品移动端详情")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private String mobileIntro;
|
||||
|
||||
/**
|
||||
* 商品视频
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品视频")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String goodsVideo;
|
||||
|
||||
/**
|
||||
* 搜索优先级
|
||||
*/
|
||||
@Column
|
||||
@Comment("搜索优先级")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer priority;
|
||||
|
||||
@JsonIgnore
|
||||
protected String scanRounds;
|
||||
|
||||
public GoodsDO(GoodsDTO goodsVO) {
|
||||
this.goodsId = goodsVO.getGoodsId();
|
||||
this.categoryId = goodsVO.getCategoryId();
|
||||
this.shopCatId = goodsVO.getShopCatId();
|
||||
this.brandId = goodsVO.getBrandId();
|
||||
this.goodsName = goodsVO.getGoodsName();
|
||||
this.sn = goodsVO.getSn();
|
||||
this.price = goodsVO.getPrice();
|
||||
this.cost = goodsVO.getCost();
|
||||
this.mktprice = goodsVO.getMktprice();
|
||||
this.weight = goodsVO.getWeight();
|
||||
this.goodsTransfeeCharge = goodsVO.getGoodsTransfeeCharge();
|
||||
this.intro = goodsVO.getIntro();
|
||||
this.haveSpec = goodsVO.getHaveSpec();
|
||||
this.templateId = goodsVO.getTemplateId();
|
||||
this.pageTitle = goodsVO.getPageTitle();
|
||||
this.metaKeywords = goodsVO.getMetaKeywords();
|
||||
this.metaDescription = goodsVO.getMetaDescription();
|
||||
this.marketEnable = goodsVO.getMarketEnable() != 1 ? 0 : 1;
|
||||
|
||||
if (StrUtil.isNotBlank(this.pageTitle)) {
|
||||
this.pageTitle = goodsVO.getGoodsName();
|
||||
}
|
||||
if (StrUtil.isNotBlank(this.metaKeywords)) {
|
||||
this.metaKeywords = goodsVO.getGoodsName();
|
||||
}
|
||||
if (StrUtil.isNotBlank(this.metaDescription)) {
|
||||
this.metaDescription = goodsVO.getGoodsName();
|
||||
}
|
||||
|
||||
List<GoodsMobileIntroVO> introList = goodsVO.getIntroList();
|
||||
if (introList != null && introList.size() != 0) {
|
||||
this.mobileIntro = JSONUtil.toJsonStr(introList);
|
||||
} else {
|
||||
this.mobileIntro = "";
|
||||
}
|
||||
|
||||
this.goodsVideo = goodsVO.getGoodsVideo();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
GoodsDO goodsDO = (GoodsDO) o;
|
||||
return Objects.equals(goodsId, goodsDO.goodsId) &&
|
||||
Objects.equals(goodsName, goodsDO.goodsName) &&
|
||||
Objects.equals(sn, goodsDO.sn) &&
|
||||
Objects.equals(brandId, goodsDO.brandId) &&
|
||||
Objects.equals(categoryId, goodsDO.categoryId) &&
|
||||
Objects.equals(goodsType, goodsDO.goodsType) &&
|
||||
Objects.equals(weight, goodsDO.weight) &&
|
||||
Objects.equals(marketEnable, goodsDO.marketEnable) &&
|
||||
Objects.equals(intro, goodsDO.intro) &&
|
||||
Objects.equals(price, goodsDO.price) &&
|
||||
Objects.equals(cost, goodsDO.cost) &&
|
||||
Objects.equals(mktprice, goodsDO.mktprice) &&
|
||||
Objects.equals(haveSpec, goodsDO.haveSpec) &&
|
||||
Objects.equals(createTime, goodsDO.createTime) &&
|
||||
Objects.equals(lastModify, goodsDO.lastModify) &&
|
||||
Objects.equals(viewCount, goodsDO.viewCount) &&
|
||||
Objects.equals(buyCount, goodsDO.buyCount) &&
|
||||
Objects.equals(disabled, goodsDO.disabled) &&
|
||||
Objects.equals(quantity, goodsDO.quantity) &&
|
||||
Objects.equals(enableQuantity, goodsDO.enableQuantity) &&
|
||||
Objects.equals(point, goodsDO.point) &&
|
||||
Objects.equals(pageTitle, goodsDO.pageTitle) &&
|
||||
Objects.equals(metaKeywords, goodsDO.metaKeywords) &&
|
||||
Objects.equals(metaDescription, goodsDO.metaDescription) &&
|
||||
Objects.equals(grade, goodsDO.grade) &&
|
||||
Objects.equals(thumbnail, goodsDO.thumbnail) &&
|
||||
Objects.equals(big, goodsDO.big) &&
|
||||
Objects.equals(small, goodsDO.small) &&
|
||||
Objects.equals(original, goodsDO.original) &&
|
||||
Objects.equals(sellerId, goodsDO.sellerId) &&
|
||||
Objects.equals(shopCatId, goodsDO.shopCatId) &&
|
||||
Objects.equals(commentNum, goodsDO.commentNum) &&
|
||||
Objects.equals(templateId, goodsDO.templateId) &&
|
||||
Objects.equals(goodsTransfeeCharge, goodsDO.goodsTransfeeCharge) &&
|
||||
Objects.equals(sellerName, goodsDO.sellerName) &&
|
||||
Objects.equals(isAuth, goodsDO.isAuth) &&
|
||||
Objects.equals(authMessage, goodsDO.authMessage) &&
|
||||
Objects.equals(underMessage, goodsDO.underMessage) &&
|
||||
Objects.equals(selfOperated, goodsDO.selfOperated) &&
|
||||
Objects.equals(mobileIntro, goodsDO.mobileIntro) &&
|
||||
Objects.equals(goodsVideo, goodsDO.goodsVideo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(goodsId, goodsName, sn, brandId, categoryId, goodsType, weight, marketEnable, intro, price, cost, mktprice, haveSpec, createTime, lastModify, viewCount, buyCount, disabled, quantity, enableQuantity, point, pageTitle, metaKeywords, metaDescription, grade, thumbnail, big, small, original, sellerId, shopCatId, commentNum, templateId, goodsTransfeeCharge, sellerName, isAuth, authMessage, underMessage, selfOperated, mobileIntro, goodsVideo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoodsDO{" +
|
||||
"goodsId=" + goodsId +
|
||||
", goodsName='" + goodsName + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", brandId=" + brandId +
|
||||
", categoryId=" + categoryId +
|
||||
", goodsType='" + goodsType + '\'' +
|
||||
", weight=" + weight +
|
||||
", marketEnable=" + marketEnable +
|
||||
", intro='" + intro + '\'' +
|
||||
", price=" + price +
|
||||
", cost=" + cost +
|
||||
", mktprice=" + mktprice +
|
||||
", haveSpec=" + haveSpec +
|
||||
", createTime=" + createTime +
|
||||
", lastModify=" + lastModify +
|
||||
", viewCount=" + viewCount +
|
||||
", buyCount=" + buyCount +
|
||||
", disabled=" + disabled +
|
||||
", quantity=" + quantity +
|
||||
", enableQuantity=" + enableQuantity +
|
||||
", point=" + point +
|
||||
", pageTitle='" + pageTitle + '\'' +
|
||||
", metaKeywords='" + metaKeywords + '\'' +
|
||||
", metaDescription='" + metaDescription + '\'' +
|
||||
", grade=" + grade +
|
||||
", thumbnail='" + thumbnail + '\'' +
|
||||
", big='" + big + '\'' +
|
||||
", small='" + small + '\'' +
|
||||
", original='" + original + '\'' +
|
||||
", sellerId=" + sellerId +
|
||||
", shopCatId=" + shopCatId +
|
||||
", commentNum=" + commentNum +
|
||||
", templateId=" + templateId +
|
||||
", goodsTransfeeCharge=" + goodsTransfeeCharge +
|
||||
", sellerName='" + sellerName + '\'' +
|
||||
", isAuth=" + isAuth +
|
||||
", authMessage='" + authMessage + '\'' +
|
||||
", underMessage='" + underMessage + '\'' +
|
||||
", selfOperated=" + selfOperated +
|
||||
", mobileIntro='" + mobileIntro + '\'' +
|
||||
", goodsVideo='" + goodsVideo + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 商品相册实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("mall_goods_gallery")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class GoodsGalleryDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 8150217189133447L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("图片的主键id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long imgId;
|
||||
/**
|
||||
* 商品主键
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品主键")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long goodsId;
|
||||
/**
|
||||
* 缩略图路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("缩略图路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String thumbnail;
|
||||
/**
|
||||
* 小图路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("小图路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String small;
|
||||
/**
|
||||
* 大图路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("大图路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String big;
|
||||
/**
|
||||
* 原图路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("原图路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String original;
|
||||
/**
|
||||
* 极小图路径
|
||||
*/
|
||||
@Column
|
||||
@Comment("极小图路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String tiny;
|
||||
/**
|
||||
* 是否是默认图片1 0没有默认
|
||||
*/
|
||||
@Column
|
||||
@Comment("是否是默认图片1 0没有默认")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer isdefault;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer sort;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoodsGalleryDO [imgId=" + imgId + ", goodsId=" + goodsId + ", thumbnail=" + thumbnail + ", small="
|
||||
+ small + ", big=" + big + ", original=" + original + ", tiny=" + tiny + ", isdefault=" + isdefault
|
||||
+ ", sort=" + sort + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 商品关联参数值实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Table("mall_goods_params")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class GoodsParamsDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4134870721776090L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long id;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long goodsId;
|
||||
/**
|
||||
* 参数id
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long paramId;
|
||||
/**
|
||||
* 参数名字
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数名字")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String paramName;
|
||||
/**
|
||||
* 参数值
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数值")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
@Length(max = 100, message = "参数值字符不能大于120")
|
||||
private String paramValue;
|
||||
|
||||
|
||||
public String getParamValue() {
|
||||
if (StrUtil.isNotBlank(paramValue)) {
|
||||
return "";
|
||||
}
|
||||
return paramValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoodsParamsDO [id=" + id + ", goodsId=" + goodsId + ", paramId=" + paramId + ", paramName=" + paramName
|
||||
+ ", paramValue=" + paramValue + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,225 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import cn.hutool.core.builder.EqualsBuilder;
|
||||
import cn.hutool.core.builder.HashCodeBuilder;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 商品sku实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Table("mall_goods_sku")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class GoodsSkuDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 5102510694003249L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long skuId;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long goodsId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String goodsName;
|
||||
/**
|
||||
* 商品编号
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Length(max = 30,message = "商品规格编号太长,不能超过30个字符")
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
@Column
|
||||
@Comment("库存")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Max(value = 99999999, message = "库存不能超过99999999")
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 可用库存
|
||||
*/
|
||||
@Column
|
||||
@Comment("可用库存")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer enableQuantity;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
@Column
|
||||
@Comment("商品价格")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
@Max(value = 99999999, message = "价格不能超过99999999")
|
||||
private Double price;
|
||||
/**
|
||||
* 规格信息json
|
||||
*/
|
||||
@Column
|
||||
@Comment("规格信息json")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private String specs;
|
||||
/**
|
||||
* 成本价格
|
||||
*/
|
||||
@Column
|
||||
@Comment("成本价格")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
@Max(value = 99999999, message = "成本价格不能超过99999999")
|
||||
private Double cost;
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@Column
|
||||
@Comment("重量")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
@Max(value = 99999999, message = "重量不能超过99999999")
|
||||
private Double weight;
|
||||
/**
|
||||
* 卖家id
|
||||
*/
|
||||
@Column
|
||||
@Comment("卖家id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long sellerId;
|
||||
/**
|
||||
* 卖家名称
|
||||
*/
|
||||
@Column
|
||||
@Comment("卖家名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String sellerName;
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 缩略图
|
||||
*/
|
||||
@Column
|
||||
@Comment("缩略图")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String thumbnail;
|
||||
|
||||
@Column
|
||||
@Comment("hash_code")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer hashCode;
|
||||
|
||||
/**
|
||||
* 运费模板ID(非数据库字段)
|
||||
*/
|
||||
private Long templateId;
|
||||
|
||||
@JsonIgnore
|
||||
protected String scanRounds;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoodsSkuDO{" +
|
||||
"skuId=" + skuId +
|
||||
", goodsId=" + goodsId +
|
||||
", goodsName='" + goodsName + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", quantity=" + quantity +
|
||||
", enableQuantity=" + enableQuantity +
|
||||
", price=" + price +
|
||||
", specs='" + specs + '\'' +
|
||||
", cost=" + cost +
|
||||
", weight=" + weight +
|
||||
", sellerId=" + sellerId +
|
||||
", sellerName='" + sellerName + '\'' +
|
||||
", categoryId=" + categoryId +
|
||||
", thumbnail='" + thumbnail + '\'' +
|
||||
", hashCode=" + hashCode +
|
||||
", templateId=" + templateId +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
GoodsSkuDO that = (GoodsSkuDO) o;
|
||||
|
||||
return new EqualsBuilder()
|
||||
.append(getSkuId(), that.getSkuId())
|
||||
.append(getGoodsId(), that.getGoodsId())
|
||||
.append(getGoodsName(), that.getGoodsName())
|
||||
.append(getSn(), that.getSn())
|
||||
.append(getQuantity(), that.getQuantity())
|
||||
.append(getEnableQuantity(), that.getEnableQuantity())
|
||||
.append(getPrice(), that.getPrice())
|
||||
.append(getSpecs(), that.getSpecs())
|
||||
.append(getCost(), that.getCost())
|
||||
.append(getWeight(), that.getWeight())
|
||||
.append(getSellerId(), that.getSellerId())
|
||||
.append(getSellerName(), that.getSellerName())
|
||||
.append(getCategoryId(), that.getCategoryId())
|
||||
.append(getThumbnail(), that.getThumbnail())
|
||||
.append(hashCode, that.hashCode)
|
||||
.append(getTemplateId(), that.getTemplateId())
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder(17, 37)
|
||||
.append(getSkuId())
|
||||
.append(getGoodsId())
|
||||
.append(getGoodsName())
|
||||
.append(getSn())
|
||||
.append(getQuantity())
|
||||
.append(getEnableQuantity())
|
||||
.append(getPrice())
|
||||
.append(getSpecs())
|
||||
.append(getCost())
|
||||
.append(getWeight())
|
||||
.append(getSellerId())
|
||||
.append(getSellerName())
|
||||
.append(getCategoryId())
|
||||
.append(getThumbnail())
|
||||
.append(hashCode)
|
||||
.append(getTemplateId())
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
}
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 参数组实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Table("mall_parameter_group")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class ParameterGroupDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2394621849767871L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long groupId;
|
||||
/**
|
||||
* 参数组名称
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数组名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@NotEmpty(message = "参数组名称不能为空")
|
||||
@Length(max = 50, message = "参数组名称不能超过50字")
|
||||
private String groupName;
|
||||
/**
|
||||
* 关联分类id
|
||||
*/
|
||||
@Column
|
||||
@Comment("关联分类id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer sort;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ParameterGroupDO [groupId=" + groupId + ", groupName=" + groupName + ", categoryId=" + categoryId
|
||||
+ ", sort=" + sort + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.budwk.app.zhgh.mall.manage.models.goods.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 参数实体
|
||||
*
|
||||
* @author fky
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Table("mall_parameters")
|
||||
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
public class ParametersDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 320610453789555L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long paramId;
|
||||
/**
|
||||
* 参数名称
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@NotEmpty(message = "参数名称必填")
|
||||
@Length(max = 50, message = "参数名称不能超过50字")
|
||||
private String paramName;
|
||||
/**
|
||||
* 参数类型1 输入项 2 选择项
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数类型1 输入项 2 选择项")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@NotNull(message = "参数类型必选")
|
||||
@Min(value = 1,message = "参数类型传值不正确")
|
||||
@Max(value = 2,message = "参数类型传值不正确")
|
||||
private Integer paramType;
|
||||
/**
|
||||
* 选择值,当参数类型是选择项2时,必填,逗号分隔
|
||||
*/
|
||||
@Column
|
||||
@Comment("选择值")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String options;
|
||||
/**
|
||||
* 是否可索引,0 不显示 1 显示
|
||||
*/
|
||||
@Column
|
||||
@Comment("是否可索引必选")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@NotNull(message = "是否可索引必选")
|
||||
@Min(value = 0,message = "是否可索引传值不正确")
|
||||
@Max(value = 1,message = "是否可索引传值不正确")
|
||||
private Integer isIndex;
|
||||
/**
|
||||
* 是否必填是 1 否 0
|
||||
*/
|
||||
@Column
|
||||
@Comment("是否必填")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@NotNull(message = "是否必填必选")
|
||||
@Min(value = 0,message = "是否必填传值不正确")
|
||||
@Max(value = 1,message = "是否必填传值不正确")
|
||||
private Integer required;
|
||||
/**
|
||||
* 参数分组id
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数分组id")
|
||||
@ColDefine(customType = "bigint")
|
||||
@NotNull(message = "所属参数组不能为空")
|
||||
private Long groupId;
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@Column
|
||||
@Comment("分类id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Column
|
||||
@Comment("参数组名称")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer sort;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ParametersDO [paramId=" + paramId + ", paramName=" + paramName + ", paramType=" + paramType
|
||||
+ ", options=" + options + ", isIndex=" + isIndex + ", required=" + required + ", groupId=" + groupId
|
||||
+ ", categoryId=" + categoryId + ", sort=" + sort + "]";
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user