first commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package io.v.nutz.legalAid.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.legalAid.models.LegalAidAppointmentInfo;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/legalAid/appointmentApply")
|
||||
@Ok("json:full")
|
||||
public class LegalAidAppointmentApplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/legalAid/appointmentApply.html")
|
||||
@RequiresPermissions("legalAid.appointmentApply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doApply(String id, String appointmentUserNote) {
|
||||
LegalAidAppointmentInfo info = dao.fetch(LegalAidAppointmentInfo.class, id);
|
||||
if (StrUtil.isNotBlank(info.getAppointmentUser())) {
|
||||
return Result.error(2, "该时段刚刚已经被人预约过了喔!");
|
||||
}
|
||||
info.setAppointmentUserNote(appointmentUserNote);
|
||||
info.setAppointmentUser((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
//info.setStateId(2100);
|
||||
info.setStateId(2300);
|
||||
dao.update(info);
|
||||
return Result.success().addMsg("预约成功!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package io.v.nutz.legalAid.controller;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.legalAid.models.LegalAidAppointmentInfo;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* 我的申请列表
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/legalAid/appointment/applyList")
|
||||
@Ok("json:full")
|
||||
public class LegalAidAppointmentApplyList {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/legalAid/applyList.html")
|
||||
@RequiresPermissions("legalAid.appointment.applyList")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, Integer year, Integer stateId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pai.*,
|
||||
au.username AS appointmentUserName,
|
||||
au.loginname AS appointmentLoginName,
|
||||
au.unitname AS appointmentUnitName,
|
||||
au.mobile AS appointmentMobile,
|
||||
au.sex AS appointmentSex,
|
||||
pd.specialty AS doctorSpecialty,
|
||||
pd.introduce AS doctorIntroduce,
|
||||
pd.sex AS doctorSex,
|
||||
pd.jobTitle AS doctorJobTitle,
|
||||
pd.unitName AS doctorUnitName,
|
||||
pd.avatar AS doctorAvatar,
|
||||
pd.mobile AS doctorMobile,
|
||||
doctor.username AS doctorUserName,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`legal_aid_appointment_info` pai
|
||||
LEFT JOIN `user` au ON au.id = pai.appointmentUser
|
||||
LEFT JOIN legal_aid_doctor pd ON pd.userid = pai.doctorUser
|
||||
LEFT JOIN sys_user doctor ON doctor.id = pai.doctorUser
|
||||
LEFT JOIN audit_state state ON state.stateId = pai.stateId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("pai.appointmentUser", "IS NOT", null);
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("pai.appointmentUser", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
cnd.andEX("YEAR(pai.startTime)", "=", year);
|
||||
cnd.andEX("pai.stateId", "=", stateId);
|
||||
cnd.desc("pai.startTime");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doCancel(String id) {
|
||||
Chain cancelChain = Chain.make("appointmentUser", null);
|
||||
cancelChain.add("appointmentUserNote", null);
|
||||
cancelChain.add("stateId", null);
|
||||
// cancelChain.add("doctorUser", null).add("stateId", null);
|
||||
dao.update(LegalAidAppointmentInfo.class, cancelChain, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package io.v.nutz.legalAid.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.legalAid.models.LegalAidAppointmentInfo;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* 预约时间设置
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/legalAid/appointmentSet")
|
||||
@Ok("json:full")
|
||||
public class LegalAidAppointmentSetController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/legalAid/appointmentSet.html")
|
||||
@RequiresPermissions("legalAid.appointmentSet")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询时间段内的预约信息
|
||||
*
|
||||
* @param startTimeTs
|
||||
* @param endTimeTs
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAppointmentInfo(Long startTimeTs, Long endTimeTs) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("startTimeTs", ">=", startTimeTs);
|
||||
cnd.and("endTimeTs", "<=", endTimeTs);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pai.*,
|
||||
au.username AS appointmentUserName,
|
||||
au.loginname AS appointmentLoginName,
|
||||
au.unitname AS appointmentUnitName,
|
||||
au.mobile AS appointmentMobile,
|
||||
au.sex AS appointmentSex,
|
||||
pd.specialty AS doctorSpecialty,
|
||||
pd.introduce AS doctorIntroduce,
|
||||
pd.sex AS doctorSex,
|
||||
pd.jobTitle AS doctorJobTitle,
|
||||
pd.unitName AS doctorUnitName,
|
||||
pd.avatar AS doctorAvatar,
|
||||
pd.mobile AS doctorMobile,
|
||||
doctor.username AS doctorUserName,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`legal_aid_appointment_info` pai
|
||||
LEFT JOIN `user` au ON au.id = pai.appointmentUser
|
||||
LEFT JOIN legal_aid_doctor pd ON pd.userid = pai.doctorUser
|
||||
LEFT JOIN sys_user doctor ON doctor.id = pai.doctorUser
|
||||
LEFT JOIN audit_state state ON state.stateId = pai.stateId
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增预约时间段 安排咨询师
|
||||
*
|
||||
* @param appointmentInfo
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(LegalAidAppointmentInfo appointmentInfo) {
|
||||
long startTimeTs = DateUtil.formatDate(appointmentInfo.getStartTime());
|
||||
long endTimeTs = DateUtil.formatDate(appointmentInfo.getEndTime());
|
||||
appointmentInfo.setStartTimeTs(startTimeTs);
|
||||
appointmentInfo.setEndTimeTs(endTimeTs);
|
||||
dao.insert(appointmentInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
dao.clear(LegalAidAppointmentInfo.class, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object selectQueryDoctorUser(String keyWord, long startTimeTs, long endTimeTs) {
|
||||
//先查询该时间段没时间的咨询师
|
||||
Sql doctorSql = Sqls.create("""
|
||||
SELECT
|
||||
pd.userid AS id,
|
||||
u.username AS doctorUserName
|
||||
FROM
|
||||
legal_aid_doctor pd
|
||||
LEFT JOIN sys_user u ON u.id = pd.userid
|
||||
WHERE
|
||||
pd.userid NOT IN
|
||||
(
|
||||
SELECT doctorUser FROM legal_aid_appointment_info
|
||||
WHERE startTimeTs >= @startTimeTs AND endTimeTs <= @endTimeTs
|
||||
AND doctorUser IS NOT NULL
|
||||
)
|
||||
""");
|
||||
doctorSql.setParam("startTimeTs", startTimeTs);
|
||||
doctorSql.setParam("endTimeTs", endTimeTs);
|
||||
Pagination pagination = baseService.listPageMap(1, 10, doctorSql);
|
||||
return pagination.getList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配心理咨询师
|
||||
*
|
||||
* @param id
|
||||
* @param doctorUser
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doSetDoctor(String id, String doctorUser) {
|
||||
Chain chain = Chain.make("doctorUser", doctorUser);
|
||||
|
||||
LegalAidAppointmentInfo appointmentInfo = dao.fetch(LegalAidAppointmentInfo.class, Cnd.where("id", "=", id));
|
||||
|
||||
if (StrUtil.isNotBlank(appointmentInfo.getAppointmentUser())) {
|
||||
chain.add("stateId", 2300);
|
||||
}
|
||||
|
||||
dao.update(LegalAidAppointmentInfo.class, chain, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package io.v.nutz.legalAid.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.legalAid.models.LegalAidDoctor;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.trans.Trans;
|
||||
|
||||
/**
|
||||
* 心理咨询 咨询师管理
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/legalAid/doctorManager")
|
||||
@Ok("json:full")
|
||||
public class LegalAidDoctorManageController {
|
||||
|
||||
private static final String LEGALAIDSPECIALIST_ROLEID = "f07aceb8e7a847339d484b1d09d57388";
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/legalAid/doctorManager.html")
|
||||
@RequiresPermissions("legalAid.doctor.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加咨询师
|
||||
*
|
||||
* @param psychologyDoctor
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(LegalAidDoctor psychologyDoctor) {
|
||||
if (dao.count(LegalAidDoctor.class, Cnd.where("userid", "=", psychologyDoctor.getUserid())) > 0) {
|
||||
return Result.error(2, "不能重复录入!");
|
||||
}
|
||||
Trans.exec(() -> {
|
||||
dao.insert(psychologyDoctor);
|
||||
Sys_user_role role = new Sys_user_role();
|
||||
role.setUserId(psychologyDoctor.getId());
|
||||
role.setRoleId(LEGALAIDSPECIALIST_ROLEID);
|
||||
dao.insert(role);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑咨询师信息
|
||||
*
|
||||
* @param psychologyDoctor
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doEdit(LegalAidDoctor psychologyDoctor) {
|
||||
Trans.exec(() -> {
|
||||
dao.updateIgnoreNull(psychologyDoctor);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchName())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pd.*,
|
||||
u.username,
|
||||
u.loginname
|
||||
FROM
|
||||
legal_aid_doctor pd
|
||||
left join `user` u on u.id = pd.userid
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除咨询师
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
Trans.exec(() -> {
|
||||
LegalAidDoctor psychologyDoctor = dao.fetch(LegalAidDoctor.class, id);
|
||||
dao.clear(Sys_user_role.class, Cnd.where("userid", "=", psychologyDoctor.getUserid()).and("roleid", "=", LEGALAIDSPECIALIST_ROLEID));
|
||||
dao.clear(LegalAidDoctor.class, Cnd.where("id", "=", id));
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
package io.v.nutz.legalAid.controller.onlinePost;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.legalAid.models.LegalAidOnlinePosts;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 线上心理咨询
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/legalAid/onlinePost")
|
||||
@Ok("json:full")
|
||||
public class LegalAidOnlinePostController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/legalAid/onlinePost/post.html")
|
||||
@RequiresPermissions("legalAid.onlinepost")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, Integer year, String isReply) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pop.*,
|
||||
poster.username AS posterUserName,
|
||||
poster.loginname AS posterLoginName,
|
||||
IF( count( popr.id ) = 0, false, true ) AS isReply
|
||||
FROM
|
||||
legal_aid_online_posts pop
|
||||
LEFT JOIN sys_user poster on poster.id = pop.poster
|
||||
LEFT JOIN legal_aid_online_posts_reply popr on popr.postId = pop.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("poster", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
cnd.andEX("YEAR(pop.postingTime)", "=", year);
|
||||
cnd.groupBy("pop.id");
|
||||
switch (isReply) {
|
||||
case "true" -> cnd.having(Cnd.where("count(popr.id)", ">", 0));
|
||||
case "false" -> cnd.having(Cnd.where("count(popr.id)", "=", 0));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
List<NutMap> list = pagination.getList(NutMap.class);
|
||||
list.forEach(v -> {
|
||||
String postId = v.getString("id");
|
||||
Sql replySql = Sqls.create("""
|
||||
SELECT
|
||||
popr.*,
|
||||
u.username AS replyUserName
|
||||
FROM
|
||||
legal_aid_online_posts_reply popr
|
||||
LEFT JOIN sys_user u ON u.id = popr.replyUser
|
||||
WHERE
|
||||
postId = @postId
|
||||
""").setParam("postId", postId);
|
||||
replySql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(replySql);
|
||||
List<NutMap> replyList = replySql.getList(NutMap.class);
|
||||
v.setv("replyList", replyList);
|
||||
});
|
||||
pagination.setList(list);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布咨询
|
||||
*
|
||||
* @param posts
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(LegalAidOnlinePosts posts) {
|
||||
posts.setPoster((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
posts.setPostingTime(DateUtil.getDateTime());
|
||||
dao.insert(posts);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param posts
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doEdit(LegalAidOnlinePosts posts) {
|
||||
dao.updateIgnoreNull(posts);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
dao.clear(LegalAidOnlinePosts.class, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 咨询师回复
|
||||
*
|
||||
* @param id
|
||||
* @param replyContent
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doReply(String id, String replyContent) {
|
||||
Chain chain = Chain.make("replyContent", replyContent);
|
||||
chain.add("replyTime", DateUtil.getDateTime());
|
||||
chain.add("replyUser", ShiroUtil.getPrincipalProperty("id"));
|
||||
dao.update(LegalAidOnlinePosts.class, chain, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package io.v.nutz.legalAid.controller.onlinePost;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.legalAid.models.LegalAidOnlinePostsReply;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/legalAid/onlinePostReply")
|
||||
@Ok("json:full")
|
||||
public class LegalAidOnlinePostReplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/legalAid/onlinePost/reply.html")
|
||||
@RequiresPermissions("legalAid.onlinepost.reply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, Integer year, String isReply) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pop.*,
|
||||
CONCAT(LEFT(poster.username,1),'**') AS posterUserName,
|
||||
count( popr.id ) AS replyCount
|
||||
FROM
|
||||
legal_aid_online_posts pop
|
||||
LEFT JOIN sys_user poster ON poster.id = pop.poster
|
||||
LEFT JOIN legal_aid_online_posts_reply popr ON popr.postId = pop.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(pop.postingTime)", "=", year);
|
||||
cnd.groupBy("pop.id");
|
||||
switch (isReply) {
|
||||
case "true" -> cnd.having(Cnd.where("count(popr.id)", ">", 0));
|
||||
case "false" -> cnd.having(Cnd.where("count(popr.id)", "=", 0));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
List<NutMap> list = pagination.getList(NutMap.class);
|
||||
list.forEach(v -> {
|
||||
String postId = v.getString("id");
|
||||
Sql replySql = Sqls.create("""
|
||||
SELECT
|
||||
popr.*,
|
||||
CONCAT(LEFT(u.username,1),'**') AS replyUserName
|
||||
FROM
|
||||
legal_aid_online_posts_reply popr
|
||||
LEFT JOIN sys_user u ON u.id = popr.replyUser
|
||||
WHERE
|
||||
postId = @postId
|
||||
""").setParam("postId", postId);
|
||||
replySql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(replySql);
|
||||
List<NutMap> replyList = replySql.getList(NutMap.class);
|
||||
v.setv("replyList", replyList);
|
||||
});
|
||||
pagination.setList(list);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复咨询
|
||||
*
|
||||
* @param postId
|
||||
* @param replyContent
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doReply(String postId, String replyContent) {
|
||||
LegalAidOnlinePostsReply postsReply = new LegalAidOnlinePostsReply();
|
||||
postsReply.setPostId(postId);
|
||||
postsReply.setReplyTime(DateUtil.getDateTime());
|
||||
postsReply.setReplyContent(replyContent);
|
||||
postsReply.setReplyUser((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
dao.insert(postsReply);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package io.v.nutz.legalAid.controller.statistics;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/legalAid/statistics")
|
||||
@Ok("json:full")
|
||||
public class LegalAidStatisticsController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/legalAid/statistics/apply.html")
|
||||
@RequiresPermissions("legalAid.statistics")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getData(Integer year) {
|
||||
//查询一共开放了多少次预约场次 预约成功的场次
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count( 1 ) AS total,
|
||||
count( CASE stateId WHEN 2300 THEN 1 END ) AS successNum
|
||||
FROM
|
||||
legal_aid_appointment_info
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(Cnd.NEW().andEX("YEAR(startTime)", "=", year));
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap numberSessionMap = (NutMap) sql.getResult();
|
||||
|
||||
//为多少教师服务过
|
||||
Sql serviceTeacherSql = Sqls.create("""
|
||||
SELECT
|
||||
COUNT(DISTINCT ( pai.appointmentUser ))
|
||||
FROM
|
||||
legal_aid_appointment_info pai
|
||||
WHERE
|
||||
pai.stateId = 2300
|
||||
""");
|
||||
serviceTeacherSql.setCallback(Sqls.callback.longValue());
|
||||
dao.execute(serviceTeacherSql);
|
||||
long serviceTeacherCount = (long) serviceTeacherSql.getResult();
|
||||
|
||||
Sql unionSql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.unionname AS unionName,
|
||||
gh.unioncode AS unionCode,
|
||||
count( pai.appointmentUser ) AS userNum
|
||||
FROM
|
||||
sys_union gh
|
||||
LEFT JOIN `user` u ON u.unionid = gh.id
|
||||
LEFT JOIN legal_aid_appointment_info pai ON pai.appointmentUser = u.id
|
||||
AND pai.stateId = 2300
|
||||
$condition
|
||||
""");
|
||||
|
||||
unionSql.setCondition(Cnd.NEW().andEX("YEAR(pai.startTime)", "=", year)
|
||||
.groupBy("gh.id").asc("gh.unioncode"));
|
||||
|
||||
List unionList = baseService.listMap(unionSql);
|
||||
|
||||
Sql doctorSql = Sqls.create("""
|
||||
SELECT
|
||||
u.username AS doctorUserName,
|
||||
pd.sex,
|
||||
pd.jobTitle,
|
||||
count( pai.doctorUser ) AS serviceNum
|
||||
FROM
|
||||
legal_aid_doctor pd
|
||||
LEFT JOIN sys_user u ON u.id = pd.userid
|
||||
LEFT JOIN legal_aid_appointment_info pai ON pai.doctorUser = pd.userid\s
|
||||
AND pai.stateId = 2300
|
||||
$condition
|
||||
""");
|
||||
doctorSql.setCondition(Cnd.NEW().andEX("YEAR(pai.startTime)", "=", year)
|
||||
.groupBy("pd.userid").desc("serviceNum"));
|
||||
List doctorList = baseService.listMap(doctorSql);
|
||||
|
||||
return Map.of(
|
||||
"numberSessionMap", numberSessionMap,
|
||||
"unionList", unionList,
|
||||
"doctorList", doctorList,
|
||||
"serviceTeacherCount", serviceTeacherCount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package io.v.nutz.legalAid.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* 法律援助预约
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
public class LegalAidAppointmentInfo {
|
||||
|
||||
@Name
|
||||
@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 appointmentUser;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("预约人备注")
|
||||
private String appointmentUserNote;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("咨询师")
|
||||
private String doctorUser;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "SMALLINT")
|
||||
@Comment("预约状态")
|
||||
private Integer stateId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package io.v.nutz.legalAid.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@Data
|
||||
@Table
|
||||
public class LegalAidDoctor {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户id")
|
||||
private String userid;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1)
|
||||
@Comment("性别")
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("职称")
|
||||
private String jobTitle;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("单位")
|
||||
private String unitName;
|
||||
|
||||
@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;
|
||||
|
||||
@Column
|
||||
@Comment("电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 11)
|
||||
private String mobile;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.v.nutz.legalAid.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* 线上法律援助咨询帖子
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
public class LegalAidOnlinePosts {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("发帖人")
|
||||
private String poster;
|
||||
|
||||
@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,38 @@
|
||||
package io.v.nutz.legalAid.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* 线上法律援助帖子回复
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
public class LegalAidOnlinePostsReply {
|
||||
|
||||
@Name
|
||||
@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 replyUser;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@Comment("答复时间")
|
||||
private String replyTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
@Comment("答复内容")
|
||||
private String replyContent;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user