This commit is contained in:
@jyuhsin
2025-07-28 13:40:05 +08:00
parent 9501b015b9
commit 72546696fa
211 changed files with 24954 additions and 3665 deletions
@@ -0,0 +1,104 @@
package com.budwk.app.zhgh.staffbenefit.contribution.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionApply;
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName ContributionDetailedController
* @Author JyuHsin
* @Date 2025/7/24 14:58
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "慈善捐款明细")
@At("/platform/contribution/detailed")
public class ContributionDetailedController {
@Inject
private Dao dao;
@Inject
private ContributionApplyService applyService;
@At("")
@SaCheckPermission("contribution.detailed")
@Ok("beetl:/platform/zhgh/staffbenefit/contribution/detailed/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("contribution.detailed")
public Result pageData(PageForm pageForm,
@Param(value = "unionId") String unionId,
@Param(value = "unitId") String unitId,
@Param(value = "payMode") String payMode,
@Param(value = "contributionName") String contributionName) {
Sql sql = applyService.generateSql(unionId, unitId, payMode, contributionName);
Pagination pagination = applyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@Ok("void")
@SaCheckPermission("contribution.detailed")
public void doExport(@Param(value = "unionId") String unionId,
@Param(value = "unitId") String unitId,
@Param(value = "payMode") String payMode,
@Param(value = "contributionName") String contributionName,
HttpServletResponse response) throws IOException {
Sql sql = applyService.generateSql(unionId, unitId, payMode, contributionName);
List<NutMap> listMap = applyService.listMap(sql);
for (int i = 0; i < listMap.size(); i++) {
listMap.get(i).put("index", i + 1);
}
List<ExcelExportEntity> entityList = new ArrayList<>();
entityList.add(new ExcelExportEntity("序号", "index", 10));
entityList.add(new ExcelExportEntity("捐款项目", "contributionName", 20));
entityList.add(new ExcelExportEntity("捐款人工号", "loginName", 20));
entityList.add(new ExcelExportEntity("捐款人姓名", "userName", 20));
entityList.add(new ExcelExportEntity("联系方式", "mobile", 20));
entityList.add(new ExcelExportEntity("所属工会", "unionName", 20));
entityList.add(new ExcelExportEntity("所属单位", "unitName", 20));
entityList.add(new ExcelExportEntity("善款金额", "money", 20));
entityList.add(new ExcelExportEntity("捐赠方式", "payModeName", 20));
entityList.add(new ExcelExportEntity("捐赠时间", "contributionTime", 20));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, listMap);
CommonDownloadUtil.download("捐款明细.xlsx", workbook, response);
}
}
@@ -0,0 +1,110 @@
package com.budwk.app.zhgh.staffbenefit.contribution.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionProject;
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionType;
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @ClassName ContributionProjectController
* @Author JyuHsin
* @Date 2025/7/24 10:51
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "慈善捐款项目")
@At("/platform/contribution/list")
public class ContributionProjectController {
@Inject
private Dao dao;
@Inject
private ContributionTypeService typeService;
@At("")
@SaCheckPermission("contribution.list")
@Ok("beetl:/platform/zhgh/staffbenefit/contribution/list/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("contribution.list")
public Result pageData(PageForm pageForm,
@Param("contributionName") String contributionName) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
con.*,
type.typeName
FROM
`contribution_project` con
LEFT JOIN contribution_type type ON type.typeCode = con.contributionTypeCode
$condition
""");
if (Strings.isNotBlank(contributionName)) {
cnd.where().andLike("con.contributionName", contributionName);
}
cnd.asc("con.contributionTypeCode");
sql.setCondition(cnd);
Pagination pagination = typeService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@ApiOperation("新增/修改慈善捐款项目")
@SaCheckPermission("contribution.list")
@SLog(type = "contribution", tag = "新增/修改慈善捐款项目", msg = "新增/修改慈善捐款项目")
public Object onSubmit(ContributionProject project) {
if(StrUtil.isBlank(project.getId())) {
project.setContributionCreationDate(DateUtil.now());
}
typeService.dao().insertOrUpdate(project);
return Result.success();
}
@At
@ApiOperation("删除慈善捐款项目")
@SaCheckPermission("contribution.list")
@SLog(type = "contribution", tag = "删除慈善捐款项目", msg = "删除慈善捐款项目")
public Object onDelete(String id) {
typeService.dao().delete(ContributionProject.class, id);
return Result.success();
}
@At
@ApiOperation("查询慈善捐款项目")
@SaCheckPermission("contribution.list")
public Result queryContributionList() {
List<ContributionProject> list = typeService.dao().query(
ContributionProject.class,
Cnd.where(ContributionProject::getIsContributionEnable, "=", true)
.desc(ContributionProject::getContributionCreationDate)
);
return Result.success(list);
}
}
@@ -0,0 +1,89 @@
package com.budwk.app.zhgh.staffbenefit.contribution.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_union;
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionApply;
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
/**
* @ClassName ContributionStatisticsController
* @Author JyuHsin
* @Date 2025/7/24 15:42
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "慈善捐款分工会统计")
@At("/platform/contribution/statistics")
public class ContributionStatisticsController {
@Inject
private Dao dao;
@Inject
private ContributionApplyService applyService;
@At("")
@SaCheckPermission("contribution.statistics")
@Ok("beetl:/platform/zhgh/staffbenefit/contribution/statistics/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("contribution.statistics")
public Result pageData(@Param(value = "unionId") String unionId,
@Param(value = "contributionId") String contributionId) {
List<Sys_union> unionList = dao.query(Sys_union.class, Cnd.NEW().andEX("id", "=", unionId).asc(Sys_union::getUnionCode));
List<ContributionApply> applyList = applyService.query(Cnd.NEW().andEX(ContributionApply::getContributionId, "=", contributionId));
List<NutMap> resultList = new ArrayList<>();
for (Sys_union union : unionList) {
NutMap map = Lang.obj2nutmap(union);
//找这个项目的人,去重
List<ContributionApply> userList = applyList.stream()
.collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ContributionApply::getUserId))))
.stream()
.toList();
//这个项目每个分工会有多少个人捐款
List<ContributionApply> list = userList.stream()
.filter(n -> n.getUnionId().equals(union.getId()) && n.getContributionId().equals(contributionId))
.toList();
map.setv("contributionUserNum", list.size());
//捐款多少笔
long conCount = applyList.stream()
.filter(n -> n.getUnionId().equals(union.getId()) && n.getContributionId().equals(contributionId))
.count();
map.setv("contributionNum", conCount);
//一共捐了多少钱
double money = list.stream().mapToDouble(ContributionApply::getMoney).sum();
map.setv("money", money);
resultList.add(map);
}
return Result.success(resultList);
}
}
@@ -0,0 +1,90 @@
package com.budwk.app.zhgh.staffbenefit.contribution.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionType;
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
/**
* @ClassName contributionTypeController
* @Author JyuHsin
* @Date 2025/7/24 10:06
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "慈善捐款专题")
@At("/platform/contribution/type")
public class ContributionTypeController {
@Inject
private Dao dao;
@Inject
private ContributionTypeService typeService;
@At("")
@SaCheckPermission("contribution.type")
@Ok("beetl:/platform/zhgh/staffbenefit/contribution/type/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("contribution.type")
public Result pageData(PageForm pageForm) {
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or(ContributionType::getTypeName, "like", "%" + pageForm.getSearchKeyword() + "%");
seg.or(ContributionType::getTypeCode, "like", "%" + pageForm.getSearchKeyword() + "%");
cnd.and(seg);
}
cnd.asc("typeCode");
Pagination pagination = typeService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
return Result.success(pagination);
}
@At
@ApiOperation("新增/修改慈善捐款专题")
@SaCheckPermission("contribution.type")
@SLog(type = "contribution", tag = "新增/修改慈善捐款专题", msg = "新增/修改慈善捐款专题")
public Object onSubmit(ContributionType type) {
typeService.insertOrUpdate(type);
return Result.success();
}
@At
@ApiOperation("删除慈善捐款专题")
@SaCheckPermission("contribution.type")
@SLog(type = "contribution", tag = "删除慈善捐款专题", msg = "删除慈善捐款专题")
public Object onDelete(String id) {
typeService.delete(id);
return Result.success();
}
@At
@ApiOperation("查询慈善捐款专题")
@SaCheckPermission("contribution.type")
public Result queryContributionType() {
List<ContributionType> list = typeService.query(Cnd.NEW().desc(ContributionType::getTypeCode));
return Result.success(list);
}
}
@@ -0,0 +1,103 @@
package com.budwk.app.zhgh.staffbenefit.contribution.model;
import cn.hutool.json.JSONObject;
import com.budwk.app.base.model.BaseModel;
import com.budwk.app.sys.models.Sys_file;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @ClassName ContributionApply
* @Author JyuHsin
* @Date 2025/7/24 10:03
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("慈善捐款明细")
@Accessors(chain = true)
@Table("contribution_apply")
@EqualsAndHashCode(callSuper = true)
public class ContributionApply extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("项目Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String contributionId;
@Column
@Comment("项目")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String contributionName;
@Column
@Comment("支付人Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userId;
@Column
@Comment("支付人工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("支付人姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("支付人单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("支付人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("支付人工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("支付人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("联系方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@Comment("捐款金额")
@ColDefine(type = ColType.DOUBLE)
private double money;
@Column
@Comment("支付方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String payMode;
@Column
@Comment("捐款时间")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String contributionTime;
@Column
@Comment("捐款图片")
@ColDefine(type = ColType.MYSQL_JSON)
private List<JSONObject> contributionFiles;
}
@@ -0,0 +1,82 @@
package com.budwk.app.zhgh.staffbenefit.contribution.model;
import cn.hutool.json.JSONObject;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @ClassName Contribution
* @Author JyuHsin
* @Date 2025/7/24 9:59
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("慈善捐款")
@Accessors(chain = true)
@Table("contribution_project")
@EqualsAndHashCode(callSuper = true)
public class ContributionProject extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("项目名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String contributionName;
@Column
@Comment("项目介绍")
@ColDefine(type = ColType.TEXT)
private String contributionIntroduce;
@Column
@Comment("所属捐款专题")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String contributionTypeCode;
@Column
@Comment("项目图片")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String contributionFiles;
@Column
@Comment("创建时间")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String contributionCreationDate;
@Column
@Comment("是否启用")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isContributionEnable;
@Column
@Comment("捐款模式")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String contributionMode;
@Column
@Comment("捐款链接")
@ColDefine(type = ColType.TEXT)
private String contributionUrl;
@Column
@Comment("捐款开启时间")
@ColDefine(type = ColType.VARCHAR, width = 40)
private String contributionStartTime;
@Column
@Comment("捐款结束时间")
@ColDefine(type = ColType.VARCHAR, width = 40)
private String contributionEndTime;
}
@@ -0,0 +1,53 @@
package com.budwk.app.zhgh.staffbenefit.contribution.model;
import cn.hutool.json.JSONObject;
import com.budwk.app.base.model.BaseModel;
import com.budwk.app.sys.models.Sys_file;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @ClassName ContributionType
* @Author JyuHsin
* @Date 2025/7/24 10:01
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("慈善捐款专题")
@Accessors(chain = true)
@Table("contribution_type")
@EqualsAndHashCode(callSuper = true)
public class ContributionType extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("专题名称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String typeName;
@Column
@Comment("专题编号")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String typeCode;
@Column
@Comment("专题介绍")
@ColDefine(type = ColType.TEXT)
private String contributionTypeIntroduce;
@Column
@Comment("专题图片")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String contributionTypeFiles;
}
@@ -0,0 +1,22 @@
package com.budwk.app.zhgh.staffbenefit.contribution.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionApply;
import org.nutz.dao.Cnd;
import org.nutz.dao.sql.Sql;
/**
* @ClassName ContributionApplyService
* @Author JyuHsin
* @Date 2025/7/24 15:00
* @Version 1.0
* @Description TODO
*/
public interface ContributionApplyService extends BaseService<ContributionApply> {
/**
* 生成查询捐款明细的sql
* @return
*/
Sql generateSql(String unionId, String unitId, String payMode, String contributionName);
}
@@ -0,0 +1,14 @@
package com.budwk.app.zhgh.staffbenefit.contribution.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionType;
/**
* @ClassName ContributionTypeService
* @Author JyuHsin
* @Date 2025/7/24 10:07
* @Version 1.0
* @Description TODO
*/
public interface ContributionTypeService extends BaseService<ContributionType> {
}
@@ -0,0 +1,51 @@
package com.budwk.app.zhgh.staffbenefit.contribution.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionApply;
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionApplyService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
/**
* @ClassName ContributionApplyServiceImpl
* @Author JyuHsin
* @Date 2025/7/24 15:00
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean(args = {"refer:dao"})
public class ContributionApplyServiceImpl extends BaseServiceImpl<ContributionApply> implements ContributionApplyService {
public ContributionApplyServiceImpl(Dao dao) {
super(dao);
}
@Override
public Sql generateSql(String unionId, String unitId, String payMode, String contributionName) {
Sql sql = Sqls.create("""
select
ca.*,
CASE WHEN ca.payMode = 'WeChat' THEN '微信' ELSE '支付宝' END AS payModeName
from
contribution_apply ca
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX(ContributionApply::getUnionId, "=", unionId);
cnd.andEX(ContributionApply::getUnitId, "=", unitId);
cnd.andEX(ContributionApply::getPayMode, "=", payMode);
if (Strings.isNotBlank(contributionName)) {
cnd.where().andLike(ContributionApply::getContributionName, contributionName);
}
cnd.desc(ContributionApply::getContributionTime);
cnd.asc(ContributionApply::getUnitId);
sql.setCondition(cnd);
return sql;
}
}
@@ -0,0 +1,24 @@
package com.budwk.app.zhgh.staffbenefit.contribution.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.staffbenefit.contribution.model.ContributionType;
import com.budwk.app.zhgh.staffbenefit.contribution.service.ContributionTypeService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @ClassName ContributionTypeServiceImpl
* @Author JyuHsin
* @Date 2025/7/24 10:08
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean(args = {"refer:dao"})
public class ContributionTypeServiceImpl extends BaseServiceImpl<ContributionType> implements ContributionTypeService {
public ContributionTypeServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,71 @@
package com.budwk.app.zhgh.staffbenefit.legal.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @ClassName LegalApplyController
* @Author JyuHsin
* @Date 2025/7/25 15:08
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "法律援助预约")
@At("/platform/legal/apply")
public class LegalApplyController {
@Inject
private Dao dao;
@Inject
private LegalApplyService applyService;
@At("")
@SaCheckPermission("legal.apply")
@Ok("beetl:/platform/zhgh/staffbenefit/legal/apply/index.html")
public void index() {
}
@At
@ApiOperation("新增/修改法律援助预约")
@SaCheckPermission("legal.apply")
@SLog(type = "legal", tag = "新增/修改法律援助预约", msg = "新增/修改法律援助预约")
public Object onSubmit(LegalApply apply) {
LegalApply legalApply = applyService.fetch(apply.getId());
if(StrUtil.isNotBlank(legalApply.getUserId())) {
return Result.error("该时段已被预约");
}
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
apply.setUserId(user.getId());
apply.setLoginName(user.getLoginname());
apply.setUserName(user.getUsername());
apply.setUnitId(user.getUnitId());
apply.setUnitName(user.getUnitName());
apply.setUnionId(user.getUnionId());
apply.setUnionName(user.getUnionName());
/*apply.setMobile(apply.getMobile());
apply.setRemark(apply.getRemark());
apply.setAskTypeValue(apply.getAskTypeValue());*/
applyService.updateIgnoreNull(apply);
//TODO:这里后面要加发短信
return Result.success();
}
}
@@ -0,0 +1,162 @@
package com.budwk.app.zhgh.staffbenefit.legal.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @ClassName LegalAppointmentSetController
* @Author JyuHsin
* @Date 2025/7/25 10:04
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "法律援助预约安排")
@At("/platform/legal/appointmentSet")
public class LegalAppointmentSetController {
@Inject
private Dao dao;
@Inject
private LegalApplyService applyService;
@At("")
@SaCheckPermission("legal.appointmentSet")
@Ok("beetl:/platform/zhgh/staffbenefit/legal/appointmentSet/index.html")
public void index() {
}
@At
@ApiOperation("查询时间段内的预约信息")
@SaCheckPermission("legal.appointmentSet")
public Result queryAppointmentInfo(Long startTimeTs, Long endTimeTs) {
Sql sql = Sqls.create("""
SELECT
pa.*,
pa.userId as appointmentUser,
pa.userName AS appointmentUserName,
pa.loginName AS appointmentLoginName,
pa.unitName AS appointmentUnitName,
pa.mobile AS appointmentMobile,
pd.specialty AS doctorSpecialty,
pd.introduce AS doctorIntroduce,
pd.sex AS doctorSex,
pd.technicalTitle AS doctorJobTitle,
pd.unitName AS doctorUnitName,
pd.avatar AS doctorAvatar,
pd.mobile AS doctorMobile,
pd.userName AS doctorUserName
FROM
`legal_apply` pa
LEFT JOIN legal_doctor pd ON pd.userId = pa.doctorUser
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("startTimeTs", ">=", startTimeTs);
cnd.and("endTimeTs", "<=", endTimeTs);
sql.setCondition(cnd);
List<NutMap> listMap = applyService.listMap(sql);
return Result.success(listMap);
}
@At
@ApiOperation("新增/修改法律援助安排")
@SaCheckPermission("legal.appointmentSet")
@SLog(type = "legal", tag = "新增/修改法律援助安排", msg = "新增/修改法律援助安排")
public Object onSubmit(LegalApply apply) {
long startTimeTs = com.budwk.app.base.utils.DateUtil.formatDate(apply.getStartTime());
long endTimeTs = com.budwk.app.base.utils.DateUtil.formatDate(apply.getEndTime());
List<LegalApply> list = new ArrayList<>();
for (long i = startTimeTs; i < endTimeTs; i = i + 3600000) {
LegalApply app = new LegalApply();
LegalApply legalAppointmentInfo = Lang.copyProperties(apply, app);
String start = com.budwk.app.base.utils.DateUtil.getDate(i / 1000);
long e = i + 3600000;
if ((endTimeTs - e) <= 0) {
e = i + (endTimeTs - i);
}
String end = com.budwk.app.base.utils.DateUtil.getDate(e / 1000);
legalAppointmentInfo.setStartTimeTs(i);
legalAppointmentInfo.setEndTimeTs(e);
legalAppointmentInfo.setStartTime(start);
legalAppointmentInfo.setEndTime(end);
list.add(legalAppointmentInfo);
}
dao.insert(list);
return Result.success();
}
@At
@ApiOperation("修改法律援助安排")
@SaCheckPermission("legal.appointmentSet")
@SLog(type = "legal", tag = "修改法律援助安排", msg = "修改法律援助安排")
public Object onEdit(String id, String[] askType) {
LegalApply apply = applyService.fetch(id);
apply.setAskType(Lang.isNotEmpty(askType) ? Arrays.asList(askType) : new ArrayList<>());
apply.setAskTypeValue(null);
applyService.update(apply);
//TODO:以后这里加个发短信
return Result.success();
}
@At
@ApiOperation("删除法律援助安排")
@SaCheckPermission("legal.appointmentSet")
@SLog(type = "legal", tag = "删除法律援助安排", msg = "删除法律援助安排")
public Object onDelete(String id) {
applyService.delete(id);
//TODO:以后这里加个发短信
return Result.success();
}
@At
@ApiOperation("查询咨询师")
@SaCheckPermission("legal.appointmentSet")
public Result queryDoctorUser(String keyWord, long startTimeTs, long endTimeTs) {
//先查询该时间段没时间的咨询师
Sql doctorSql = Sqls.create("""
SELECT
pd.userId AS id,
pd.userName AS doctorUserName,
replace(pd.mobile,' ','') as mobile
FROM
legal_doctor pd
WHERE
pd.userId NOT IN
(
SELECT doctorUser FROM legal_apply
WHERE startTimeTs >= @startTimeTs AND endTimeTs <= @endTimeTs
AND doctorUser IS NOT NULL
)
and (pd.userName like @keyWord or pd.loginName like @keyWord)
""");
doctorSql.setParam("startTimeTs", startTimeTs);
doctorSql.setParam("endTimeTs", endTimeTs);
doctorSql.setParam("keyWord", "%" + keyWord + "%");
Pagination pagination = applyService.listPageMap(1, 10, doctorSql);
return Result.success(pagination.getList());
}
}
@@ -0,0 +1,140 @@
package com.budwk.app.zhgh.staffbenefit.legal.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalDoctor;
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalDoctorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
/**
* @ClassName LegalDoctorController
* @Author JyuHsin
* @Date 2025/7/24 18:18
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "法律援助咨询师")
@At("/platform/legal/doctorManage")
public class LegalDoctorController {
@Inject
private Dao dao;
@Inject
private LegalDoctorService doctorService;
@At("")
@SaCheckPermission("legal.doctorManage")
@Ok("beetl:/platform/zhgh/staffbenefit/legal/doctorManage/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("legal.doctorManage")
public Result pageData(PageForm pageForm) {
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or(LegalDoctor::getLoginName, "like", "%" + pageForm.getSearchKeyword() + "%");
seg.or(LegalDoctor::getUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
cnd.and(seg);
}
Pagination pagination = doctorService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
return Result.success(pagination);
}
@At
@Aop(TransAop.READ_COMMITTED)
@ApiOperation("新增/修改法律援助师")
@SaCheckPermission("legal.doctorManage")
@SLog(type = "legal", tag = "新增/修改法律援助师", msg = "新增/修改法律援助师")
public Object onSubmit(LegalDoctor doctor) {
if(StrUtil.isBlank(doctor.getId())) {
int count = doctorService.count(Cnd.where(LegalDoctor::getUserId, "=", doctor.getUserId()));
if(count > 0) {
return Result.error("此咨询师信息已录入");
}
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", doctor.getUserId()));
doctor.setLoginName(user.getLoginname());
doctor.setUserName(user.getUsername());
doctor.setUnitId(user.getUnitId());
doctor.setUnitName(user.getUnitName());
doctor.setUnionId(user.getUnionId());
doctor.setUnionName(user.getUnionName());
//插入角色
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(doctor.getUserId());
userRole.setRoleId(RoleConstant.PSYCHOLOGY_DOCTOR.name());
dao.insert(userRole);
}
doctorService.insertOrUpdate(doctor);
return Result.success();
}
@At
@ApiOperation("删除法律援助师")
@SaCheckPermission("legal.doctorManage")
@SLog(type = "legal", tag = "删除法律援助师", msg = "删除法律援助师")
public Object onDelete(String id) {
doctorService.delete(id);
return Result.success();
}
@At
@ApiOperation("查询用户")
@SaCheckPermission("legal.doctorManage")
@SLog(type = "legal", tag = "查询用户", msg = "查询用户")
public Object listUser(String keyword) {
Sql sql = Sqls.create("""
select
id,
username as userName,
loginname as loginName,
sex,
mobile,
technicalTitle,
unitname as unitName
from
vw_user
$condition
""");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(keyword)) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or(View_user::getLoginname, "like", "%" + keyword + "%");
seg.or(View_user::getUsername, "like", "%" + keyword + "%");
cnd.and(seg);
}
List<LegalDoctor> list = doctorService.query(Cnd.NEW());
List<String> idList = list.stream().map(LegalDoctor::getUserId).toList();
cnd.andEX(View_user::getId, "not in", idList);
sql.setCondition(cnd);
Pagination pagination = doctorService.listPageMap(1, 50, sql);
return Result.success(pagination.getList());
}
}
@@ -0,0 +1,106 @@
package com.budwk.app.zhgh.staffbenefit.legal.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* @ClassName LegalListController
* @Author JyuHsin
* @Date 2025/7/25 16:00
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "法律援助我的预约")
@At("/platform/legal/list")
public class LegalListController {
@Inject
private Dao dao;
@Inject
private LegalApplyService applyService;
@At("")
@SaCheckPermission("legal.list")
@Ok("beetl:/platform/zhgh/staffbenefit/legal/list/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("legal.list")
public Result pageData(PageForm pageForm,
@Param(value = "year") Integer year) {
Sql sql = Sqls.create("""
SELECT
pa.*,
pa.userName AS appointmentUserName,
pa.loginName AS appointmentLoginName,
pa.unitName AS appointmentUnitName,
pa.mobile AS appointmentMobile,
pd.specialty AS doctorSpecialty,
pd.introduce AS doctorIntroduce,
pd.sex AS doctorSex,
pd.technicalTitle AS doctorJobTitle,
pd.unitName AS doctorUnitName,
pd.avatar AS doctorAvatar,
pd.mobile AS doctorMobile,
pd.userName AS doctorUserName
FROM
`legal_apply` pa
LEFT JOIN legal_doctor pd ON pd.userId = pa.doctorUser
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("pa.userId", "IS NOT", null);
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
cnd.and("pa.userId", "=", SecurityUtil.getUserId());
}
cnd.andEX("YEAR(pa.startTime)", "=", year);
cnd.desc("pa.startTime");
sql.setCondition(cnd);
Pagination pagination = applyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@ApiOperation("删除法律援助预约")
@SaCheckPermission("legal.list")
@SLog(type = "legal", tag = "删除法律援助预约", msg = "删除法律援助预约")
public Object onDelete(String id) {
LegalApply apply = applyService.fetch(id);
apply.setUserId(null);
apply.setLoginName(null);
apply.setUserName(null);
apply.setUnitId(null);
apply.setUnitName(null);
apply.setUnionId(null);
apply.setUnionName(null);
apply.setRemark(null);
apply.setMobile(null);
applyService.update(apply);
return Result.success();
}
}
@@ -0,0 +1,129 @@
package com.budwk.app.zhgh.staffbenefit.legal.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalOnlinePost;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalOnlineReply;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @ClassName LegalOnlinePostController
* @Author JyuHsin
* @Date 2025/7/24 16:37
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "法律援助线上发帖")
@At("/platform/legal/onlinePost")
public class LegalOnlinePostController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@At("")
@SaCheckPermission("legal.onlinePost")
@Ok("beetl:/platform/zhgh/staffbenefit/legal/onlinePost/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("legal.onlinePost")
public Result pageData(PageForm pageForm,
@Param(value = "year") Integer year,
@Param(value = "isReply") Boolean isReply) {
Sql sql = Sqls.create("""
SELECT
pop.*,
IF( count( por.id ) = 0, false, true ) AS isReply
FROM
legal_online_post pop
LEFT JOIN legal_online_reply por on por.postId = pop.id
$condition
""");
Cnd cnd = Cnd.NEW();
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("poster", "=", SecurityUtil.getUserId());
}
cnd.andEX("YEAR(pop.postingTime)", "=", year);
cnd.groupBy("pop.id");
cnd.having(Cnd.where("count(por.id)", isReply == null ? ">=" : isReply ? ">" : "=", 0));
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@ApiOperation("新增/修改法律援助线上发帖")
@SaCheckPermission("legal.onlinePost")
@SLog(type = "legal", tag = "新增/修改法律援助线上发帖", msg = "新增/修改法律援助线上发帖")
public Object onSubmit(LegalOnlinePost post) {
if(StrUtil.isBlank(post.getId())) {
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
post.setPoster(user.getId());
post.setLoginName(user.getLoginname());
post.setUserName(user.getUsername());
post.setUnitId(user.getUnitId());
post.setUnitName(user.getUnitName());
post.setUnionId(user.getUnionId());
post.setUnionName(user.getUnionName());
post.setMobile(user.getMobile());
post.setPostingTime(DateUtil.now());
}
dao.insertOrUpdate(post);
return Result.success();
}
@At
@ApiOperation("删除法律援助线上发帖")
@SaCheckPermission("legal.onlinePost")
@SLog(type = "legal", tag = "删除法律援助线上发帖", msg = "删除法律援助线上发帖")
public Object onDelete(String id) {
dao.delete(LegalOnlinePost.class, id);
return Result.success();
}
@At
@ApiOperation("查询法律援助线上发帖")
@SaCheckPermission("legal.onlinePost")
public Result fetchOne(String id) {
LegalOnlinePost onlinePost = dao.fetch(LegalOnlinePost.class, id);
List<LegalOnlineReply> replyList = dao.query(
LegalOnlineReply.class,
Cnd.where(LegalOnlineReply::getPostId, "=", id).desc(LegalOnlineReply::getReplyTime)
);
NutMap nutMap = Lang.obj2nutmap(onlinePost);
nutMap.put("replyList", replyList);
return Result.success(nutMap);
}
}
@@ -0,0 +1,124 @@
package com.budwk.app.zhgh.staffbenefit.legal.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalOnlinePost;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalOnlineReply;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @ClassName LegalOnlineReplyController
* @Author JyuHsin
* @Date 2025/7/24 17:35
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "法律援助线上回复")
@At("/platform/legal/onlineReply")
public class LegalOnlineReplyController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@At("")
@SaCheckPermission("legal.onlineReply")
@Ok("beetl:/platform/zhgh/staffbenefit/legal/onlineReply/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("legal.onlineReply")
public Result pageData(PageForm pageForm,
@Param(value = "year") Integer year,
@Param(value = "isReply") Boolean isReply) {
Sql sql = Sqls.create("""
SELECT
pop.id,
pop.poster,
pop.loginName,
pop.postingTime,
pop.postTitle,
pop.postContent,
CONCAT( LEFT( pop.userName, 1 ), '**' ) AS posterUserName,
count( por.id ) AS replyCount
FROM
legal_online_post pop
LEFT JOIN legal_online_reply por ON por.postId = pop.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(pop.postingTime)", "=", year);
cnd.groupBy("pop.id");
cnd.having(Cnd.where("count(por.id)", isReply == null ? ">=" : isReply ? ">" : "=", 0));
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@ApiOperation("新增/修改法律援助线上回复")
@SaCheckPermission("legal.onlineReply")
@SLog(type = "legal", tag = "新增/修改法律援助线上回复", msg = "新增/修改法律援助线上回复")
public Object onSubmit(LegalOnlineReply reply) {
if (StrUtil.isBlank(reply.getId())) {
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
reply.setReplyUserId(user.getId());
reply.setLoginName(user.getLoginname());
reply.setUserName(user.getUsername());
reply.setUnitId(user.getUnitId());
reply.setUnitName(user.getUnitName());
reply.setUnionId(user.getUnionId());
reply.setUnionName(user.getUnionName());
reply.setMobile(user.getMobile());
reply.setReplyTime(DateUtil.now());
}
dao.insertOrUpdate(reply);
return Result.success();
}
@At
@ApiOperation("查询法律援助线上回复")
@SaCheckPermission("legal.onlineReply")
public Result fetchOne(String id) {
LegalOnlinePost onlinePost = dao.fetch(LegalOnlinePost.class, id);
List<LegalOnlineReply> replyList = dao.query(
LegalOnlineReply.class,
Cnd.where(LegalOnlineReply::getPostId, "=", id).desc(LegalOnlineReply::getReplyTime)
);
replyList.forEach(item -> item.setUserName(item.getUserName().charAt(0) + "**"));
NutMap nutMap = Lang.obj2nutmap(onlinePost);
nutMap.put("userName", onlinePost.getUserName().charAt(0) + "**");
nutMap.put("replyList", replyList);
return Result.success(nutMap);
}
}
@@ -0,0 +1,112 @@
package com.budwk.app.zhgh.staffbenefit.legal.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalDoctor;
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @ClassName LegalStatisticsController
* @Author JyuHsin
* @Date 2025/7/25 16:16
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "法律援助统计分析")
@At("/platform/legal/statistics")
public class LegalStatisticsController {
@Inject
private Dao dao;
@Inject
private LegalApplyService applyService;
@At("")
@SaCheckPermission("legal.statistics")
@Ok("beetl:/platform/zhgh/staffbenefit/legal/statistics/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("legal.statistics")
public Result pageData(PageForm pageForm,
@Param(value = "year") Integer year,
@Param(value = "tableIndex") Integer tableIndex,
@Param(value = "doctorUser") String doctorUser) {
Sql sql = null;
Cnd cnd = Cnd.NEW();
if (tableIndex == 1) {
sql = Sqls.create("""
SELECT
pd.userId,
pd.userName AS doctorUserName,
pd.sex,
pd.technicalTitle as jobTitle,
(select count(*) from legal_apply pa where pa.doctorUser = pd.userId and pa.userId is not null) AS serviceNum
FROM
legal_doctor pd
LEFT JOIN legal_apply pa ON pa.doctorUser = pd.userId
$condition
""");
cnd.andEX("YEAR(pa.startTime)", "=", year);
cnd.groupBy("pd.userId");
cnd.desc("serviceNum");
} else if (tableIndex == 2) {
sql = Sqls.create("""
SELECT
pa.*,
u.username AS doctorUserName
FROM
legal_apply pa
left join vw_user u on u.id = pa.doctorUser
$condition
""");
cnd.and("pa.userId", "is not", null);
cnd.andEX("pa.doctorUser", "=", doctorUser);
cnd.andEX("YEAR(pa.startTime)", "=", year);
}
sql.setCondition(cnd);
List<NutMap> listMap = applyService.listMap(sql);
return Result.success(listMap);
}
@At
@ApiOperation("统计数量")
@SaCheckPermission("legal.statistics")
public Result queryCount(@Param(value = "year") Integer year) {
NutMap resultMap = new NutMap();
List<LegalApply> list = applyService.query(Cnd.NEW().andEX("YEAR(startTime)", "=", year));
resultMap.put("total", list.size());
long serviceTeacherCount = list.stream().map(LegalApply::getUserId).filter(StrUtil::isNotBlank).distinct().count();
resultMap.put("successNum", serviceTeacherCount);
resultMap.put("serviceTeacherCount", serviceTeacherCount);
int doctorCount = applyService.dao().count(LegalDoctor.class, Cnd.NEW());
resultMap.put("doctorCount", doctorCount);
return Result.success(resultMap);
}
}
@@ -0,0 +1,95 @@
package com.budwk.app.zhgh.staffbenefit.legal.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalStudy;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @ClassName LegalStudyController
* @Author JyuHsin
* @Date 2025/7/24 16:19
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "法律援助资料学习")
@At("/platform/legal/study")
public class LegalStudyController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@At("")
@SaCheckPermission("legal.study")
@Ok("beetl:/platform/zhgh/staffbenefit/legal/study/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("legal.study")
public Result pageData(PageForm pageForm) {
Sql sql = Sqls.create("""
select
s.*,
u.username
from
legal_study s
left join `vw_user` u on u.id = s.createdBy
$condition
""");
Cnd cnd = Cnd.NEW();
if(StrUtil.isNotBlank(pageForm.getSearchKeyword())){
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("s.title", pageForm.getSearchKeyword());
seg.orLike("s.url", pageForm.getSearchKeyword());
cnd.and(seg);
}
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@ApiOperation("新增/修改法律援助资料")
@SaCheckPermission("legal.study")
@SLog(type = "legal", tag = "新增/修改法律援助资料", msg = "新增/修改法律援助资料")
public Object onSubmit(LegalStudy study) {
dao.insertOrUpdate(study);
return Result.success();
}
@At
@ApiOperation("删除法律援助资料")
@SaCheckPermission("legal.study")
@SLog(type = "legal", tag = "删除法律援助资料", msg = "删除法律援助资料")
public Object onDelete(String id) {
dao.delete(LegalStudy.class, id);
return Result.success();
}
}
@@ -0,0 +1,114 @@
package com.budwk.app.zhgh.staffbenefit.legal.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @ClassName LegalApply
* @Author JyuHsin
* @Date 2025/7/24 16:12
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("法律援助预约")
@Accessors(chain = true)
@Table("legal_apply")
@EqualsAndHashCode(callSuper = true)
public class LegalApply extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("日期")
private String date;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("开始时间")
private String startTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("结束时间")
private String endTime;
@Column
@Comment("开始时间")
private Long startTimeTs;
@Column
@Comment("结束时间")
private Long endTimeTs;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("预约人")
private String userId;
@Column
@Comment("预约人工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("预约人姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("预约人单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("预约人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("预约人工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("预约人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("联系方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("预约人备注")
private String remark;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("咨询师")
private String doctorUser;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@Comment("咨询方式")
private List<String> askType;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("预约人选择的咨询方式")
private String askTypeValue;
}
@@ -0,0 +1,100 @@
package com.budwk.app.zhgh.staffbenefit.legal.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @ClassName LegalDoctor
* @Author JyuHsin
* @Date 2025/7/24 16:16
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("法律援助咨询师")
@Accessors(chain = true)
@Table("legal_doctor")
@EqualsAndHashCode(callSuper = true)
public class LegalDoctor extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("用户id")
private String userId;
@Column
@Comment("工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("联系方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 1)
@Comment("性别")
private String sex;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("职称")
private String technicalTitle;
@Column
@ColDefine(type = ColType.VARCHAR, width = 500)
@Comment("特长")
private String specialty;
@Column
@ColDefine(type = ColType.VARCHAR, width = 500)
@Comment("简介")
private String introduce;
@Column
@ColDefine(type = ColType.VARCHAR, width = 500)
@Comment("头像")
private String avatar;
@Column
@Comment("是否禁用")
@ColDefine(type = ColType.BOOLEAN)
private boolean disabled;
}
@@ -0,0 +1,84 @@
package com.budwk.app.zhgh.staffbenefit.legal.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @ClassName LegalOnlinePost
* @Author JyuHsin
* @Date 2025/7/24 16:17
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("法律援助线上发帖")
@Accessors(chain = true)
@Table("legal_online_post")
@EqualsAndHashCode(callSuper = true)
public class LegalOnlinePost extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("发帖人")
private String poster;
@Column
@Comment("发帖人工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("发帖人姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("发帖人单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("发帖人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("发帖人工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("发帖人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("联系方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("发帖时间")
private String postingTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("发帖标题")
private String postTitle;
@Column
@ColDefine(type = ColType.VARCHAR, width = 1000)
@Comment("发帖内容")
private String postContent;
}
@@ -0,0 +1,84 @@
package com.budwk.app.zhgh.staffbenefit.legal.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @ClassName LegalOnlineReply
* @Author JyuHsin
* @Date 2025/7/24 16:18
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("法律援助线上答复")
@Accessors(chain = true)
@Table("legal_online_reply")
@EqualsAndHashCode(callSuper = true)
public class LegalOnlineReply extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("帖子Id")
private String postId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("答复人")
private String replyUserId;
@Column
@Comment("答复人工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("答复人姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("答复人单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("答复人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("答复人工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("答复人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("联系方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("答复时间")
private String replyTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 1000)
@Comment("答复内容")
private String replyContent;
}
@@ -0,0 +1,44 @@
package com.budwk.app.zhgh.staffbenefit.legal.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @ClassName LegalStudy
* @Author JyuHsin
* @Date 2025/7/24 16:11
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("法律援助资料学习")
@Accessors(chain = true)
@Table("legal_study")
@EqualsAndHashCode(callSuper = true)
public class LegalStudy extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("标题")
private String title;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("跳转链接")
private String url;
@Column
@ColDefine(type = ColType.VARCHAR, width = 200)
@Comment("备注")
private String bz;
}
@@ -0,0 +1,14 @@
package com.budwk.app.zhgh.staffbenefit.legal.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
/**
* @ClassName LegalApplyService
* @Author JyuHsin
* @Date 2025/7/25 10:07
* @Version 1.0
* @Description TODO
*/
public interface LegalApplyService extends BaseService<LegalApply> {
}
@@ -0,0 +1,14 @@
package com.budwk.app.zhgh.staffbenefit.legal.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalDoctor;
/**
* @ClassName LegalDoctorService
* @Author JyuHsin
* @Date 2025/7/25 9:13
* @Version 1.0
* @Description TODO
*/
public interface LegalDoctorService extends BaseService<LegalDoctor> {
}
@@ -0,0 +1,24 @@
package com.budwk.app.zhgh.staffbenefit.legal.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalApply;
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalApplyService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @ClassName LegalApplyServiceImpl
* @Author JyuHsin
* @Date 2025/7/25 10:07
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean(args = {"refer:dao"})
public class LegalApplyServiceImpl extends BaseServiceImpl<LegalApply> implements LegalApplyService {
public LegalApplyServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,24 @@
package com.budwk.app.zhgh.staffbenefit.legal.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.staffbenefit.legal.model.LegalDoctor;
import com.budwk.app.zhgh.staffbenefit.legal.service.LegalDoctorService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @ClassName LegalDoctorServiceImpl
* @Author JyuHsin
* @Date 2025/7/25 9:14
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean(args = {"refer:dao"})
public class LegalDoctorServiceImpl extends BaseServiceImpl<LegalDoctor> implements LegalDoctorService {
public LegalDoctorServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,70 @@
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @ClassName PsychologyApplyController
* @Author JyuHsin
* @Date 2025/7/25 15:08
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "心理咨询预约")
@At("/platform/psychology/apply")
public class PsychologyApplyController {
@Inject
private Dao dao;
@Inject
private PsychologyApplyService applyService;
@At("")
@SaCheckPermission("psychology.apply")
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/apply/index.html")
public void index() {
}
@At
@ApiOperation("新增/修改心理咨询预约")
@SaCheckPermission("psychology.apply")
@SLog(type = "psychology", tag = "新增/修改心理咨询预约", msg = "新增/修改心理咨询预约")
public Object onSubmit(PsychologyApply apply) {
PsychologyApply psychologyApply = applyService.fetch(apply.getId());
if(StrUtil.isNotBlank(psychologyApply.getUserId())) {
return Result.error("该时段已被预约");
}
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
apply.setUserId(user.getId());
apply.setLoginName(user.getLoginname());
apply.setUserName(user.getUsername());
apply.setUnitId(user.getUnitId());
apply.setUnitName(user.getUnitName());
apply.setUnionId(user.getUnionId());
apply.setUnionName(user.getUnionName());
/*apply.setMobile(apply.getMobile());
apply.setRemark(apply.getRemark());
apply.setAskTypeValue(apply.getAskTypeValue());*/
applyService.updateIgnoreNull(apply);
//TODO:这里后面要加发短信
return Result.success();
}
}
@@ -0,0 +1,166 @@
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlinePost;
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyApplyService;
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyDoctorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @ClassName PsychologyAppointmentSetController
* @Author JyuHsin
* @Date 2025/7/25 10:04
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "心理咨询预约安排")
@At("/platform/psychology/appointmentSet")
public class PsychologyAppointmentSetController {
@Inject
private Dao dao;
@Inject
private PsychologyApplyService applyService;
@At("")
@SaCheckPermission("psychology.appointmentSet")
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/appointmentSet/index.html")
public void index() {
}
@At
@ApiOperation("查询时间段内的预约信息")
@SaCheckPermission("psychology.appointmentSet")
public Result queryAppointmentInfo(Long startTimeTs, Long endTimeTs) {
Sql sql = Sqls.create("""
SELECT
pa.*,
pa.userId as appointmentUser,
pa.userName AS appointmentUserName,
pa.loginName AS appointmentLoginName,
pa.unitName AS appointmentUnitName,
pa.mobile AS appointmentMobile,
pd.specialty AS doctorSpecialty,
pd.introduce AS doctorIntroduce,
pd.sex AS doctorSex,
pd.technicalTitle AS doctorJobTitle,
pd.unitName AS doctorUnitName,
pd.avatar AS doctorAvatar,
pd.mobile AS doctorMobile,
pd.userName AS doctorUserName
FROM
`psychology_apply` pa
LEFT JOIN psychology_doctor pd ON pd.userId = pa.doctorUser
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("startTimeTs", ">=", startTimeTs);
cnd.and("endTimeTs", "<=", endTimeTs);
sql.setCondition(cnd);
List<NutMap> listMap = applyService.listMap(sql);
return Result.success(listMap);
}
@At
@ApiOperation("新增/修改心理咨询安排")
@SaCheckPermission("psychology.appointmentSet")
@SLog(type = "psychology", tag = "新增/修改心理咨询安排", msg = "新增/修改心理咨询安排")
public Object onSubmit(PsychologyApply apply) {
long startTimeTs = com.budwk.app.base.utils.DateUtil.formatDate(apply.getStartTime());
long endTimeTs = com.budwk.app.base.utils.DateUtil.formatDate(apply.getEndTime());
List<PsychologyApply> list = new ArrayList<>();
for (long i = startTimeTs; i < endTimeTs; i = i + 3600000) {
PsychologyApply app = new PsychologyApply();
PsychologyApply psychologyAppointmentInfo = Lang.copyProperties(apply, app);
String start = com.budwk.app.base.utils.DateUtil.getDate(i / 1000);
long e = i + 3600000;
if ((endTimeTs - e) <= 0) {
e = i + (endTimeTs - i);
}
String end = com.budwk.app.base.utils.DateUtil.getDate(e / 1000);
psychologyAppointmentInfo.setStartTimeTs(i);
psychologyAppointmentInfo.setEndTimeTs(e);
psychologyAppointmentInfo.setStartTime(start);
psychologyAppointmentInfo.setEndTime(end);
list.add(psychologyAppointmentInfo);
}
dao.insert(list);
return Result.success();
}
@At
@ApiOperation("修改心理咨询安排")
@SaCheckPermission("psychology.appointmentSet")
@SLog(type = "psychology", tag = "修改心理咨询安排", msg = "修改心理咨询安排")
public Object onEdit(String id, String[] askType) {
PsychologyApply apply = applyService.fetch(id);
apply.setAskType(Lang.isNotEmpty(askType) ? Arrays.asList(askType) : new ArrayList<>());
apply.setAskTypeValue(null);
applyService.update(apply);
//TODO:以后这里加个发短信
return Result.success();
}
@At
@ApiOperation("删除心理咨询安排")
@SaCheckPermission("psychology.appointmentSet")
@SLog(type = "psychology", tag = "删除心理咨询安排", msg = "删除心理咨询安排")
public Object onDelete(String id) {
applyService.delete(id);
//TODO:以后这里加个发短信
return Result.success();
}
@At
@ApiOperation("查询咨询师")
@SaCheckPermission("psychology.appointmentSet")
public Result queryDoctorUser(String keyWord, long startTimeTs, long endTimeTs) {
//先查询该时间段没时间的咨询师
Sql doctorSql = Sqls.create("""
SELECT
pd.userId AS id,
pd.userName AS doctorUserName,
replace(pd.mobile,' ','') as mobile
FROM
psychology_doctor pd
WHERE
pd.userId NOT IN
(
SELECT doctorUser FROM psychology_apply
WHERE startTimeTs >= @startTimeTs AND endTimeTs <= @endTimeTs
AND doctorUser IS NOT NULL
)
and (pd.userName like @keyWord or pd.loginName like @keyWord)
""");
doctorSql.setParam("startTimeTs", startTimeTs);
doctorSql.setParam("endTimeTs", endTimeTs);
doctorSql.setParam("keyWord", "%" + keyWord + "%");
Pagination pagination = applyService.listPageMap(1, 10, doctorSql);
return Result.success(pagination.getList());
}
}
@@ -0,0 +1,140 @@
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyDoctor;
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyDoctorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
/**
* @ClassName PsychologyDoctorController
* @Author JyuHsin
* @Date 2025/7/24 18:18
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "心理咨询咨询师")
@At("/platform/psychology/doctorManage")
public class PsychologyDoctorController {
@Inject
private Dao dao;
@Inject
private PsychologyDoctorService doctorService;
@At("")
@SaCheckPermission("psychology.doctorManage")
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/doctorManage/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("psychology.doctorManage")
public Result pageData(PageForm pageForm) {
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or(PsychologyDoctor::getLoginName, "like", "%" + pageForm.getSearchKeyword() + "%");
seg.or(PsychologyDoctor::getUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
cnd.and(seg);
}
Pagination pagination = doctorService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
return Result.success(pagination);
}
@At
@Aop(TransAop.READ_COMMITTED)
@ApiOperation("新增/修改心理咨询师")
@SaCheckPermission("psychology.doctorManage")
@SLog(type = "psychology", tag = "新增/修改心理咨询师", msg = "新增/修改心理咨询师")
public Object onSubmit(PsychologyDoctor doctor) {
if(StrUtil.isBlank(doctor.getId())) {
int count = doctorService.count(Cnd.where(PsychologyDoctor::getUserId, "=", doctor.getUserId()));
if(count > 0) {
return Result.error("此咨询师信息已录入");
}
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", doctor.getUserId()));
doctor.setLoginName(user.getLoginname());
doctor.setUserName(user.getUsername());
doctor.setUnitId(user.getUnitId());
doctor.setUnitName(user.getUnitName());
doctor.setUnionId(user.getUnionId());
doctor.setUnionName(user.getUnionName());
//插入角色
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(doctor.getUserId());
userRole.setRoleId(RoleConstant.PSYCHOLOGY_DOCTOR.name());
dao.insert(userRole);
}
doctorService.insertOrUpdate(doctor);
return Result.success();
}
@At
@ApiOperation("删除心理咨询师")
@SaCheckPermission("psychology.doctorManage")
@SLog(type = "psychology", tag = "删除心理咨询师", msg = "删除心理咨询师")
public Object onDelete(String id) {
doctorService.delete(id);
return Result.success();
}
@At
@ApiOperation("查询用户")
@SaCheckPermission("psychology.doctorManage")
@SLog(type = "psychology", tag = "查询用户", msg = "查询用户")
public Object listUser(String keyword) {
Sql sql = Sqls.create("""
select
id,
username as userName,
loginname as loginName,
sex,
mobile,
technicalTitle,
unitname as unitName
from
vw_user
$condition
""");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(keyword)) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or(View_user::getLoginname, "like", "%" + keyword + "%");
seg.or(View_user::getUsername, "like", "%" + keyword + "%");
cnd.and(seg);
}
List<PsychologyDoctor> list = doctorService.query(Cnd.NEW());
List<String> idList = list.stream().map(PsychologyDoctor::getUserId).toList();
cnd.andEX(View_user::getId, "not in", idList);
sql.setCondition(cnd);
Pagination pagination = doctorService.listPageMap(1, 50, sql);
return Result.success(pagination.getList());
}
}
@@ -0,0 +1,107 @@
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlinePost;
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* @ClassName PsychologyListController
* @Author JyuHsin
* @Date 2025/7/25 16:00
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "心理咨询我的预约")
@At("/platform/psychology/list")
public class PsychologyListController {
@Inject
private Dao dao;
@Inject
private PsychologyApplyService applyService;
@At("")
@SaCheckPermission("psychology.list")
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/list/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("psychology.list")
public Result pageData(PageForm pageForm,
@Param(value = "year") Integer year) {
Sql sql = Sqls.create("""
SELECT
pa.*,
pa.userName AS appointmentUserName,
pa.loginName AS appointmentLoginName,
pa.unitName AS appointmentUnitName,
pa.mobile AS appointmentMobile,
pd.specialty AS doctorSpecialty,
pd.introduce AS doctorIntroduce,
pd.sex AS doctorSex,
pd.technicalTitle AS doctorJobTitle,
pd.unitName AS doctorUnitName,
pd.avatar AS doctorAvatar,
pd.mobile AS doctorMobile,
pd.userName AS doctorUserName
FROM
`psychology_apply` pa
LEFT JOIN psychology_doctor pd ON pd.userId = pa.doctorUser
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("pa.userId", "IS NOT", null);
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
cnd.and("pa.userId", "=", SecurityUtil.getUserId());
}
cnd.andEX("YEAR(pa.startTime)", "=", year);
cnd.desc("pa.startTime");
sql.setCondition(cnd);
Pagination pagination = applyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@ApiOperation("删除心理咨询预约")
@SaCheckPermission("psychology.list")
@SLog(type = "psychology", tag = "删除心理咨询预约", msg = "删除心理咨询预约")
public Object onDelete(String id) {
PsychologyApply apply = applyService.fetch(id);
apply.setUserId(null);
apply.setLoginName(null);
apply.setUserName(null);
apply.setUnitId(null);
apply.setUnitName(null);
apply.setUnionId(null);
apply.setUnionName(null);
apply.setRemark(null);
apply.setMobile(null);
applyService.update(apply);
return Result.success();
}
}
@@ -0,0 +1,129 @@
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlinePost;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlineReply;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @ClassName PsychologyOnlinePostController
* @Author JyuHsin
* @Date 2025/7/24 16:37
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "心理咨询线上发帖")
@At("/platform/psychology/onlinePost")
public class PsychologyOnlinePostController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@At("")
@SaCheckPermission("psychology.onlinePost")
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/onlinePost/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("psychology.onlinePost")
public Result pageData(PageForm pageForm,
@Param(value = "year") Integer year,
@Param(value = "isReply") Boolean isReply) {
Sql sql = Sqls.create("""
SELECT
pop.*,
IF( count( por.id ) = 0, false, true ) AS isReply
FROM
psychology_online_post pop
LEFT JOIN psychology_online_reply por on por.postId = pop.id
$condition
""");
Cnd cnd = Cnd.NEW();
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("poster", "=", SecurityUtil.getUserId());
}
cnd.andEX("YEAR(pop.postingTime)", "=", year);
cnd.groupBy("pop.id");
cnd.having(Cnd.where("count(por.id)", isReply == null ? ">=" : isReply ? ">" : "=", 0));
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@ApiOperation("新增/修改心理咨询线上发帖")
@SaCheckPermission("psychology.onlinePost")
@SLog(type = "psychology", tag = "新增/修改心理咨询线上发帖", msg = "新增/修改心理咨询线上发帖")
public Object onSubmit(PsychologyOnlinePost post) {
if(StrUtil.isBlank(post.getId())) {
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
post.setPoster(user.getId());
post.setLoginName(user.getLoginname());
post.setUserName(user.getUsername());
post.setUnitId(user.getUnitId());
post.setUnitName(user.getUnitName());
post.setUnionId(user.getUnionId());
post.setUnionName(user.getUnionName());
post.setMobile(user.getMobile());
post.setPostingTime(DateUtil.now());
}
dao.insertOrUpdate(post);
return Result.success();
}
@At
@ApiOperation("删除心理咨询线上发帖")
@SaCheckPermission("psychology.onlinePost")
@SLog(type = "psychology", tag = "删除心理咨询线上发帖", msg = "删除心理咨询线上发帖")
public Object onDelete(String id) {
dao.delete(PsychologyOnlinePost.class, id);
return Result.success();
}
@At
@ApiOperation("查询心理咨询线上发帖")
@SaCheckPermission("psychology.onlinePost")
public Result fetchOne(String id) {
PsychologyOnlinePost onlinePost = dao.fetch(PsychologyOnlinePost.class, id);
List<PsychologyOnlineReply> replyList = dao.query(
PsychologyOnlineReply.class,
Cnd.where(PsychologyOnlineReply::getPostId, "=", id).desc(PsychologyOnlineReply::getReplyTime)
);
NutMap nutMap = Lang.obj2nutmap(onlinePost);
nutMap.put("replyList", replyList);
return Result.success(nutMap);
}
}
@@ -0,0 +1,124 @@
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlinePost;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyOnlineReply;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @ClassName PsychologyOnlineReplyController
* @Author JyuHsin
* @Date 2025/7/24 17:35
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "心理咨询线上回复")
@At("/platform/psychology/onlineReply")
public class PsychologyOnlineReplyController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@At("")
@SaCheckPermission("psychology.onlineReply")
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/onlineReply/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("psychology.onlineReply")
public Result pageData(PageForm pageForm,
@Param(value = "year") Integer year,
@Param(value = "isReply") Boolean isReply) {
Sql sql = Sqls.create("""
SELECT
pop.id,
pop.poster,
pop.loginName,
pop.postingTime,
pop.postTitle,
pop.postContent,
CONCAT( LEFT( pop.userName, 1 ), '**' ) AS posterUserName,
count( por.id ) AS replyCount
FROM
psychology_online_post pop
LEFT JOIN psychology_online_reply por ON por.postId = pop.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(pop.postingTime)", "=", year);
cnd.groupBy("pop.id");
cnd.having(Cnd.where("count(por.id)", isReply == null ? ">=" : isReply ? ">" : "=", 0));
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@ApiOperation("新增/修改心理咨询线上回复")
@SaCheckPermission("psychology.onlineReply")
@SLog(type = "psychology", tag = "新增/修改心理咨询线上回复", msg = "新增/修改心理咨询线上回复")
public Object onSubmit(PsychologyOnlineReply reply) {
if (StrUtil.isBlank(reply.getId())) {
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
reply.setReplyUserId(user.getId());
reply.setLoginName(user.getLoginname());
reply.setUserName(user.getUsername());
reply.setUnitId(user.getUnitId());
reply.setUnitName(user.getUnitName());
reply.setUnionId(user.getUnionId());
reply.setUnionName(user.getUnionName());
reply.setMobile(user.getMobile());
reply.setReplyTime(DateUtil.now());
}
dao.insertOrUpdate(reply);
return Result.success();
}
@At
@ApiOperation("查询心理咨询线上回复")
@SaCheckPermission("psychology.onlineReply")
public Result fetchOne(String id) {
PsychologyOnlinePost onlinePost = dao.fetch(PsychologyOnlinePost.class, id);
List<PsychologyOnlineReply> replyList = dao.query(
PsychologyOnlineReply.class,
Cnd.where(PsychologyOnlineReply::getPostId, "=", id).desc(PsychologyOnlineReply::getReplyTime)
);
replyList.forEach(item -> item.setUserName(item.getUserName().charAt(0) + "**"));
NutMap nutMap = Lang.obj2nutmap(onlinePost);
nutMap.put("userName", onlinePost.getUserName().charAt(0) + "**");
nutMap.put("replyList", replyList);
return Result.success(nutMap);
}
}
@@ -0,0 +1,112 @@
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyDoctor;
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @ClassName PsychologyStatisticsController
* @Author JyuHsin
* @Date 2025/7/25 16:16
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "心理咨询统计分析")
@At("/platform/psychology/statistics")
public class PsychologyStatisticsController {
@Inject
private Dao dao;
@Inject
private PsychologyApplyService applyService;
@At("")
@SaCheckPermission("psychology.statistics")
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/statistics/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("psychology.statistics")
public Result pageData(PageForm pageForm,
@Param(value = "year") Integer year,
@Param(value = "tableIndex") Integer tableIndex,
@Param(value = "doctorUser") String doctorUser) {
Sql sql = null;
Cnd cnd = Cnd.NEW();
if (tableIndex == 1) {
sql = Sqls.create("""
SELECT
pd.userId,
pd.userName AS doctorUserName,
pd.sex,
pd.technicalTitle as jobTitle,
(select count(*) from psychology_apply pa where pa.doctorUser = pd.userId and pa.userId is not null) AS serviceNum
FROM
psychology_doctor pd
LEFT JOIN psychology_apply pa ON pa.doctorUser = pd.userId
$condition
""");
cnd.andEX("YEAR(pa.startTime)", "=", year);
cnd.groupBy("pd.userId");
cnd.desc("serviceNum");
} else if (tableIndex == 2) {
sql = Sqls.create("""
SELECT
pa.*,
u.username AS doctorUserName
FROM
psychology_apply pa
left join vw_user u on u.id = pa.doctorUser
$condition
""");
cnd.and("pa.userId", "is not", null);
cnd.andEX("pa.doctorUser", "=", doctorUser);
cnd.andEX("YEAR(pa.startTime)", "=", year);
}
sql.setCondition(cnd);
List<NutMap> listMap = applyService.listMap(sql);
return Result.success(listMap);
}
@At
@ApiOperation("统计数量")
@SaCheckPermission("psychology.statistics")
public Result queryCount(@Param(value = "year") Integer year) {
NutMap resultMap = new NutMap();
List<PsychologyApply> list = applyService.query(Cnd.NEW().andEX("YEAR(startTime)", "=", year));
resultMap.put("total", list.size());
long serviceTeacherCount = list.stream().map(PsychologyApply::getUserId).filter(StrUtil::isNotBlank).distinct().count();
resultMap.put("successNum", serviceTeacherCount);
resultMap.put("serviceTeacherCount", serviceTeacherCount);
int doctorCount = applyService.dao().count(PsychologyDoctor.class, Cnd.NEW());
resultMap.put("doctorCount", doctorCount);
return Result.success(resultMap);
}
}
@@ -0,0 +1,95 @@
package com.budwk.app.zhgh.staffbenefit.psychology.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyStudy;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @ClassName PsychologyStudyController
* @Author JyuHsin
* @Date 2025/7/24 16:19
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "心理咨询资料学习")
@At("/platform/psychology/study")
public class PsychologyStudyController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@At("")
@SaCheckPermission("psychology.study")
@Ok("beetl:/platform/zhgh/staffbenefit/psychology/study/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("psychology.study")
public Result pageData(PageForm pageForm) {
Sql sql = Sqls.create("""
select
s.*,
u.username
from
psychology_study s
left join `vw_user` u on u.id = s.createdBy
$condition
""");
Cnd cnd = Cnd.NEW();
if(StrUtil.isNotBlank(pageForm.getSearchKeyword())){
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("s.title", pageForm.getSearchKeyword());
seg.orLike("s.url", pageForm.getSearchKeyword());
cnd.and(seg);
}
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@ApiOperation("新增/修改心理咨询资料")
@SaCheckPermission("psychology.study")
@SLog(type = "psychology", tag = "新增/修改心理咨询资料", msg = "新增/修改心理咨询资料")
public Object onSubmit(PsychologyStudy study) {
dao.insertOrUpdate(study);
return Result.success();
}
@At
@ApiOperation("删除心理咨询资料")
@SaCheckPermission("psychology.study")
@SLog(type = "psychology", tag = "删除心理咨询资料", msg = "删除心理咨询资料")
public Object onDelete(String id) {
dao.delete(PsychologyStudy.class, id);
return Result.success();
}
}
@@ -0,0 +1,114 @@
package com.budwk.app.zhgh.staffbenefit.psychology.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @ClassName PsychologyApply
* @Author JyuHsin
* @Date 2025/7/24 16:12
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("心理咨询预约")
@Accessors(chain = true)
@Table("psychology_apply")
@EqualsAndHashCode(callSuper = true)
public class PsychologyApply extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("日期")
private String date;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("开始时间")
private String startTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("结束时间")
private String endTime;
@Column
@Comment("开始时间")
private Long startTimeTs;
@Column
@Comment("结束时间")
private Long endTimeTs;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("预约人")
private String userId;
@Column
@Comment("预约人工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("预约人姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("预约人单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("预约人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("预约人工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("预约人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("联系方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("预约人备注")
private String remark;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("咨询师")
private String doctorUser;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@Comment("咨询方式")
private List<String> askType;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("预约人选择的咨询方式")
private String askTypeValue;
}
@@ -0,0 +1,100 @@
package com.budwk.app.zhgh.staffbenefit.psychology.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @ClassName PsychologyDoctor
* @Author JyuHsin
* @Date 2025/7/24 16:16
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("心理咨询咨询师")
@Accessors(chain = true)
@Table("psychology_doctor")
@EqualsAndHashCode(callSuper = true)
public class PsychologyDoctor extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("用户id")
private String userId;
@Column
@Comment("工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("联系方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 1)
@Comment("性别")
private String sex;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("职称")
private String technicalTitle;
@Column
@ColDefine(type = ColType.VARCHAR, width = 500)
@Comment("特长")
private String specialty;
@Column
@ColDefine(type = ColType.VARCHAR, width = 500)
@Comment("简介")
private String introduce;
@Column
@ColDefine(type = ColType.VARCHAR, width = 500)
@Comment("头像")
private String avatar;
@Column
@Comment("是否禁用")
@ColDefine(type = ColType.BOOLEAN)
private boolean disabled;
}
@@ -0,0 +1,84 @@
package com.budwk.app.zhgh.staffbenefit.psychology.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @ClassName PsychologyOnlinePost
* @Author JyuHsin
* @Date 2025/7/24 16:17
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("心理咨询线上发帖")
@Accessors(chain = true)
@Table("psychology_online_post")
@EqualsAndHashCode(callSuper = true)
public class PsychologyOnlinePost extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("发帖人")
private String poster;
@Column
@Comment("发帖人工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("发帖人姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("发帖人单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("发帖人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("发帖人工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("发帖人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("联系方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("发帖时间")
private String postingTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("发帖标题")
private String postTitle;
@Column
@ColDefine(type = ColType.VARCHAR, width = 1000)
@Comment("发帖内容")
private String postContent;
}
@@ -0,0 +1,84 @@
package com.budwk.app.zhgh.staffbenefit.psychology.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @ClassName PsychologyOnlineReply
* @Author JyuHsin
* @Date 2025/7/24 16:18
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("心理咨询线上答复")
@Accessors(chain = true)
@Table("psychology_online_reply")
@EqualsAndHashCode(callSuper = true)
public class PsychologyOnlineReply extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("帖子Id")
private String postId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("答复人")
private String replyUserId;
@Column
@Comment("答复人工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("答复人姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("答复人单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("答复人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("答复人工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("答复人单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("联系方式")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 30)
@Comment("答复时间")
private String replyTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 1000)
@Comment("答复内容")
private String replyContent;
}
@@ -0,0 +1,44 @@
package com.budwk.app.zhgh.staffbenefit.psychology.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @ClassName PsychologyStudy
* @Author JyuHsin
* @Date 2025/7/24 16:11
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("心理咨询资料学习")
@Accessors(chain = true)
@Table("psychology_study")
@EqualsAndHashCode(callSuper = true)
public class PsychologyStudy extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("标题")
private String title;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("跳转链接")
private String url;
@Column
@ColDefine(type = ColType.VARCHAR, width = 200)
@Comment("备注")
private String bz;
}
@@ -0,0 +1,14 @@
package com.budwk.app.zhgh.staffbenefit.psychology.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
/**
* @ClassName PsychologyApplyService
* @Author JyuHsin
* @Date 2025/7/25 10:07
* @Version 1.0
* @Description TODO
*/
public interface PsychologyApplyService extends BaseService<PsychologyApply> {
}
@@ -0,0 +1,14 @@
package com.budwk.app.zhgh.staffbenefit.psychology.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyDoctor;
/**
* @ClassName PsychologyDoctorService
* @Author JyuHsin
* @Date 2025/7/25 9:13
* @Version 1.0
* @Description TODO
*/
public interface PsychologyDoctorService extends BaseService<PsychologyDoctor> {
}
@@ -0,0 +1,24 @@
package com.budwk.app.zhgh.staffbenefit.psychology.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyApply;
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyApplyService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @ClassName PsychologyApplyServiceImpl
* @Author JyuHsin
* @Date 2025/7/25 10:07
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean(args = {"refer:dao"})
public class PsychologyApplyServiceImpl extends BaseServiceImpl<PsychologyApply> implements PsychologyApplyService {
public PsychologyApplyServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,24 @@
package com.budwk.app.zhgh.staffbenefit.psychology.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.staffbenefit.psychology.model.PsychologyDoctor;
import com.budwk.app.zhgh.staffbenefit.psychology.service.PsychologyDoctorService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @ClassName PsychologyDoctorServiceImpl
* @Author JyuHsin
* @Date 2025/7/25 9:14
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean(args = {"refer:dao"})
public class PsychologyDoctorServiceImpl extends BaseServiceImpl<PsychologyDoctor> implements PsychologyDoctorService {
public PsychologyDoctorServiceImpl(Dao dao) {
super(dao);
}
}