init
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package io.v.nutz.zhgh.mobile;
|
||||
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/mobile/sm")
|
||||
public class MobileSmController {
|
||||
@Inject
|
||||
private ViService baseService;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/sm.html")
|
||||
@RequiresAuthentication
|
||||
public void index(HttpSession session) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findSmxx(String userId) {
|
||||
NutMap map = baseService.fetch(Sqls.create("select id,username,loginname,unitname,unionname from `user` where id='%s'".formatted(userId)));
|
||||
|
||||
|
||||
return Map.of("user", map);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getMeetingUser(@Param(value = "meetingId", required = false) String meetingId,
|
||||
@Param(value = "meetingTimePeriodId", required = false) String meetingTimePeriodId,
|
||||
String userId) {
|
||||
return baseService.dao().fetch(MeetingTimePeriodUser.class,
|
||||
Cnd.where("meetingId", "=", meetingId).and("meetingTimePeriodId", "=", meetingTimePeriodId)
|
||||
.and("userId", "=", userId));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAudit(@Param(value = "meetingId", required = false) String meetingId,
|
||||
@Param(value = "meetingTimePeriodId", required = false) String meetingTimePeriodId, String userId, Boolean flag) {
|
||||
MeetingTimePeriodUser timePeriodUser = new MeetingTimePeriodUser();
|
||||
timePeriodUser.setUserId(userId);
|
||||
timePeriodUser.setMeetingId(meetingId);
|
||||
timePeriodUser.setMeetingTimePeriodId(meetingTimePeriodId);
|
||||
timePeriodUser.setIsJoin(true);
|
||||
baseService.insert(timePeriodUser);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package io.v.nutz.zhgh.mobile.activity.Sports;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.activity.models.*;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2022/1/6 9:22
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/activity/Sports/list")
|
||||
@Ok("json:full")
|
||||
public class mobileActivityListController {
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("/activityList")
|
||||
@Ok("beetl:/mobile/activity/Sports/activityList.html")
|
||||
@RequiresAuthentication
|
||||
public void activityList() {
|
||||
}
|
||||
|
||||
@At("/activityEventList")
|
||||
@Ok("beetl:/mobile/activity/Sports/activityEventList.html")
|
||||
@RequiresAuthentication
|
||||
public void activityEventList() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object doActivity(@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "teamId", required = false) String teamId,
|
||||
@Param(value = "teamName", required = false) String teamName) {
|
||||
|
||||
User user = baseService.dao().fetch(User.class, Cnd.where("id", "=", ShiroUtil.getUserId()));
|
||||
int i = cn.hutool.core.date.DateUtil.ageOfNow(user.getBirthday());
|
||||
ActivitySchool activitySchool = baseService.dao().fetch(ActivitySchool.class, activityId);
|
||||
ActivityBasicUnit basicUnit = baseService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", user.getUnitid()));
|
||||
ActivityBasicUnion basicUnion = baseService.dao().fetch(ActivityBasicUnion.class, basicUnit.getUnionid());
|
||||
ActivityEvent event = baseService.dao().fetch(ActivityEvent.class, Cnd.where("id", "=", eventId));
|
||||
ActivitySchoolApply schoolApply = new ActivitySchoolApply();
|
||||
schoolApply.setActivityId(activityId);
|
||||
schoolApply.setEventId(eventId);
|
||||
schoolApply.setAwardsMode(event.getProjectType());
|
||||
schoolApply.setApplyDate(DateUtil.getDate());
|
||||
schoolApply.setIdentity(Lang.list("1"));
|
||||
schoolApply.setDivisionLevelLeadership(false);
|
||||
schoolApply.setStatus(2);
|
||||
schoolApply.setTeamId(teamId);
|
||||
schoolApply.setTeam(teamName);
|
||||
schoolApply.setApplyUser(user.getId());
|
||||
schoolApply.setUserId(user.getId());
|
||||
schoolApply.setMobile(user.getMobile());
|
||||
schoolApply.setSex(user.getSex());
|
||||
schoolApply.setUnitId(user.getUnitid());
|
||||
schoolApply.setUnionId(user.getUnionid());
|
||||
schoolApply.setActivityUnionId(basicUnion.getId());
|
||||
schoolApply.setActivityUnionName(basicUnion.getUnionname());
|
||||
schoolApply.setUnitname(user.getUnitname());
|
||||
schoolApply.setLoginname(user.getLoginname());
|
||||
schoolApply.setUsername(user.getUsername());
|
||||
schoolApply.setBirthday(user.getBirthday());
|
||||
baseService.insert(schoolApply);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该小队的报名人
|
||||
*
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getTeamUserData(@Param(value = "teamId", required = false) String teamId,
|
||||
@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "applyType", required = false) Integer applyType) {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
ActivityBasicUnit basicUnit = baseService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", user.getUnitid()));
|
||||
ActivityBasicUnion basicUnion = baseService.dao().fetch(ActivityBasicUnion.class, basicUnit.getUnionid());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT * FROM activity_school_apply $condition
|
||||
""");
|
||||
cnd.andEX("teamId", "=", teamId);
|
||||
cnd.andEX("activityId", "=", activityId);
|
||||
cnd.andEX("eventId", "=", eventId);
|
||||
if (applyType != null && applyType != 3) {
|
||||
cnd.andEX("activityUnionId", "=", basicUnion.getId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getScopeUser(String activityGroupId) {
|
||||
return baseService.dao().count(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
package io.v.nutz.zhgh.mobile.activity.site;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.zhgh.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.zhgh.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.zhgh.activity.services.ActivityCommonService;
|
||||
import io.v.nutz.zhgh.activity.services.SiteInfoService;
|
||||
import io.v.nutz.zhgh.activity.services.SiteReserveService;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.enums.AuditTypeEnum;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/5/13
|
||||
* @Description
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/mobile/activity/site/audit")
|
||||
public class SiteAuditMobileController {
|
||||
|
||||
@Inject
|
||||
private SiteInfoService siteInfoService;
|
||||
|
||||
@Inject
|
||||
private SiteReserveService siteReserveService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private ActivityCommonService activityCommonService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:mobile/activity/site/audit.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/pageData")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "typeId", required = false) String typeId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.meetingTypeName,
|
||||
type.moduleName,
|
||||
(select unitname from `user` where username = info.contact_person) as unitname,
|
||||
(select count(DISTINCT sqid) from activity_site_reserve where site_id=info.id and JSON_CONTAINS(auditList, JSON_OBJECT('auditUser', @userid))) as audit
|
||||
FROM
|
||||
activity_site_info info
|
||||
LEFT JOIN activity_type type ON type.id = info.typeId
|
||||
LEFT JOIN audit_state state ON state.module = type.moduleName
|
||||
$condition
|
||||
""").setParam("userid", ShiroUtil.getPrincipalProperty("id"));
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
cnd.andEX("state.stateId", "in", activityCommonService.findStateIdForMeCanAudit());
|
||||
cnd.and("info.state", "=", true);
|
||||
if (StringUtils.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("info.name", pageForm.getSearchKeyword());
|
||||
seg.orLike("info.address", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId)) {
|
||||
cnd.andEX("info.typeId", "=", typeId);
|
||||
}
|
||||
cnd.groupBy("info.id");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = siteInfoService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
List<Object> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
Record map = (Record) item;
|
||||
List<NutMap> canAuditUserByLoginUser = this.getCanAuditUserByLoginUser(map.getString("id"), map.getString("moduleName"));
|
||||
map.put("no_audit", canAuditUserByLoginUser.size());
|
||||
});
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At("/getLeaveUser")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object getLeaveUser(@Param(value = "siteId", required = false) String siteId,
|
||||
@Param(value = "moduleName", required = false) String moduleName,
|
||||
@Param(value = "auditType", required = false)String auditType) {
|
||||
|
||||
List<NutMap> list = "canAudit".equals(auditType) ? this.getCanAuditUserByLoginUser(siteId, moduleName) : this.getHasAuditUserByLoginUser(siteId);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/*根据当前登录用户获取可以审核的用户*/
|
||||
public List<NutMap> getCanAuditUserByLoginUser(String siteId, String moduleName) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ar.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
state.stateName,
|
||||
count(sqid) days,
|
||||
GROUP_CONCAT(reserve_day order by reserve_day asc) concat_day
|
||||
FROM
|
||||
activity_site_reserve ar
|
||||
LEFT JOIN activity_site_info asi ON asi.id = ar.site_id
|
||||
left join `user` u on ar.reserve_person_id=u.id
|
||||
LEFT JOIN audit_state state on state.stateId = ar.reserve_state
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("ar.site_id", "=", siteId);
|
||||
cnd.and("u.username", "is not", null);
|
||||
cnd.and("u.username", "!=", "");
|
||||
cnd.and("ar.reserve_state", "in", Sqls.createf("SELECT stateId FROM audit_state_user WHERE userid = '%s'", ShiroUtil.getPrincipalProperty("id")));
|
||||
cnd.and("state.stateAuditType", "in", Lang.list(AuditTypeEnum.AUDIT.getValue()));
|
||||
|
||||
/*if(!ShiroUtil.hasAnyRoles(new String[]{"xghng","A06","sysadmin"})) {
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"gh10"})) {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
cnd.and("u.unitid", "=", user.getUnitid());
|
||||
}
|
||||
}*/
|
||||
|
||||
if (!io.v.nutz.web.commons.utils.ShiroUtil.hasAnyRoles(new String[]{"sysadmin"})) {
|
||||
cnd.and(new Static("if(asi.typeId=1, u.unitid = '" + Vi.getUnit().getId() + "', 1=1)"));
|
||||
}
|
||||
|
||||
cnd.groupBy("sqid");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
/*根据当前登录用户获取已经审核的用户*/
|
||||
public List<NutMap> getHasAuditUserByLoginUser(String siteId) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
ar.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.sex,
|
||||
state.stateName,
|
||||
count(sqid) days,
|
||||
GROUP_CONCAT(reserve_day order by reserve_day asc) concat_day
|
||||
from
|
||||
activity_site_reserve ar
|
||||
left join
|
||||
`user` u on ar.reserve_person_id=u.id
|
||||
LEFT JOIN
|
||||
audit_state state on state.stateId = ar.reserve_state
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("site_id", "=", siteId);
|
||||
cnd.and(new Static("JSON_CONTAINS(auditList, JSON_OBJECT('auditUser', '" + ShiroUtil.getPrincipalProperty("id") + "'))"));
|
||||
|
||||
cnd.groupBy("sqid");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
list.forEach(item -> {
|
||||
List<NutMap> listMap = Json.fromJsonAsList(NutMap.class, item.getString("auditList"));
|
||||
Boolean auditState = false;
|
||||
for (NutMap map : listMap) {
|
||||
if (map.getString("auditUser").equals(ShiroUtil.getPrincipalProperty("id"))) {
|
||||
auditState = map.get("auditState") == null ? null : map.getBoolean("auditState");
|
||||
}
|
||||
}
|
||||
item.put("auditState", auditState);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@At("/audit")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object audit(@Param(value = "ids", required = false) String[] ids, Audit audit,
|
||||
@Param(value = "isPass", required = false) boolean isPass) {
|
||||
dao.insert(audit);
|
||||
for (String id : ids) {
|
||||
|
||||
ActivitySiteReserve fetch = siteReserveService.fetch(id);
|
||||
|
||||
Integer stateCode = fetch.getReserve_state();
|
||||
Integer afterStateCode = activityCommonService.findAfterStateCode(stateCode, isPass);
|
||||
|
||||
List<ActivitySiteReserve> reserves = siteReserveService.query(Cnd.NEW().and("sqid", "=", fetch.getSqid()));
|
||||
String days = "";
|
||||
|
||||
for (ActivitySiteReserve siteReserve : reserves) {
|
||||
siteReserve.setReserve_state(afterStateCode);
|
||||
|
||||
List<NutMap> auditIdList = siteReserve.getAuditList();
|
||||
if (Lang.isEmpty(auditIdList)) {
|
||||
auditIdList = new ArrayList<>();
|
||||
}
|
||||
auditIdList.add(NutMap.NEW().addv("stateCode", stateCode)
|
||||
.addv("auditId", audit.getId())
|
||||
.addv("auditUser", ShiroUtil.getPrincipalProperty("id"))
|
||||
.addv("auditState", isPass)
|
||||
.addv("auditOption", audit.getAuditOpinion()));
|
||||
siteReserve.setAuditList(auditIdList);
|
||||
|
||||
days += siteReserve.getReserve_day() + ",";
|
||||
dao.update(siteReserve);
|
||||
}
|
||||
days = days.substring(0, days.length() - 1);
|
||||
|
||||
Integer successCode = activityCommonService.findSuccessStateCode(fetch.getSite_id());
|
||||
ActivitySiteInfo siteInfo = siteInfoService.fetch(fetch.getSite_id());
|
||||
if (afterStateCode.equals(successCode) && siteInfo.getTypeId() == 1) {
|
||||
String content = "%s老师您好!您提交的%s使用申请已通过审批,在预约使用期间可刷校园卡进入母婴室,如有疑问,欢迎咨询校工会。"
|
||||
.formatted(fetch.getReserve_person(), siteInfo.getName());
|
||||
Sys_user user = sysUserService.fetch(fetch.getReserve_person_id());
|
||||
|
||||
ArrayList<Map> list2 = new ArrayList<>();
|
||||
list2.add(Map.of("type", "User", "userId", user.getLoginname(), "name", user.getUsername()));
|
||||
// msgApi.sendMsg(content, list2, "场地预约", "WeChat", MsgApi.sendMode.normal.name());
|
||||
} else if (!afterStateCode.equals(successCode)) {
|
||||
//发送微信提醒审核人
|
||||
//查询状态码对应的审核人
|
||||
Sql sql = Sqls.create("""
|
||||
select userId,u.loginname,u.username,u.unitname from audit_state_user asu
|
||||
left join `user` u on u.id = asu.userId left join audit_state s on s.stateId=asu.stateId $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("asu.stateId", "=", afterStateCode);
|
||||
cnd.and("s.stateAuditType", "=", "0");
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(fetch.getSite_id());
|
||||
if ("infantRoom".equals(moduleName)) {
|
||||
//获取当前登录人的单位id
|
||||
String unitId = io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("unitid").toString();
|
||||
cnd.and("u.unitid", "=", unitId);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<Record> list = siteReserveService.list(sql);
|
||||
|
||||
for (Record item : list) {
|
||||
String content = "%s老师您好!%s老师预约%s日使用%s,请您通过门户网站或点击详情登录智慧工会平台进行审核。"
|
||||
.formatted(item.getString("username"),
|
||||
fetch.getReserve_person(),
|
||||
days,
|
||||
siteInfo.getName());
|
||||
Sys_user sys_user = sysUserService.fetch(item.getString("userId"));
|
||||
NutMap map = new NutMap();
|
||||
map.setv("keyword1", NutMap.NEW().setv("value", "场地预约"));
|
||||
map.setv("keyword2", NutMap.NEW().setv("value", item.getString("username")
|
||||
+ "(" + item.getString("loginname") + ")"));
|
||||
map.setv("keyword3", NutMap.NEW().setv("value", item.getString("unitname")));
|
||||
map.setv("keyword4", NutMap.NEW().setv("value", content));
|
||||
map.setv("keyword5", NutMap.NEW().setv("value", DateUtil.now()));
|
||||
// msgApi.sendMsg(sys_user.getWeAppOpenid(), msgApi.DSH_TEMPLATE_ID, Globals.AppDomain + "/mobile/activity/site/audit", map);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<NutMap> listMap(Sql sql) {
|
||||
sql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(sql);
|
||||
return sql.getList(NutMap.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
package io.v.nutz.zhgh.mobile.activity.site;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.zhgh.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.zhgh.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.zhgh.activity.services.ActivityCommonService;
|
||||
import io.v.nutz.zhgh.activity.services.SiteInfoService;
|
||||
import io.v.nutz.zhgh.activity.services.SiteReserveService;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.random.R;
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/5/13
|
||||
* @Description
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/mobile/activity/site/info")
|
||||
public class SiteInfoMobileController {
|
||||
|
||||
@Inject
|
||||
private SiteInfoService siteInfoService;
|
||||
|
||||
@Inject
|
||||
private SiteReserveService siteReserveService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private ActivityCommonService activityCommonService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:mobile/activity/site/info.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/reserve")
|
||||
@Ok("beetl:mobile/activity/site/reserve.html")
|
||||
public void reserve() {
|
||||
}
|
||||
|
||||
@At("/my")
|
||||
@Ok("beetl:mobile/activity/site/my.html")
|
||||
public void my() {
|
||||
}
|
||||
|
||||
@At("/pageData")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "typeId", required = false) String typeId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.meetingTypeName,
|
||||
type.moduleName,
|
||||
(select unitname from `user` where username = info.contact_person) as unitname,
|
||||
( SELECT count( 1 ) FROM activity_site_reserve WHERE site_id = info.id AND reserve_state = (select stateId from audit_state where module = (select moduleName from activity_type where id = info.typeId) and stateAuditType = 3)) count
|
||||
FROM
|
||||
activity_site_info info
|
||||
LEFT JOIN activity_type type ON type.id = info.typeId
|
||||
LEFT JOIN audit_state state ON state.module = type.moduleName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and("info.state", "=", true);
|
||||
if (StringUtils.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("info.name", pageForm.getSearchKeyword());
|
||||
seg.orLike("info.address", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId)) {
|
||||
cnd.andEX("info.typeId", "=", typeId);
|
||||
}
|
||||
cnd.groupBy("info.id");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = siteInfoService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<Object> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
Record map = (Record) item;
|
||||
String openHours = map.getString("open_hours");
|
||||
List<NutMap> nutMaps = Json.fromJsonAsList(NutMap.class, openHours);
|
||||
String start_time = nutMaps.get(0).getString("start_time");
|
||||
String end_time = nutMaps.get(nutMaps.size() - 1).getString("end_time");
|
||||
map.put("open_time", start_time + " - " + end_time);
|
||||
});
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At("/myReserve")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object myReserve(PageForm pageForm,
|
||||
@Param(value = "timeSwitch",required = false) Boolean timeSwitch,
|
||||
@Param(value = "time",required = false) String time,
|
||||
@Param(value = "typeId",required = false) String typeId) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
ar.*,
|
||||
`as`.stateName ,
|
||||
info.name,
|
||||
info.address,
|
||||
`as`.stateAuditType,
|
||||
count(sqid) days,
|
||||
GROUP_CONCAT(reserve_day order by reserve_day asc) concat_day
|
||||
from
|
||||
activity_site_reserve ar
|
||||
left join activity_site_info info on info.id = ar.site_id
|
||||
left join audit_state `as` on ar.reserve_state=`as`.stateId
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StringUtils.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("info.name", pageForm.getSearchKeyword());
|
||||
seg.orLike("info.address", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId)) {
|
||||
cnd.andEX("info.typeId", "=", typeId);
|
||||
}
|
||||
if (!timeSwitch && StrUtil.isNotBlank(time)) {
|
||||
cnd.and("left(ar.reserve_day, 7)", "=", time);
|
||||
}
|
||||
cnd.and("reserve_person_id", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
|
||||
cnd.groupBy("sqid");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return siteInfoService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At("/getDetail")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object getDetail(String id) {
|
||||
return siteInfoService.fetch(id);
|
||||
}
|
||||
|
||||
@At("/rollback")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object rollback(String id) {
|
||||
//根据活动id查询第一个审核节点
|
||||
ActivitySiteReserve fetch = siteReserveService.fetch(id);
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(fetch.getSite_id());
|
||||
Integer stateCode = activityCommonService.findStartStateCodeByModuleName(moduleName);
|
||||
|
||||
if (fetch.getReserve_state() > stateCode) {
|
||||
return Result.error("当前状态不能进行撤销操作");
|
||||
}
|
||||
ActivitySiteReserve siteReserve = siteReserveService.fetch(id);
|
||||
siteReserveService.clear(Cnd.NEW().and("sqid", "=", siteReserve.getSqid()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/backOption")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object backOption(String id, String option) {
|
||||
ActivitySiteReserve fetch = siteReserveService.fetch(id);
|
||||
siteReserveService.update(Chain.make("back_option", option), Cnd.NEW().and("sqid", "=", fetch.getSqid()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/getReserve")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object getReserve(String siteId, String day) {
|
||||
|
||||
//获取场地的开放时间
|
||||
ActivitySiteInfo fetch = siteInfoService.fetch(siteId);
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(siteId);
|
||||
List<NutMap> hours = fetch.getOpen_hours();
|
||||
Integer limitNum = fetch.getLimitNum();
|
||||
|
||||
hours.forEach(item -> {
|
||||
String startTime = item.getString("start_time");
|
||||
String endTime = item.getString("end_time");
|
||||
item.put("code", 1);
|
||||
item.put("msg", "可预约");
|
||||
item.put("backColor", "#e8ffef");
|
||||
item.put("color", "#52986a");
|
||||
item.put("limitNum", limitNum);
|
||||
//如果这个时间段过了,显示已过期
|
||||
String time = day + " " + startTime;
|
||||
int compare = DateUtil.compare(new Date(), DateUtil.parse(time), "yyyy-MM-dd HH:mm");
|
||||
if(compare > 0) {
|
||||
item.put("code", -1);
|
||||
item.put("msg", "已过期");
|
||||
item.put("backColor", "");
|
||||
item.put("color", "");
|
||||
}
|
||||
|
||||
List<ActivitySiteReserve> list = siteReserveService.query(Cnd.NEW()
|
||||
.and("reserve_day", "=", day)
|
||||
.and("start_time", "=", startTime)
|
||||
.and("end_time", "=", endTime)
|
||||
.and("site_id", "=", siteId)
|
||||
.and(new Static(" reserve_state in (select stateId from audit_state where stateAuditType != 1 and module = '%s')".formatted(moduleName))));
|
||||
|
||||
//如果这个时间段被单位预约了,直接显示约满
|
||||
ActivitySiteReserve reserve1 = list.stream().filter(o -> o.getReserve_type() == 2).findAny().orElse(null);
|
||||
if(reserve1 != null) {
|
||||
item.put("code", -2);
|
||||
item.put("msg", "已约满");
|
||||
item.put("backColor", "");
|
||||
item.put("color", "");
|
||||
}
|
||||
//如果这个时间段预约的人数满了,显示约满
|
||||
if(list.size() >= limitNum) {
|
||||
item.put("code", -1);
|
||||
item.put("msg", "已约满");
|
||||
item.put("backColor", "");
|
||||
item.put("color", "");
|
||||
}
|
||||
//如果预约过了,显示已预约
|
||||
ActivitySiteReserve reserve = list.stream().filter(o -> o.getReserve_person_id().equals(ShiroUtil.getPrincipalProperty("id"))).findAny().orElse(null);
|
||||
if(reserve != null && reserve.getReserve_type() != 2) {
|
||||
item.put("code", -1);
|
||||
item.put("msg", "已预约");
|
||||
item.put("backColor", "#0e78c5");
|
||||
item.put("color", "#fff3f3");
|
||||
}
|
||||
item.put("reserveNum", list.size());
|
||||
});
|
||||
|
||||
return hours;
|
||||
}
|
||||
|
||||
@At("/reserveDo")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object reserveDo(String siteId, String times, String message, Integer reserve_type) {
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(siteId);
|
||||
Integer stateCode = activityCommonService.findStartStateCodeByModuleName(moduleName);
|
||||
|
||||
if (stateCode == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
List<ActivitySiteReserve> li = new ArrayList<>();
|
||||
|
||||
List<NutMap> nutMaps = Json.fromJsonAsList(NutMap.class, times);
|
||||
|
||||
//主要来查询个人预约时的人数上限
|
||||
ActivitySiteInfo siteInfo = siteInfoService.dao().fetch(ActivitySiteInfo.class, siteId);
|
||||
Integer limitNum = siteInfo.getLimitNum();
|
||||
|
||||
for (NutMap item : nutMaps) {
|
||||
String time = item.getString("day") + " " + item.getString("start_time");
|
||||
int compare = DateUtil.compare(new Date(), DateUtil.parse(time), "yyyy-MM-dd HH:mm");
|
||||
if(compare > 0) {
|
||||
return Result.error("您预约的【%s】时间已过".formatted(time));
|
||||
}
|
||||
if(reserve_type == 1 && !item.getString("day").equals(DateUtil.format(DateUtil.offsetDay(new Date(), 1), "yyyy-MM-dd"))) {
|
||||
return Result.error("个人预约只支持预约明天的时间");
|
||||
}
|
||||
|
||||
List<ActivitySiteReserve> list = siteReserveService.query(Cnd.NEW()
|
||||
.and("reserve_day", "=", item.getString("day"))
|
||||
.and("start_time", "=", item.getString("start_time"))
|
||||
.and("end_time", "=", item.getString("end_time"))
|
||||
.and("site_id", "=", siteId)
|
||||
.and(new Static(" reserve_state in (select stateId from audit_state where stateAuditType != 1 and module = '%s')".formatted(moduleName))));
|
||||
ActivitySiteReserve reserve = list.stream().filter(o -> o.getReserve_person_id().equals(ShiroUtil.getPrincipalProperty("id"))).findAny().orElse(null);
|
||||
if (reserve != null) {
|
||||
return Result.error("您已预约该时间段!");
|
||||
}
|
||||
if(reserve_type == 1) {
|
||||
if((list.size() + 1) > limitNum) {
|
||||
return Result.error("【%s】时间段预约人数已满!".formatted(time));
|
||||
}
|
||||
} else {
|
||||
if(list.size() > 0) {
|
||||
return Result.error("【%s】时间段已有预约!".formatted(time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String str = "";
|
||||
String r = R.UU32();
|
||||
for (NutMap item : nutMaps) {
|
||||
ActivitySiteReserve as = new ActivitySiteReserve();
|
||||
as.setSqid(r);
|
||||
as.setSite_id(siteId);
|
||||
as.setReserve_person(user.getUsername());
|
||||
as.setReserve_person_id(user.getId());
|
||||
as.setReserve_person_unit(user.getUnit() == null ? null : user.getUnit().getName());
|
||||
as.setReserve_person_phone(user.getMobile());
|
||||
as.setReserve_cause(message);
|
||||
as.setReserve_state(stateCode);
|
||||
as.setReserve_day(item.getString("day"));
|
||||
as.setStart_time(item.getString("start_time"));
|
||||
as.setEnd_time(item.getString("end_time"));
|
||||
as.setReserve_type(reserve_type);
|
||||
str += item.getString("day") + ",";
|
||||
li.add(as);
|
||||
}
|
||||
str = str.substring(0, str.length() - 1);
|
||||
|
||||
siteReserveService.insert(li);
|
||||
|
||||
//发送微信提醒审核人
|
||||
//查询状态码对应的审核人
|
||||
Sql sql = Sqls.create("""
|
||||
select userId,u.loginname,u.username,u.unitname from audit_state_user asu
|
||||
left join `user` u on u.id = asu.userId left join audit_state s on s.stateId=asu.stateId $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("asu.stateId", "=", stateCode);
|
||||
cnd.and("s.stateAuditType", "=", "0");
|
||||
if ("infantRoom".equals(moduleName)) {
|
||||
//获取当前登录人的单位id
|
||||
String unitId = ShiroUtil.getPrincipalProperty("unitid").toString();
|
||||
cnd.and("u.unitid", "=", unitId);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<Record> list = siteReserveService.list(sql);
|
||||
|
||||
for (Record item : list) {
|
||||
String content = "%s老师您好!%s老师预约%s日使用%s,请您通过门户网站或点击详情登录智慧工会平台进行审核。"
|
||||
.formatted(item.getString("username"),
|
||||
user.getUsername(),
|
||||
str,
|
||||
siteInfoService.fetch(siteId).getName());
|
||||
|
||||
Sys_user sys_user = sysUserService.fetch(item.getString("userId"));
|
||||
NutMap map = new NutMap();
|
||||
map.setv("keyword1", NutMap.NEW().setv("value", "场地预约"));
|
||||
map.setv("keyword2", NutMap.NEW().setv("value", item.getString("username")
|
||||
+ "(" + item.getString("loginname") + ")"));
|
||||
map.setv("keyword3", NutMap.NEW().setv("value", item.getString("unitname")));
|
||||
map.setv("keyword4", NutMap.NEW().setv("value", content));
|
||||
map.setv("keyword5", NutMap.NEW().setv("value", DateUtil.now()));
|
||||
// msgApi.sendMsg(sys_user.getWeAppOpenid(), msgApi.DSH_TEMPLATE_ID, Globals.AppDomain + "/mobile/activity/site/audit", map);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
package io.v.nutz.zhgh.mobile.activity.unionActivity;
|
||||
|
||||
import io.v.nutz.zhgh.activity.models.ActivityTissue;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 我的活动
|
||||
* @createTime 2022年01月08日 18:52:00
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/activity/myActivity")
|
||||
@Ok("json:full")
|
||||
public class UnionActivityMineController {
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/activity/unionActivity/myActivity.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/goSign")
|
||||
@Ok("beetl:/mobile/activity/unionActivity/sign.html")
|
||||
public void goSign() {
|
||||
}
|
||||
|
||||
@At("/goMyProject")
|
||||
@Ok("beetl:/mobile/activity/Sports/myProject.html")
|
||||
public void goMyProject() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的活动
|
||||
*
|
||||
* @param pageForm
|
||||
* @param year
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, Integer year) {
|
||||
String sqlStr = """
|
||||
SELECT
|
||||
act.id,
|
||||
act.`name`,
|
||||
act.activityCode,
|
||||
act.applyStartTime,
|
||||
act.applyEndTime,
|
||||
act.startTime,
|
||||
act.endTime,
|
||||
act.address,
|
||||
act.activityContent,
|
||||
act.signUpMethod,
|
||||
act.userNumberLimit,
|
||||
act.totalUserNumberLimit,
|
||||
act.unionUserNumberLimit,
|
||||
act.cover,
|
||||
act.location,
|
||||
act.rangeMeter,
|
||||
act.needSign,
|
||||
act.projectTypeCode,
|
||||
abs.`name` AS projectTypeName,
|
||||
creater.username AS createUserName,
|
||||
creater.mobile as createUserMobile
|
||||
FROM
|
||||
activity_tissue act
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=act.projectTypeCode
|
||||
LEFT JOIN sys_user creater ON creater.id = act.userId
|
||||
WHERE
|
||||
|
||||
(
|
||||
act.id IN (SELECT tissueId FROM activity_tissue_person where userId = @userId AND tissueId IS NOT NULL)
|
||||
OR
|
||||
act.id IN (SELECT activityId FROM activity_school_apply where userId = @userId AND activityId IS NOT NULL)
|
||||
)
|
||||
""";
|
||||
Sql sql = Sqls.create(sqlStr).setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
return simpleService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询体育活动我报名的项目信息
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getSchoolActivityProjectInfoByMine(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
acte.allName
|
||||
FROM
|
||||
`activity_school_apply` actsa
|
||||
LEFT JOIN activity_event acte on acte.id = actsa.eventId
|
||||
WHERE
|
||||
actsa.activityId = @activityId AND userId = @userId
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
sql.setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
return simpleService.fetch(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询活动报名人员
|
||||
*
|
||||
* @param activityId 活动id
|
||||
* @return list
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object selectRegisterList(String activityId) {
|
||||
ActivityTissue activityTissue = simpleService.dao().fetch(ActivityTissue.class, activityId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
atp.userId AS id,
|
||||
atp.userName,
|
||||
us.unionid,
|
||||
atp.applyUserId
|
||||
FROM
|
||||
activity_tissue_person atp
|
||||
LEFT JOIN `user` us ON us.id = atp.userId
|
||||
$condition
|
||||
""");
|
||||
cnd.and("atp.tissueId","=",activityId);
|
||||
if (activityTissue.getSignUpMethod()!=3){
|
||||
cnd.and("us.unionid","=",Vi.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = simpleService.listMap(sql);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
+599
@@ -0,0 +1,599 @@
|
||||
package io.v.nutz.zhgh.mobile.activity.unionActivity;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityTissue;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityTissuePerson;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.FieldFilter;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
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 org.nutz.trans.Trans;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO 校工会活动报名
|
||||
* @createTime 2022年01月06日 17:34:00
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/activity/unionActivity")
|
||||
@Ok("json:full")
|
||||
public class UnionActivityRegisterController {
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@At("")
|
||||
@RequiresAuthentication
|
||||
@Ok("beetl:/mobile/activity/unionActivity/register.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("re")
|
||||
@RequiresAuthentication
|
||||
public String goReg(String signUpMethod) {
|
||||
if (signUpMethod.equals("1")) {
|
||||
return "beetl:/mobile/activity/unionActivity/singleReg.html";
|
||||
}
|
||||
return "beetl:/mobile/activity/unionActivity/unionReg.html";
|
||||
}
|
||||
|
||||
|
||||
private static final String sqlStr = """
|
||||
SELECT
|
||||
act.id,
|
||||
act.`name`,
|
||||
act.activityCode,
|
||||
act.applyStartTime,
|
||||
act.applyEndTime,
|
||||
act.startTime,
|
||||
act.endTime,
|
||||
act.address,
|
||||
act.activityContent,
|
||||
act.signUpMethod,
|
||||
act.userNumberLimit,
|
||||
act.totalUserNumberLimit,
|
||||
act.unionUserNumberLimit,
|
||||
act.cover,
|
||||
act.location,
|
||||
act.rangeMeter,
|
||||
act.needSign,
|
||||
act.projectTypeCode,
|
||||
act.teamNum,
|
||||
abs.`name` AS projectTypeName,
|
||||
creater.username AS createUserName,
|
||||
creater.mobile as createUserMobile
|
||||
FROM
|
||||
activity_tissue act
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=act.projectTypeCode
|
||||
LEFT JOIN sys_user creater ON creater.id = act.userId
|
||||
$condition
|
||||
""";
|
||||
|
||||
/**
|
||||
* 获取某个分工会限制的数量
|
||||
*
|
||||
* @param unionUserNumberLimit
|
||||
* @param unionId
|
||||
* @return
|
||||
*/
|
||||
private int getLimitNumByUnion(List<NutMap> unionUserNumberLimit, String unionId) {
|
||||
Optional<NutMap> unionLimitOptional = unionUserNumberLimit.stream().filter(v -> v.getString("id").equals(unionId)).findFirst();
|
||||
return unionLimitOptional.map(map -> map.getInt("limitNum", 0)).orElse(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "activityStatus", required = false) int activityStatus,
|
||||
@Param(value = "activityLevel", required = false) String activityLevel) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
`name`,
|
||||
address,
|
||||
startTime,
|
||||
endTime,
|
||||
applyStartTime,
|
||||
applyEndTime,
|
||||
projectTypeCode,
|
||||
signUpMethod,
|
||||
cover
|
||||
FROM
|
||||
activity_tissue ti
|
||||
$condition
|
||||
UNION
|
||||
SELECT
|
||||
id,
|
||||
`name`,
|
||||
address,
|
||||
startTime,
|
||||
endTime,
|
||||
applyStartTime,
|
||||
applyEndTime,
|
||||
'50004' AS projectTypeCode,
|
||||
1 AS signUpMethod,
|
||||
JSON_UNQUOTE(json_extract(image, "$[0].filepath")) AS cover
|
||||
FROM
|
||||
activity_school
|
||||
$school
|
||||
$schoolTime
|
||||
$schoolLevel
|
||||
$orderBy
|
||||
""");
|
||||
Cnd allCnd = Cnd.NEW();
|
||||
allCnd.andEX("type", "=", activityLevel);
|
||||
allCnd.andEX("YEAR(startTime)", "=", year);
|
||||
allCnd.andEX("projectTypeCode", "!=", "50004");
|
||||
allCnd.andEX("signUpMethod", "is not", null);
|
||||
allCnd.andEX("state", "=", 3);
|
||||
allCnd.and(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId= ti.groupId AND userId='%s') >0".formatted(io.v.nutz.web.commons.utils.ShiroUtil.getUserId())));
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.list("sysadmin", "A06"))) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
allCnd.andEX("signUpMethod", "in", Lang.array(1, 2, 3));
|
||||
} else {
|
||||
allCnd.andEX("signUpMethod", "in", Lang.array(1, 3));
|
||||
}
|
||||
}
|
||||
sql.setVar("school", """
|
||||
WHERE
|
||||
YEAR ( startTime )= %s
|
||||
AND ( SELECT COUNT( 1 ) FROM activity_user_scope WHERE groupId = activityGroupId AND userId = '%s' ) > 0
|
||||
AND JSON_CONTAINS(applyWay -> '$[*]','1','$' )
|
||||
""".formatted(year, io.v.nutz.web.commons.utils.ShiroUtil.getUserId()));
|
||||
switch (activityStatus) {
|
||||
case 2 -> {
|
||||
allCnd.and(new Static("applyStartTime < now()"));
|
||||
allCnd.and(new Static("applyEndTime > now()"));
|
||||
sql.setVar("schoolTime", "AND applyStartTime < now() AND applyEndTime > now()");
|
||||
}
|
||||
case 3 -> {
|
||||
allCnd.and(new Static("startTime < now()"));
|
||||
allCnd.and(new Static("endTime > now()"));
|
||||
sql.setVar("schoolTime", "AND startTime < now() AND endTime > now()");
|
||||
|
||||
}
|
||||
case 4 -> {
|
||||
allCnd.and(new Static("endTime < now()"));
|
||||
sql.setVar("schoolTime", "AND endTime < now()");
|
||||
}
|
||||
|
||||
case 5 -> {
|
||||
allCnd.and(new Static("applyStartTime > now()"));
|
||||
sql.setVar("schoolTime", "AND applyStartTime > now()");
|
||||
}
|
||||
}
|
||||
allCnd.and("isDisabled", "=", 1);
|
||||
// allCnd.desc("endTime");
|
||||
if (Strings.isNotBlank(activityLevel)) {
|
||||
sql.setVar("schoolLevel", "AND activityLevel='%s'".formatted(activityLevel));
|
||||
}
|
||||
sql.setVar("orderBy", "ORDER BY startTime DESC");
|
||||
/*// SqlExpressionGroup unionExps = Cnd.exps("act.type", "=", 40001);
|
||||
SqlExpressionGroup unionExps = Cnd.exps("YEAR(act.startTime)", "=", year);
|
||||
// unionExps.and("YEAR(act.startTime)", "=", year);
|
||||
unionExps.and("act.projectTypeCode", "!=", "50004");
|
||||
unionExps.and("act.signUpMethod", "is not", null);
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.list("sysadmin", "A06"))) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
unionExps.and("act.signUpMethod", "in", Lang.array(1, 2));
|
||||
} else {
|
||||
unionExps.and("act.signUpMethod", "=", 1);
|
||||
}
|
||||
unionExps.or(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId=act.groupId AND userId='%s') >0".formatted(io.v.nutz.web.commons.utils.ShiroUtil.getUserId())));
|
||||
unionExps.or(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId=acs.activityGroupId AND userId='%s') >0".formatted(io.v.nutz.web.commons.utils.ShiroUtil.getUserId())));
|
||||
}
|
||||
|
||||
allCnd.and(unionExps);
|
||||
|
||||
// SqlExpressionGroup schoolExps = Cnd.exps("act.type", "=", 40001);
|
||||
SqlExpressionGroup schoolExps = Cnd.exps("YEAR(act.startTime)", "=", year);
|
||||
// schoolExps.and("YEAR(act.startTime)", "=", year);
|
||||
// schoolExps.and("act.projectTypeCode", "=", 50004);
|
||||
schoolExps.and(new Static("JSON_CONTAINS(acs.applyWay->'$[*]','1', '$')"));
|
||||
allCnd.and(schoolExps);
|
||||
|
||||
switch (activityStatus) {
|
||||
case 2 -> {
|
||||
unionExps.and(new Static("act.applyStartTime < now()"));
|
||||
unionExps.and(new Static("act.applyEndTime > now()"));
|
||||
schoolExps.and(new Static("act.applyStartTime < now()"));
|
||||
schoolExps.and(new Static("act.applyEndTime > now()"));
|
||||
}
|
||||
case 3 -> {
|
||||
unionExps.and(new Static("act.startTime < now()"));
|
||||
unionExps.and(new Static("act.endTime > now()"));
|
||||
schoolExps.and(new Static("act.startTime < now()"));
|
||||
schoolExps.and(new Static("act.endTime > now()"));
|
||||
}
|
||||
case 4 -> {
|
||||
unionExps.and(new Static("act.endTime < now()"));
|
||||
schoolExps.and(new Static("act.endTime < now()"));
|
||||
}
|
||||
}*/
|
||||
sql.setCondition(allCnd);
|
||||
return simpleService.list(pageForm, sql);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个活动信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object findOne(String id) {
|
||||
Sql sql = Sqls.create(sqlStr);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("act.id", "=", id);
|
||||
sql.setCondition(cnd);
|
||||
NutMap activityMap = simpleService.fetch(sql);
|
||||
if (Lang.isNotEmpty(activityMap.getInt("userNumberLimit")) && activityMap.getInt("userNumberLimit") == 2) {
|
||||
List<NutMap> unionUserNumberLimit = activityMap.getAs("unionUserNumberLimit", List.class);
|
||||
String unionId = Vi.getUnionId();
|
||||
Optional<NutMap> limitUnionOptional = unionUserNumberLimit.stream().filter(v -> v.getString("id").equals(unionId)).findFirst();
|
||||
limitUnionOptional.ifPresent(map -> activityMap.put("limitUnion", map));
|
||||
}
|
||||
return activityMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询活动报名人员
|
||||
*
|
||||
* @param activityId 活动id
|
||||
* @return list
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object selectRegisterList(String activityId) {
|
||||
List<NutMap> list = simpleService.listMap(Sqls.create("select atp.userId AS id,atp.userName,us.unionid from activity_tissue_person atp LEFT JOIN `user` us ON us.id=atp.userId where tissueId = @activityId and us.unionid=@unionid").setParam("activityId", activityId).setParam("unionid", Vi.getUnionId()));
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询没报名的人
|
||||
*
|
||||
* @param searchKey 查询关键字
|
||||
* @param activityId 活动id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object searchNoRegisterUser(String searchKey, String activityId) {
|
||||
|
||||
|
||||
ActivityTissue tissue = simpleService.dao().fetch(ActivityTissue.class, Cnd.where("id", "=", activityId));
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname AS loginName,
|
||||
username AS userName,
|
||||
sex,
|
||||
unitname AS unitName
|
||||
FROM
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
String unionId = Vi.getUnionId();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (tissue.getSignUpMethod() != 3) {
|
||||
cnd.andEX("unionId", "=", unionId);
|
||||
}
|
||||
cnd.and(Cnd.exps(Cnd.likeEX("username", searchKey.trim())).or(Cnd.likeEX("loginname", searchKey.trim())));
|
||||
if (tissue.getGroupId() != null) {
|
||||
cnd.and(new Static("""
|
||||
id IN ( SELECT userid FROM activity_user_scope WHERE groupId IN ( SELECT groupId FROM activity_tissue WHERE id = '%s' AND groupId IS NOT NULL ) )
|
||||
""".formatted(activityId)));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return simpleService.listPageMap(1, 10, sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分工会报名
|
||||
*
|
||||
* @param activityId
|
||||
* @param personIds
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public synchronized Object doSaveUnionRegister(String activityId, String[] personIds) {
|
||||
|
||||
String unionId = Vi.getUnionId();
|
||||
|
||||
ActivityTissue activityTissue = simpleService.dao().fetch(ActivityTissue.class, activityId);
|
||||
if (activityTissue.getSignUpMethod() == 2) {
|
||||
if (!ShiroUtil.hasRole("H04")) {
|
||||
// return Result.error().addMsg("请使用分工会管理员报名!");
|
||||
}
|
||||
}
|
||||
if (Lang.isNotEmpty(activityTissue.getUserNumberLimit())) {
|
||||
if (activityTissue.getUserNumberLimit() == 1) {
|
||||
int hasRegisterCount = simpleService.dao().count(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId));
|
||||
if (hasRegisterCount + personIds.length > activityTissue.getTotalUserNumberLimit()) {
|
||||
// return Result.error().addMsg("当前最多只能报名%s人!".formatted(Math.max(activityTissue.getTotalUserNumberLimit() - hasRegisterCount, 0)));
|
||||
return Result.error().addMsg("该活动限制人数为%s人".formatted(activityTissue.getTotalUserNumberLimit()));
|
||||
}
|
||||
}
|
||||
if (activityTissue.getUserNumberLimit() == 2) {
|
||||
int limitNumByUnion = getLimitNumByUnion(activityTissue.getUnionUserNumberLimit(), unionId);
|
||||
if (personIds.length > limitNumByUnion) {
|
||||
return Result.error().addMsg("分工会报名限额%s人!".formatted(limitNumByUnion));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FieldFilter fieldFilter = FieldFilter.create(User.class, "^id$");
|
||||
List<String> idList = Daos.ext(simpleService.dao(), fieldFilter).query(User.class, Cnd.where("unionid", "=", unionId))
|
||||
.stream().map(User::getId).collect(Collectors.toList());
|
||||
|
||||
|
||||
//删除本公会报名的人然后再加
|
||||
Trans.exec(() -> {
|
||||
if (activityTissue.getSignUpMethod() == 3) {
|
||||
simpleService.dao().clear(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId)
|
||||
.and("applyUserId", "=", ShiroUtil.getUserId()));
|
||||
} else {
|
||||
simpleService.dao().clear(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId)
|
||||
.and("userId", "in", idList));
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id AS userId,
|
||||
username AS userName,
|
||||
loginname AS loginName,
|
||||
sex,
|
||||
mobile,
|
||||
unitName,
|
||||
unionName,
|
||||
'$activityId' AS tissueId,
|
||||
'$applyUserId' AS applyUserId,
|
||||
'$applyUserUserName' AS applyUserUserName,
|
||||
'$applyDateTime' AS applyDateTime
|
||||
FROM
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
sql.setVar("activityId", activityId);
|
||||
sql.setVar("applyUserId", ShiroUtil.getUserId());
|
||||
sql.setVar("applyDateTime", cn.hutool.core.date.DateUtil.now());
|
||||
sql.setVar("applyUserUserName", ShiroUtil.getPrincipalProperty("username").toString());
|
||||
sql.setCondition(Cnd.where("id", "in", personIds));
|
||||
List<ActivityTissuePerson> fullPersonList = simpleService.listEntity(sql, ActivityTissuePerson.class);
|
||||
simpleService.insert(fullPersonList);
|
||||
});
|
||||
return Result.success().addMsg("报名成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 线程同步锁 防止同时报名造成数据错误
|
||||
*/
|
||||
private Lock lock = new ReentrantLock();
|
||||
|
||||
/**
|
||||
* 个人报名
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object doSingleRegister(String activityId) {
|
||||
lock.lock();
|
||||
if (StrUtil.isBlank(Vi.getUnionId()) || StrUtil.isBlank(Vi.getUnit().getId())) {
|
||||
lock.unlock();
|
||||
return Result.error("您的工会信息有误,无法报名,请联系工会管理员!");
|
||||
}
|
||||
String unionId = Vi.getUnionId();
|
||||
// String unionId = "74d1600a7486457b9afd660128c86a20";
|
||||
ActivityTissue activityTissue = simpleService.dao().fetch(ActivityTissue.class, activityId);
|
||||
;
|
||||
//活动设置了分组人员
|
||||
if (activityTissue.getGroupId() != null) {
|
||||
int count = simpleService.dao().count(ActivityUserScope.class, Cnd.where("groupId", "=", activityTissue.getGroupId()).and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
if (count == 0) {
|
||||
lock.unlock();
|
||||
return Result.error().addMsg("您不在本次活动参加人员范围内!");
|
||||
}
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(activityTissue.getUserNumberLimit())) {
|
||||
if (activityTissue.getUserNumberLimit() == 1) {
|
||||
Integer totalUserNumberLimit = activityTissue.getTotalUserNumberLimit();
|
||||
int hasRegisterCount = simpleService.dao().count(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId));
|
||||
if (!(totalUserNumberLimit - hasRegisterCount > 0)) {
|
||||
lock.unlock();
|
||||
return Result.error().addMsg("报名名额已满!");
|
||||
}
|
||||
}
|
||||
if (activityTissue.getUserNumberLimit() == 2) {
|
||||
int limitNumByUnion = getLimitNumByUnion(activityTissue.getUnionUserNumberLimit(), unionId);
|
||||
//获取当前该分工会已报多少人
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count(1)
|
||||
FROM
|
||||
activity_tissue_person atp
|
||||
LEFT JOIN `user` u ON u.id = atp.userId
|
||||
WHERE
|
||||
atp.tissueId = @activityId
|
||||
AND u.unionid = @unionId
|
||||
""");
|
||||
sql.setParam("activityId", activityId).setParam("unionId", unionId);
|
||||
int hasRegisterCount = simpleService.count(sql);
|
||||
if (!(limitNumByUnion - hasRegisterCount > 0)) {
|
||||
lock.unlock();
|
||||
return Result.error().addMsg("该分工会报名名额已满!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Sys_user principal = (Sys_user) ShiroUtil.getPrincipal();
|
||||
// Sys_user principal = simpleService.dao().fetch(Sys_user.class, "3chh580jokj8tqurtkqkk6uoov");
|
||||
ActivityTissuePerson activityTissuePerson = new ActivityTissuePerson();
|
||||
activityTissuePerson.setTissueId(activityId);
|
||||
assert principal != null;
|
||||
activityTissuePerson.setUserId(principal.getId());
|
||||
activityTissuePerson.setUserName(principal.getUsername());
|
||||
activityTissuePerson.setLoginName(principal.getLoginname());
|
||||
activityTissuePerson.setSex(principal.getSex());
|
||||
activityTissuePerson.setMobile(principal.getMobile());
|
||||
activityTissuePerson.setUnitName(principal.getUnit().getName());
|
||||
activityTissuePerson.setUnionName(principal.getUnion().getUnionname());
|
||||
activityTissuePerson.setApplyDateTime(DateUtil.getDateTime());
|
||||
activityTissuePerson.setApplyUserId(principal.getId());
|
||||
activityTissuePerson.setApplyUserUserName(principal.getUsername());
|
||||
simpleService.dao().insert(activityTissuePerson);
|
||||
lock.unlock();
|
||||
return Result.success().addMsg("报名成功!");
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object doSingleCancelRegister(String activityId, String applyUserId, String id) {
|
||||
ActivityTissue tissue = simpleService.dao().fetch(ActivityTissue.class, activityId);
|
||||
if (!tissue.getIsEnrollSystem()) {
|
||||
simpleService.dao().delete(ActivityTissuePerson.class, id);
|
||||
return Result.success().addMsg("取消成功!");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(applyUserId)) {
|
||||
applyUserId = ShiroUtil.getPrincipalProperty("id").toString();
|
||||
}
|
||||
simpleService.dao().clear(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId)
|
||||
.and("applyUserId", "=", applyUserId));
|
||||
return Result.success().addMsg("取消成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证当前用户是否报名
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object isRegisterForMe(String activityId) {
|
||||
int count = simpleService.dao().count(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否签到
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object isSign(String activityId) {
|
||||
ActivityTissue tissue = simpleService.dao().fetch(ActivityTissue.class, Cnd.where("id", "=", activityId));
|
||||
// if (tissue.getSignUpMethod() == 1) {
|
||||
// ActivityTissuePerson tissuePerson = simpleService.dao().fetch(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
// return tissuePerson.isSign();
|
||||
// } else {
|
||||
// return tissuePerson.isSign();
|
||||
// }
|
||||
ActivityTissuePerson tissuePerson = simpleService.dao().fetch(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
if (Lang.isEmpty(tissuePerson)) {
|
||||
return false;
|
||||
}
|
||||
return tissuePerson.isSign();
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人签到
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object singleSignUp(String activityId) {
|
||||
Chain chain = Chain.make("isSign", true);
|
||||
chain.add("signTime", DateUtil.getDateTime());
|
||||
Cnd cnd = Cnd.where("userId", "=", ShiroUtil.getPrincipalProperty("id")).and("tissueId", "=", activityId);
|
||||
simpleService.dao().update(ActivityTissuePerson.class, chain, cnd);
|
||||
return Result.success().addMsg("签到成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前活动报名人数
|
||||
*
|
||||
* @param activityId 活动id
|
||||
* @return 人数
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getHasRegUserNum(String activityId) {
|
||||
ActivityTissue tissue = simpleService.dao().fetch(ActivityTissue.class, Cnd.where("id", "=", activityId));
|
||||
Integer userNumberLimit = tissue.getUserNumberLimit();
|
||||
if (userNumberLimit == null || userNumberLimit == 1) {
|
||||
return simpleService.dao().count(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId));
|
||||
} else if (userNumberLimit == 2) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
activity_tissue_person atp
|
||||
LEFT JOIN `user` u ON u.id = atp.userId
|
||||
WHERE
|
||||
u.unionid = @unionId
|
||||
AND atp.tissueId = @activityId
|
||||
""");
|
||||
sql.setParam("unionId", Vi.getUnionId()).setParam("activityId", activityId);
|
||||
return simpleService.count(sql);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package io.v.nutz.zhgh.mobile.benefiting;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName BenefitingController
|
||||
* @Description TODO 惠民服务 移动端商品展示
|
||||
* @Author zzr
|
||||
* @Date 2023/7/28 10:40
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/benefiting")
|
||||
@Ok("json:full")
|
||||
public class BenefitingController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("/info")
|
||||
@Ok("beetl:/mobile/benefiting/info.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At("/goods")
|
||||
@Ok("beetl:/mobile/benefiting/goods.html")
|
||||
public void info() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm,@Param(value = "projectName",required = false)String projectName){
|
||||
Sql sql = Sqls.create("""
|
||||
select * from benefiting_project $condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and(Cnd.likeEX("projectName",projectName));
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object onLoad(PageForm pageForm,
|
||||
@Param(value = "typeId",required = false)String typeId,
|
||||
@Param(value = "projectId",required = false)String projectId,
|
||||
@Param(value = "goodsName",required = false)String goodsName){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
be.*,
|
||||
bp.projectName
|
||||
FROM
|
||||
`benefiting_exhibit` be
|
||||
LEFT JOIN `benefiting_project` bp ON be.projectId = bp.id
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.andEX("be.projectId","=",projectId);
|
||||
cnd.and(Cnd.likeEX("be.goodsName",goodsName));
|
||||
cnd.andEX("be.typeId","=",typeId);
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
package io.v.nutz.zhgh.mobile.birthday;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.blessing.models.Greeting;
|
||||
import io.v.nutz.zhgh.blessing.models.GreetingInfo;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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.Daos;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Author zzr
|
||||
* @Date 2023/5/25
|
||||
* @Description
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/birthday/greeting")
|
||||
@Ok("json:full")
|
||||
public class BirthdayGreetingsController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/birthday/greeting.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/greeting_info")
|
||||
@Ok("beetl:/mobile/birthday/greeting_info.html")
|
||||
public void info() {
|
||||
}
|
||||
|
||||
@At("/greeting_list")
|
||||
@Ok("beetl:/mobile/birthday/greeting_list.html")
|
||||
public void list() {
|
||||
}
|
||||
|
||||
@At("/hk")
|
||||
@Ok("beetl:/mobile/birthday/hk.html")
|
||||
public void hk() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 最近生日教职工展示
|
||||
* @param pageForm
|
||||
* @param searchKeyWord
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "searchKeyWord",required = false) String searchKeyWord) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
g.id,
|
||||
g.birthday,
|
||||
g.userId,
|
||||
g.username,
|
||||
g.loginname,
|
||||
st.`name` unitName
|
||||
FROM
|
||||
greeting g
|
||||
LEFT JOIN sys_user su ON g.userId = su.id
|
||||
LEFT JOIN sys_unit st ON su.unitid = st.id
|
||||
$condition
|
||||
""");
|
||||
cnd.where().and("g.userId","!=",ShiroUtil.getPrincipalProperty("id").toString());
|
||||
if (Strings.isNotBlank(searchKeyWord)) {
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
sqlExpressionGroup.andLike("g.username", searchKeyWord);
|
||||
sqlExpressionGroup.orLike("g.loginname", searchKeyWord);
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
cnd.asc("g.birthday");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取勾选赠送礼物的教职工
|
||||
* @param pageForm
|
||||
* @param greetingResult
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object loadList(PageForm pageForm,@Param(value = "greetingResult",required = false) String greetingResult) {
|
||||
String[] idArr=greetingResult.split(",");
|
||||
List<Greeting> greetingList = dao.query(Greeting.class, Cnd.where("userId", "in", idArr));
|
||||
return greetingList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取祝福榜(pc端)
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object giftList(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
bg.*
|
||||
FROM
|
||||
`blessing_gift` bg
|
||||
$condition
|
||||
""");
|
||||
cnd.asc("bg.sortField");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 赠送礼物
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object sendBlessing(PageForm pageForm,@Param(value = "greetingResult",required = false) String greetingResult,
|
||||
@Param(value = "giftId",required = false) String giftId,
|
||||
@Param(value = "message",required = false) String message,
|
||||
@Param(value = "isSend",required = false) boolean isSend) {
|
||||
String[] idArr = greetingResult.split(",");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = new Date();
|
||||
//当前登录人id(赠送人id)
|
||||
String id = ShiroUtil.getPrincipalProperty("id").toString();
|
||||
List<GreetingInfo> greetingInfos = new ArrayList<>();
|
||||
for (int i = 0; i < idArr.length; i++) {
|
||||
GreetingInfo greetingInfo = new GreetingInfo();
|
||||
greetingInfo.setPresenter(id);
|
||||
greetingInfo.setReceived(idArr[i]);
|
||||
greetingInfo.setGiftId(giftId);
|
||||
greetingInfo.setGiftTime(sdf.format(date));
|
||||
greetingInfo.setMessage(message);
|
||||
greetingInfo.setSend(isSend);
|
||||
|
||||
greetingInfos.add(greetingInfo);
|
||||
}
|
||||
dao.insert(greetingInfos);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询我收到的祝福
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object giftInfo(PageForm pageForm,@Param(value = "username",required = false) String username){
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gi.id,
|
||||
su.username,
|
||||
bg.files,
|
||||
gi.giftTime,
|
||||
gi.message,
|
||||
st.`name`,
|
||||
gi.isSend
|
||||
FROM
|
||||
`greeting_info` gi
|
||||
LEFT JOIN `sys_user` su ON gi.presenter = su.id
|
||||
LEFT JOIN `sys_unit` st ON su.unitid = st.id
|
||||
LEFT JOIN `blessing_gift` bg ON gi.giftId = bg.id
|
||||
$condition
|
||||
""");
|
||||
cnd.where().and("gi.received","=",ShiroUtil.getPrincipalProperty("id").toString());
|
||||
if (Strings.isNotBlank(username)){
|
||||
cnd.and("su.username","like",username);
|
||||
}
|
||||
cnd.desc("gi.giftTime");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At()
|
||||
@ViReturn
|
||||
public Object findOne(@Param("id") String id){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.username,
|
||||
gi.message
|
||||
FROM
|
||||
`greeting_info` gi
|
||||
LEFT JOIN `sys_user` su ON gi.presenter = su.id
|
||||
where gi.id=@id
|
||||
""").setParam("id",id);
|
||||
return Daos.query(dao, sql.toString(), Sqls.callback.map());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package io.v.nutz.zhgh.mobile.cahd;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/11/17 14:23
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/cahd/apply")
|
||||
@Ok("json:full")
|
||||
public class CahdApplyController {
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/cahd/applyList.html")
|
||||
@RequiresAuthentication
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At()
|
||||
@ViReturn
|
||||
public Object pageData(Integer year, PageForm page) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
u.username
|
||||
FROM
|
||||
hd_wm_xx xx
|
||||
LEFT JOIN sys_user u ON u.id = xx.hdcjr
|
||||
WHERE
|
||||
activityGroupId IN ( SELECT groupId FROM `activity_user_scope` $condition)
|
||||
AND YEAR ( hdkssj )= @year and xx.hdflag=true and xx.hdtype=2
|
||||
""").setParam("year", year);
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package io.v.nutz.zhgh.mobile.cahd;
|
||||
|
||||
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
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("/mobile/cahd/list")
|
||||
@Ok("json:full")
|
||||
public class CahdListController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/cahd/userList.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At("/view")
|
||||
@Ok("beetl:/mobile/cahd/viewInfo.html")
|
||||
public void view() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Object findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
u.username,
|
||||
u.loginname,
|
||||
hdlb.lname,
|
||||
zplb.zname
|
||||
FROM
|
||||
`hd_ca_sbxx` xx
|
||||
LEFT JOIN `user` u ON u.id = xx.sbr
|
||||
LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdlb
|
||||
LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.zplb
|
||||
WHERE xx.id=@id
|
||||
""").setParam("id", id);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package io.v.nutz.zhgh.mobile.checkin;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.hd.models.HdCheckinContent;
|
||||
import io.v.nutz.zhgh.hd.models.HdCheckinFile;
|
||||
import io.v.nutz.zhgh.hd.services.CheckinContentService;
|
||||
import io.v.nutz.zhgh.hd.services.CheckinFileService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import net.coobird.thumbnailator.Thumbnails;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/4/19
|
||||
* @Description 抗疫打卡签到
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/checkin")
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
public class CheckinMobileController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private CheckinContentService checkinContentService;
|
||||
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
@Inject
|
||||
private CheckinFileService checkinFileService;
|
||||
|
||||
private static ExecutorService pool = null;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/hd/checkin/checkinList.html")
|
||||
@RequiresAuthentication
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/info")
|
||||
@Ok("beetl:/mobile/hd/checkin/checkinInfo.html")
|
||||
public void info() {
|
||||
}
|
||||
|
||||
static {
|
||||
//获取系统处理器个数,作为线程池数量
|
||||
int nThreads = Runtime.getRuntime().availableProcessors();
|
||||
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
|
||||
.setNameFormat("demo-pool-%d").build();
|
||||
|
||||
pool = new ThreadPoolExecutor(nThreads , 30, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
|
||||
}
|
||||
|
||||
/**
|
||||
* 抗议打卡
|
||||
*
|
||||
* @param content:
|
||||
* @param files:
|
||||
* @return java.lang.Object
|
||||
* @author JyuHsin
|
||||
* @date 2022/4/24
|
||||
*/
|
||||
@At
|
||||
@Ok("json")
|
||||
@POST
|
||||
public Object doAdd(@Param("..") HdCheckinContent content, @Param("files") String files) {
|
||||
try {
|
||||
content.setUserid(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
content.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
HdCheckinContent insertContent = checkinContentService.insert(content);
|
||||
|
||||
List<Map> maps = Json.fromJsonAsList(Map.class, files);
|
||||
maps.forEach(item -> {
|
||||
HdCheckinFile hdFile = new HdCheckinFile();
|
||||
hdFile.setHdid(insertContent.getHdid());
|
||||
hdFile.setContentId(insertContent.getId());
|
||||
hdFile.setUrl(item.get("filepath").toString());
|
||||
hdFile.setName(item.get("filename").toString());
|
||||
checkinFileService.insert(hdFile);
|
||||
});
|
||||
int count = checkinContentService.count(Cnd.NEW().and("hdid", "=", content.getHdid()).and("left(time, 10)", "=", new SimpleDateFormat("yyyy-MM-dd").format(new Date())));
|
||||
return Result.success().addData(count);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@ViReturn
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Object uploadFile(@Param("file") TempFile[] files) throws IOException {
|
||||
|
||||
List<LinkedHashMap<String, String>> listMap = new ArrayList<>();
|
||||
LinkedHashMap<String, TempFile> fileMap = new LinkedHashMap<>();
|
||||
for (TempFile file : files) {
|
||||
String name = file.getSubmittedFileName();
|
||||
String rid = R.UU32();
|
||||
String suffixName = FilenameUtils.getExtension(name);
|
||||
|
||||
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
||||
map.put("filename", name);
|
||||
map.put("filepath", "/jyuhsin/" + rid + "." + suffixName);
|
||||
map.put("id", rid);
|
||||
listMap.add(map);
|
||||
|
||||
fileMap.put(rid, file);
|
||||
}
|
||||
|
||||
pool.execute(() -> {
|
||||
try {
|
||||
for (Map.Entry<String, TempFile> entry : fileMap.entrySet()) {
|
||||
String randomId = entry.getKey();
|
||||
TempFile value = entry.getValue();
|
||||
String name = value.getSubmittedFileName();
|
||||
|
||||
InputStream is = compressFile(value.getFile());
|
||||
ftpService.upload("/jyuhsin/", randomId + "." + FilenameUtils.getExtension(name), is);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
return listMap;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object del(String id) {
|
||||
List<HdCheckinFile> contentId = checkinFileService.query(Cnd.NEW().and("contentId", "=", id));
|
||||
contentId.forEach(item -> {
|
||||
ftpService.delete(item.getUrl());
|
||||
});
|
||||
checkinContentService.clear(Cnd.NEW().and("id", "=", id));
|
||||
checkinFileService.clear(Cnd.NEW().and("contentId", "=", id));
|
||||
checkinFileService.clear("hd_checkin_zan", Cnd.NEW().and("contentId", "=", id));
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object delFile(String[] url) {
|
||||
for (String s : url) {
|
||||
ftpService.delete(s);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
private String saveFile(String name, InputStream is) throws IOException {
|
||||
String rid = R.UU32();
|
||||
String suffixName = FilenameUtils.getExtension(name);
|
||||
ftpService.upload("/jyuhsin/", rid + "." + suffixName, is);
|
||||
|
||||
return "/jyuhsin/" + rid + "." + suffixName;
|
||||
}
|
||||
|
||||
private InputStream compressFile(File sourceFile) throws IOException {
|
||||
BufferedImage image = ImageIO.read(sourceFile);
|
||||
int width = image.getWidth();
|
||||
int height = image.getHeight();
|
||||
if (width == 0 || height == 0) {
|
||||
return null;
|
||||
}
|
||||
int scale = calculateSize(width, height);
|
||||
int destWidth = width / scale;
|
||||
int destHeight = height / scale;
|
||||
BufferedImage bufferedImage = Thumbnails.of(image).outputFormat("jpg").size(destWidth, destHeight).outputQuality(0.6f).asBufferedImage();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
ImageIO.write(bufferedImage, "jpg", os);
|
||||
return new ByteArrayInputStream(os.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据图片宽高计算压缩尺寸 * * @param srcWidth 图片宽度 * @param srcHeight 图片高度 * @return 压缩比例
|
||||
*/
|
||||
private static int calculateSize(int srcWidth, int srcHeight) {
|
||||
srcWidth = srcWidth % 2 == 1 ? srcWidth + 1 : srcWidth;
|
||||
srcHeight = srcHeight % 2 == 1 ? srcHeight + 1 : srcHeight;
|
||||
int longSide = Math.max(srcWidth, srcHeight);
|
||||
int shortSide = Math.min(srcWidth, srcHeight);
|
||||
float scale = ((float) shortSide / longSide);
|
||||
if (scale <= 1 && scale > 0.5625) {
|
||||
if (longSide < 1664) {
|
||||
return 1;
|
||||
} else if (longSide >= 1664 && longSide < 4990) {
|
||||
return 2;
|
||||
} else if (longSide > 4990 && longSide < 10240) {
|
||||
return 4;
|
||||
} else {
|
||||
return longSide / 1280 == 0 ? 1 : longSide / 1280;
|
||||
}
|
||||
} else if (scale <= 0.5625 && scale > 0.5) {
|
||||
return longSide / 1280 == 0 ? 1 : longSide / 1280;
|
||||
} else {
|
||||
return (int) Math.ceil(longSide / (1280.0 / scale));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package io.v.nutz.zhgh.mobile.common;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.model.UserSign;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-11-25 11:29
|
||||
* @description: 修改签名
|
||||
**/
|
||||
@IocBean
|
||||
@At("/mobile/common/signing")
|
||||
@Ok("json:full")
|
||||
public class updateSign {
|
||||
|
||||
@Inject("UserSign")
|
||||
private ViService<UserSign> userSignService;
|
||||
|
||||
|
||||
@At
|
||||
public void update(String sign, String user_id) {
|
||||
if (StrUtil.isBlank(user_id)) {
|
||||
user_id = (String) ShiroUtil.getPrincipalProperty("id");
|
||||
}
|
||||
if (Strings.isNotBlank(getMySign(null))) {
|
||||
userSignService.update(Chain.make("data", sign), Cnd.where("user_id", "=", user_id));
|
||||
} else {
|
||||
userSignService.insert(new UserSign(user_id, sign));
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
public void update(String sign, String user_id, String prefix) {
|
||||
if (StrUtil.isBlank(user_id)) {
|
||||
user_id = (String) ShiroUtil.getPrincipalProperty("id");
|
||||
}
|
||||
if (Strings.isNotBlank(getMySign(prefix))) {
|
||||
userSignService.update(Chain.make("data", sign), Cnd.where("user_id", "=", user_id));
|
||||
} else {
|
||||
userSignService.insert(new UserSign(user_id, sign, prefix));
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
public String getMySign(String prefix) {
|
||||
List<UserSign> userSigns = userSignService.query(Cnd.NEW().and("user_id", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.andEX("prefix", "=", prefix));
|
||||
return userSigns.isEmpty() ? null : userSigns.get(0).getData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package io.v.nutz.zhgh.mobile.condolence;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-11-23 20:33
|
||||
* @description: 慰问申请列表
|
||||
**/
|
||||
@IocBean
|
||||
@At("/mobile/condolence/apply")
|
||||
@Ok("json:full")
|
||||
public class CondolenceApplyController {
|
||||
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/condolence/apply_list.html")
|
||||
@RequiresPermissions("fw.condolence.apply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/condolence/apply_info.html")
|
||||
public void info() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "type", required = false) String type,
|
||||
@Param(value = "way", required = false) Integer way, int pageNumber, int pageSize) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
con.*,
|
||||
type.`name` type_name,
|
||||
be.username be_username,
|
||||
ma.username ma_username,
|
||||
be_unit.`name` be_unitname,
|
||||
be_union.unionname,
|
||||
state.state_name,
|
||||
state.state_color
|
||||
FROM
|
||||
condolence con
|
||||
LEFT JOIN sys_user be ON con.be_user = be.id
|
||||
LEFT JOIN sys_user ma ON con.manager = ma.id
|
||||
LEFT JOIN sys_unit be_unit ON be.unitid = be_unit.id
|
||||
LEFT JOIN sys_union be_union ON be_unit.unionid = be_union.id
|
||||
LEFT JOIN state state ON state.state_id = con.state_id
|
||||
LEFT JOIN condolence_type type ON type.id=con.type
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("con.manager", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
|
||||
Vi.cndPlus(cnd, "YEAR(con.apply_time)", "=", year);
|
||||
Vi.cndPlus(cnd, "con.type", "=", type);
|
||||
Vi.cndPlus(cnd, "con.way", "=", way);
|
||||
|
||||
cnd.desc("con.apply_time");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return condolenceService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package io.v.nutz.zhgh.mobile.condolence;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
import org.nutz.dao.Cnd;
|
||||
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;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/10/14 14:05
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/condolence/audit")
|
||||
@Ok("json:full")
|
||||
public class CondolenceAuditControll {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/condolence/audit_list.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(@Param(value = "year", required = false) String year,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "isAudit", required = false) Boolean isAudit,
|
||||
@Param(value = "type", required = false) String type,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword, int pageNumber, int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
con.*,
|
||||
type.`name` type_name,
|
||||
be.username be_username,
|
||||
be.loginname be_loginname,
|
||||
sqr.username sqr_username,
|
||||
be.unitname be_unitname,
|
||||
be.unionname be_unionname,
|
||||
state.state_name,
|
||||
state.state_color
|
||||
FROM
|
||||
condolence con
|
||||
LEFT JOIN `user` be ON con.be_user = be.id
|
||||
LEFT JOIN `user` sqr ON con.manager= sqr.id
|
||||
LEFT JOIN state state ON state.state_id = con.state_id
|
||||
LEFT JOIN condolence_type type ON type.id=con.type $condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
if (ShiroUtil.hasAnyRoles("A06, wyh01, wyh03, wyh02")) {
|
||||
group.or(Cnd.exps("con.state_id", isAudit ? ">" : "=", 2020));
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("H04")) {
|
||||
group.or("con.state_id", isAudit ? ">" : "=", 2000);
|
||||
group.and("be.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("SchoolUnionCondolenceAdmin")) {
|
||||
group.or("con.state_id", isAudit ? ">" : "=", 2012);
|
||||
}
|
||||
cnd.and(group);
|
||||
} else {
|
||||
cnd.and("con.state_id", "in", isAudit ? "2011,2010,2014,2015,2030,2040,2050" : "2000,2012,2020");
|
||||
}
|
||||
|
||||
cnd.andEX("YEAR(con.apply_time)", "=", year);
|
||||
cnd.andEX("con.type", "=", type);
|
||||
cnd.andEX("be.unitid", "=", unitId);
|
||||
cnd.andEX("be.unionid", "=", unionId);
|
||||
|
||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, pageOrderBy);
|
||||
} else {
|
||||
cnd.desc("con.apply_time");
|
||||
cnd.asc("con.state_id");
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return condolenceService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
|
||||
@At("/auditHtml")
|
||||
@Ok("re")
|
||||
public String auditHtml(Integer state_id) {
|
||||
if (state_id == 2000 && ShiroUtil.hasAnyRoles("H04,A06,sysadmin")) {
|
||||
return "beetl:/mobile/condolence/union_Audit.html";
|
||||
} else if ((state_id == 2012 || state_id == 2031) && ShiroUtil.hasAnyRoles("SchoolUnionCondolenceAdmin,sysadmin")) {
|
||||
return "beetl:/mobile/condolence/fr_Audit.html";
|
||||
} else if (state_id == 2020 && ShiroUtil.hasAnyRoles("wyh01,wyh02,wyh03,sysadmin")) {
|
||||
return "beetl:/mobile/condolence/school_Audit.html";
|
||||
}
|
||||
return "beetl:/mobile/condolence/apply_info.html";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package io.v.nutz.zhgh.mobile.condolence;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.zhgh.mobile.common.updateSign;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-11-23 20:33
|
||||
* @description: 慰问申请
|
||||
**/
|
||||
@IocBean
|
||||
@At("/mobile/condolence/apply/for")
|
||||
@Ok("json:full")
|
||||
public class CondolenceForController {
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@Inject
|
||||
private updateSign updateSign;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/condolence/apply.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(@Param("data") Condolence condolence, String sign) {
|
||||
String user_id = ShiroUtil.getPrincipalProperty("id").toString();
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
updateSign.update(sign, user_id);
|
||||
condolence.setManager_sign(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
|
||||
condolence.setManager(user_id);
|
||||
condolence.setApply_time(DateUtil.getDate());
|
||||
condolence.setState_id("2000");
|
||||
condolenceService.add(condolence);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package io.v.nutz.zhgh.mobile.contribution;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.zhgh.contribution.models.Contribution;
|
||||
import io.v.nutz.zhgh.contribution.models.ContributionApply;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/21 14:16
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/contribution")
|
||||
@Ok("json:full")
|
||||
public class MContributionController {
|
||||
|
||||
@Inject("Contribution")
|
||||
private ViService<Contribution> contributionViService;
|
||||
|
||||
@Inject("ContributionApply")
|
||||
private ViService<ContributionApply> contributionApplyViService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@At("/applyInfo")
|
||||
@Ok("beetl:/mobile/contribution/applyInfo.html")
|
||||
public void applyInfo() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/contribution/doContribution.html")
|
||||
public void doContribution() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object isNullTypeCodePageData() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
con.*,
|
||||
( SELECT SUM( money ) FROM contribution_apply apply WHERE apply.contributionId = con.id ) totalMoney,
|
||||
( SELECT COUNT( 1 ) FROM contribution_apply apply WHERE apply.contributionId = con.id ) totalUser
|
||||
FROM
|
||||
`contribution` con
|
||||
WHERE
|
||||
con.contributionTypeCode IS NULL
|
||||
""");
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getContributionTypeData() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
type.*,
|
||||
( SELECT COUNT( 1 ) FROM contribution con WHERE con.contributionTypeCode = type.typeCode and con.isContributionEnable=true) sonNum
|
||||
FROM
|
||||
`contribution_type` type
|
||||
""");
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getContributionById(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
con.*,
|
||||
( SELECT SUM( money ) FROM contribution_apply apply WHERE apply.contributionId = con.id ) totalMoney,
|
||||
( SELECT COUNT( 1 ) FROM contribution_apply apply WHERE apply.contributionId = con.id ) totalUser
|
||||
FROM
|
||||
contribution con
|
||||
WHERE
|
||||
con.id = @id
|
||||
""").setParam("id", id);
|
||||
return contributionViService.fetch(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doContributionApply(@Param("contributionApply") ContributionApply contributionApply) {
|
||||
contributionApply.setContributionTime(DateUtil.getDateTime());
|
||||
contributionApply.setUserId(ShiroUtil.getUserId());
|
||||
contributionApplyViService.insert(contributionApply);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package io.v.nutz.zhgh.mobile.contribution;
|
||||
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/22 11:08
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/contribution/view")
|
||||
@Ok("json:full")
|
||||
public class MContributionViewCon {
|
||||
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/contribution/contributionView.html")
|
||||
public void contributionView() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package io.v.nutz.zhgh.mobile.contribution;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.contribution.models.ContributionType;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/22 9:55
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/contribution/son")
|
||||
@Ok("json:full")
|
||||
public class MSonContributionCon {
|
||||
|
||||
|
||||
@Inject("ContributionType")
|
||||
private ViService<ContributionType> contributionTypeViService;
|
||||
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/contribution/sonList.html")
|
||||
public void sonList() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String typeCode) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
con.*,
|
||||
( SELECT SUM( money ) FROM contribution_apply apply WHERE apply.contributionId = con.id ) totalMoney,
|
||||
( SELECT COUNT( 1 ) FROM contribution_apply apply WHERE apply.contributionId = con.id ) totalUser
|
||||
FROM
|
||||
`contribution` con
|
||||
WHERE
|
||||
con.contributionTypeCode =@typeCode ORDER BY con.contributionCreationDate
|
||||
""").setParam("typeCode", typeCode);
|
||||
return contributionTypeViService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getTypeByCode(String typeCode) {
|
||||
return contributionTypeViService.fetch(Cnd.where("typeCode", "=", typeCode));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.v.nutz.zhgh.mobile.difficulty;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/difficulty/apply")
|
||||
@Ok("json:full")
|
||||
public class MDifficultyApplyController {
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/difficulty/apply.html")
|
||||
// @RequiresPermissions("fw.condolence.apply")
|
||||
@RequiresAuthentication
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/apply_list")
|
||||
@Ok("beetl:/mobile/difficulty/apply_list.html")
|
||||
@RequiresAuthentication
|
||||
public void list() {
|
||||
}
|
||||
|
||||
@At("/apply_info")
|
||||
@Ok("beetl:/mobile/difficulty/apply_info.html")
|
||||
@RequiresAuthentication
|
||||
public void info() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package io.v.nutz.zhgh.mobile.difficulty;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/10/22 13:43
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/difficulty/audit")
|
||||
@Ok("json:full")
|
||||
public class MDifficultyAuditController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/difficulty/audit_list.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private ZgfwKnbfService zgfwKnbfService;
|
||||
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@At()
|
||||
@ViReturn
|
||||
public Object pageData(Boolean isAudit, Integer year, String unitId, String unionId, PageForm page) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
if (ShiroUtil.hasAnyRoles("A06")) {
|
||||
cnd.and("sq.zt", isAudit ? ">" : "=", 200);
|
||||
|
||||
} else if (ShiroUtil.hasAnyRoles("H04")) {
|
||||
cnd.and("sq.zt", isAudit ? ">" : "=", 100);
|
||||
cnd.and("un.id", "=", vi.getUnionId());
|
||||
}
|
||||
} else {
|
||||
cnd.and("sq.zt", "in", isAudit ? "500,150,250" : "100,200");
|
||||
}
|
||||
|
||||
return zgfwKnbfService.pageData(cnd, page, year, unitId, unionId);
|
||||
}
|
||||
|
||||
@At("/auditHtml")
|
||||
@Ok("re")
|
||||
public String auditHtml(Integer zt) {
|
||||
if (zt == 100 && ShiroUtil.hasAnyRoles("H04,A06,sysadmin")) {
|
||||
return "beetl:/mobile/difficulty/union_Audit.html";
|
||||
} else if (zt == 200 && ShiroUtil.hasAnyRoles("A06,sysadmin")) {
|
||||
return "beetl:/mobile/difficulty/school_Audit.html";
|
||||
}
|
||||
return "beetl:/mobile/difficulty/apply_info.html";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package io.v.nutz.zhgh.mobile.healthCheckup;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupCampus;
|
||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
|
||||
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupProjectService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.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 org.nutz.trans.Trans;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/mobile/healthCheckup")
|
||||
public class MHealthCheckupListController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private HealthCheckupProjectService healthCheckupProjectService;
|
||||
|
||||
@At("/list")
|
||||
@Ok("beetl:/mobile/healthCheckup/list.html")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At("/checkUp")
|
||||
@Ok("beetl:/mobile/healthCheckup/checkUp.html")
|
||||
public void checkUp() {
|
||||
|
||||
}
|
||||
|
||||
@At("/mine")
|
||||
@Ok("beetl:/mobile/healthCheckup/mine.html")
|
||||
public void mine() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "tabName", required = false) String tabName) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
*,
|
||||
(select count(*) from health_checkup_user_selection s where s.projectId=p.id and s.selectUserId=@userId) as selectCount
|
||||
from
|
||||
health_checkup_project p
|
||||
$condition
|
||||
""").setParam("userId", ShiroUtil.getPlatformUid());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (tabName.equals("ing")) {
|
||||
cnd.and(Cnd.exps("choiceTimeStart", "<", DateUtil.now()).and("choiceTimeEnd", ">", DateUtil.now()));
|
||||
} else if (tabName.equals("end")) {
|
||||
cnd.and("choiceTimeEnd", "<", DateUtil.now());
|
||||
}
|
||||
cnd.asc("selectCount");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object mineData(PageForm pageForm, @Param(value = "tabName", required = false) String tabName) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
us.*,
|
||||
p.name,
|
||||
p.choiceTimeStart,
|
||||
p.choiceTimeEnd,
|
||||
p.cover
|
||||
FROM
|
||||
health_checkup_user_selection us
|
||||
LEFT JOIN health_checkup_project p ON us.projectId = p.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("us.selectUserId", "=", ShiroUtil.getPlatformUid());
|
||||
if (tabName.equals("ing")) {
|
||||
cnd.and(Cnd.exps("choiceTimeStart", "<", DateUtil.now()).and("choiceTimeEnd", ">", DateUtil.now()));
|
||||
} else if (tabName.equals("end")) {
|
||||
cnd.and("choiceTimeEnd", "<", DateUtil.now());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doSubmit(@Param("userSelection") HealthCheckupUserSelection userSelection) {
|
||||
Trans.exec(() -> {
|
||||
if(userSelection.getId() == null) {
|
||||
userSelection.setSelectUserId(ShiroUtil.getPlatformUid());
|
||||
userSelection.setSelectTime(new Date());
|
||||
baseService.dao().insertWith(userSelection, "companionList");
|
||||
} else {
|
||||
baseService.dao().clearLinks(userSelection, "companionList");
|
||||
baseService.dao().insertLinks(userSelection, "companionList");
|
||||
baseService.dao().update(userSelection);
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object cancel(String id, String projectId) {
|
||||
HealthCheckupProject checkupProject = baseService.dao().fetch(HealthCheckupProject.class, projectId);
|
||||
if (DateUtil.compare(new Date(), checkupProject.getChoiceTimeEnd()) > 0) {
|
||||
return Result.error("抱歉,当前时间已经不能取消");
|
||||
}
|
||||
HealthCheckupUserSelection userSelection = baseService.dao().fetch(HealthCheckupUserSelection.class, id);
|
||||
Trans.exec(() -> {
|
||||
baseService.dao().clearLinks(userSelection, "companionList");
|
||||
baseService.dao().delete(userSelection);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getSelectInfo(String id) {
|
||||
HealthCheckupUserSelection selection = baseService.dao().fetch(HealthCheckupUserSelection.class, id);
|
||||
baseService.dao().fetchLinks(selection, "companionList");
|
||||
NutMap nutMap = Lang.obj2map(selection, NutMap.class);
|
||||
if(selection.getCompanionList().size() > 0) {
|
||||
nutMap.put("isFamily", "是");
|
||||
} else {
|
||||
nutMap.put("isFamily", "否");
|
||||
}
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getCampus() {
|
||||
return baseService.dao().query(HealthCheckupCampus.class, Cnd.NEW().asc("campusCode"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object validCondition(String cndId) {
|
||||
if(StrUtil.isBlank(cndId)) {
|
||||
return Result.success();
|
||||
}
|
||||
NutMap nutMap = healthCheckupProjectService.validCondition(cndId);
|
||||
if(!nutMap.getBoolean("flag")) {
|
||||
return Result.error("选择条件:" + nutMap.getString("msg"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
package io.v.nutz.zhgh.mobile.legalAid;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.zhgh.legalAid.models.LegalAidAppointmentInfo;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/12/4 16:58
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/legalAidPro")
|
||||
@Ok("json:full")
|
||||
public class MLegalAidApplyProController {
|
||||
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/legalAid/entrance.html")
|
||||
public void entrance() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/legalAid/apply.html")
|
||||
public void apply() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/legalAid/myApplyList.html")
|
||||
public void myApplyList() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/legalAid/applyInfo.html")
|
||||
public void applyInfo() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "doctorId", required = false) String doctorId,
|
||||
@Param(value = "typeId", required = false) String typeId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pd.*,
|
||||
u.username
|
||||
FROM
|
||||
legal_aid_doctor pd
|
||||
LEFT JOIN `user` u ON pd.userid = u.id
|
||||
LEFT JOIN psychology_appointment_info pai ON pai.doctorUser = pd.userid
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (StrUtil.isNotBlank(doctorId)) {
|
||||
cnd.and("pd.userid", "=", doctorId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId) && "thisWeek".equals(typeId)) {
|
||||
DateTime start = DateUtil.beginOfWeek(new Date());
|
||||
DateTime end = DateUtil.endOfWeek(new Date());
|
||||
cnd.and("pai.startTime", ">=", start).and("pai.endTime", "<=", end);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId) && "nextWeek".equals(typeId)) {
|
||||
DateTime start = DateUtil.beginOfWeek(DateUtil.nextWeek());
|
||||
DateTime end = DateUtil.endOfWeek(DateUtil.nextWeek());
|
||||
cnd.and("pai.startTime", ">=", start).and("pai.endTime", "<=", end);
|
||||
}
|
||||
cnd.groupBy("userid");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
return list;
|
||||
}
|
||||
|
||||
/*根据咨询师查询咨询师的时间段*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getDataByDoctorId(PageForm pageForm,
|
||||
@Param(value = "id", required = false) String id,
|
||||
@Param(value = "typeId", required = false) String typeId) {
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pa.*,
|
||||
pd.mobile,
|
||||
u.username
|
||||
FROM
|
||||
legal_aid_appointment_info pa
|
||||
LEFT JOIN psychology_doctor pd ON pa.doctorUser = pd.userid
|
||||
LEFT JOIN `user` u ON pa.doctorUser = u.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (StrUtil.isNotBlank(typeId) && "thisWeek".equals(typeId)) {
|
||||
DateTime start = DateUtil.beginOfWeek(new Date());
|
||||
DateTime end = DateUtil.endOfWeek(new Date());
|
||||
cnd.and("pa.startTime", ">=", start).and("pa.endTime", "<=", end);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId) && "nextWeek".equals(typeId)) {
|
||||
DateTime start = DateUtil.beginOfWeek(DateUtil.nextWeek());
|
||||
DateTime end = DateUtil.endOfWeek(DateUtil.nextWeek());
|
||||
cnd.and("pa.startTime", ">=", start).and("pa.endTime", "<=", end);
|
||||
}
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
cnd.and("doctorUser", "=", id);
|
||||
}
|
||||
|
||||
cnd.orderBy("startTimeTs", "asc");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doApply(String id, String appointmentUserNote, String userMobile, String appointmentAskTypeValue, Boolean isAdd) {
|
||||
LegalAidAppointmentInfo info = dao.fetch(LegalAidAppointmentInfo.class, id);
|
||||
String userid = ShiroUtil.getPrincipalProperty("id").toString();
|
||||
if (StrUtil.isNotBlank(info.getAppointmentUser()) && !userid.equals(info.getAppointmentUser())) {
|
||||
return Result.error(2, "该时段刚刚已经被人预约过了喔!");
|
||||
}
|
||||
info.setAppointmentUserNote(appointmentUserNote);
|
||||
info.setAppointmentAskTypeValue(appointmentAskTypeValue);
|
||||
info.setAppointmentUser((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
info.setStateId(2300);
|
||||
int update = dao.update(info);
|
||||
|
||||
if (update > 0 && isAdd) {
|
||||
Sys_user doctorUser = dao.fetch(Sys_user.class, info.getDoctorUser());
|
||||
Sys_user applyUser = dao.fetch(Sys_user.class, info.getAppointmentUser());
|
||||
applyUser.setMobile(userMobile);
|
||||
dao.update(applyUser);
|
||||
String content = "%s老师您好,%s老师预约了%s至%s的心理咨询!"
|
||||
.formatted(doctorUser.getUsername(), applyUser.getUsername(), info.getStartTime(), info.getEndTime());
|
||||
ArrayList<Map> list2 = new ArrayList<>();
|
||||
list2.add(Map.of("type", "User", "userId", doctorUser.getLoginname(), "name", doctorUser.getUsername()));
|
||||
// msgApi.sendMsg(content, list2, "心理咨询", "WeChat", MsgApi.sendMode.normal.name());
|
||||
|
||||
String contentAdmin = "%s老师预约了%s至%s的心理咨询!"
|
||||
.formatted(applyUser.getUsername(), info.getStartTime(), info.getEndTime());
|
||||
ArrayList<Map> list1 = new ArrayList<>();
|
||||
list1.add(Map.of("type", "User", "userId", "02449", "name", "金自如"));
|
||||
list1.add(Map.of("type", "User", "userId", "80141", "name", "朱汇博"));
|
||||
// msgApi.sendMsg(contentAdmin, list1, "心理咨询", "WeChat", MsgApi.sendMode.normal.name());
|
||||
}
|
||||
return Result.success().addMsg("预约成功!");
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object MyPageData(PageForm page,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "stateId", required = false) 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 psychology_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);
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doCancel(String id) {
|
||||
LegalAidAppointmentInfo info = dao.fetch(LegalAidAppointmentInfo.class, id);
|
||||
Chain cancelChain = Chain.make("appointmentUser", null);
|
||||
cancelChain.add("appointmentUserNote", null);
|
||||
cancelChain.add("stateId", null);
|
||||
int update = dao.update(LegalAidAppointmentInfo.class, cancelChain, Cnd.where("id", "=", id));
|
||||
if (update > 0) {
|
||||
Sys_user doctorUser = dao.fetch(Sys_user.class, info.getDoctorUser());
|
||||
Sys_user applyUser = dao.fetch(Sys_user.class, info.getAppointmentUser());
|
||||
|
||||
String content = "%s老师您好,%s老师取消了%s至%s的心理咨询预约!"
|
||||
.formatted(doctorUser.getUsername(), applyUser.getUsername(), info.getStartTime(), info.getEndTime());
|
||||
String contentAdmin = "%s老师取消了%s至%s的心理咨询预约!"
|
||||
.formatted(applyUser.getUsername(), info.getStartTime(), info.getEndTime());
|
||||
|
||||
ArrayList<Map> list1 = new ArrayList<>();
|
||||
list1.add(Map.of("type", "User", "userId", doctorUser.getLoginname(), "name", doctorUser.getUsername()));
|
||||
// msgApi.sendMsg(content, list1, "心理咨询", "WeChat", MsgApi.sendMode.normal.name());
|
||||
|
||||
ArrayList<Map> list2 = new ArrayList<>();
|
||||
list2.add(Map.of("type", "User", "userId", "02449", "name", "金自如"));
|
||||
list2.add(Map.of("type", "User", "userId", "80141", "name", "朱汇博"));
|
||||
// msgApi.sendMsg(contentAdmin, list2, "心理咨询", "WeChat", MsgApi.sendMode.normal.name());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package io.v.nutz.zhgh.mobile.member;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.util.cri.SimpleCriteria;
|
||||
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.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/member/dashBoard")
|
||||
@Ok("json:full")
|
||||
public class MMemberDashBoardController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/member/dashBoard.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object memberNumber() {
|
||||
List<Record> list = dao.query("member", Cnd.NEW());
|
||||
long maleCount = list.stream().filter(v -> null != v.getString("sex") && v.getString("sex").equals("男")).count();
|
||||
long femaleCount = list.stream().filter(v -> null != v.getString("sex") && v.getString("sex").equals("女")).count();
|
||||
return Map.of("totalCount", list.size(), "maleCount", maleCount, "femaleCount", femaleCount);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object growthTrend() {
|
||||
List<Map> result = new ArrayList<>();
|
||||
Integer year = DateUtil.getYear();
|
||||
|
||||
SimpleCriteria cri = Cnd.cri();
|
||||
cri.where().andBetween("year", year - 5, year - 1);
|
||||
List<Record> member_his_list = dao.query("member_his", cri);
|
||||
|
||||
|
||||
for (int i = year - 5; i < year; i++) {
|
||||
int finalI = i;
|
||||
long count = member_his_list.stream().filter(v -> v.getInt("year") == finalI).count();
|
||||
result.add(Map.of("label", i, "value", count));
|
||||
}
|
||||
result.add(Map.of("label", year, "value", dao.count("member", Cnd.NEW())));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package io.v.nutz.zhgh.mobile.member;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.zhgh.member.constant.MemberApplyState;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/9/26 9:24
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/member/audit")
|
||||
@Ok("json:full")
|
||||
public class MemberAuditUnionController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/member/audit_list.html")
|
||||
public void indext() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(int pageNumber, int pageSize, boolean isAudit, Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
mar.*,
|
||||
st.stateName,
|
||||
st.stateColor,
|
||||
u.unionname,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.personType
|
||||
FROM
|
||||
`member_apply_record` mar
|
||||
LEFT JOIN audit_state st ON st.stateId = mar.stateId
|
||||
LEFT JOIN `user` u ON u.id = mar.userId
|
||||
$condition
|
||||
""");
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("mar.memberStates", "=", 1);
|
||||
|
||||
if (ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("mar.stateId", "in", isAudit ? Lang.array(MemberApplyState.UNION_FAIL, MemberApplyState.SCHOOL_UNION_FAIL, MemberApplyState.NORMAL_MEMBER) : Lang.array(MemberApplyState.UNION, MemberApplyState.SCHOOL_UNION));
|
||||
} else {
|
||||
if (ShiroUtil.hasAnyRoles("A06,wyh02") && ShiroUtil.hasAnyRoles("H04")) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("mar.stateId", isAudit ? ">" : "=", MemberApplyState.SCHOOL_UNION);
|
||||
seg.or(CndPlus.exps("mar.unionId", "=", Vi.getUnionId()).and("mar.stateId", isAudit ? ">" : "=", MemberApplyState.UNION));
|
||||
cnd.and(seg);
|
||||
} else if (ShiroUtil.hasAnyRoles("A06,wyh02")) {
|
||||
cnd.and("mar.stateId", isAudit ? ">" : "=", MemberApplyState.SCHOOL_UNION);
|
||||
} else if (ShiroUtil.hasAnyRoles("H04")) {
|
||||
cnd.and("mar.unionId", "=", Vi.getUnionId());
|
||||
cnd.and("mar.stateId", isAudit ? ">" : "=", MemberApplyState.UNION);
|
||||
}
|
||||
|
||||
|
||||
/*if (ShiroUtil.hasAnyRoles("A06,wyh02")) {
|
||||
cnd.and("mar.stateId", isAudit ? ">" : "=", MemberApplyState.SCHOOL_UNION);
|
||||
} else if (ShiroUtil.hasAnyRoles("H04")) {
|
||||
cnd.and("mar.unionId", "=", Vi.getUnionId());
|
||||
cnd.and("mar.stateId", isAudit ? ">" : "=", MemberApplyState.UNION);
|
||||
}*/
|
||||
}
|
||||
|
||||
/* if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
if (ShiroUtil.hasAnyRoles("A06,wyh02")) {
|
||||
cnd.and("mar.stateId", isAudit ? ">" : "=", MemberApplyState.SCHOOL_UNION);
|
||||
}
|
||||
}*/
|
||||
|
||||
cnd.andEx("YEAR(mar.applyTime)", "=", year);
|
||||
|
||||
cnd.asc("mar.stateId");
|
||||
cnd.desc("mar.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
|
||||
@At("/findOne")
|
||||
@Ok("re")
|
||||
public String findOne(Integer stateId) {
|
||||
if (stateId == MemberApplyState.UNION && ShiroUtil.hasAnyRoles("H04,A06,sysadmin")) {
|
||||
return "beetl:/mobile/member/union_Audit.html";
|
||||
} else if (stateId == MemberApplyState.SCHOOL_UNION && ShiroUtil.hasAnyRoles("A06,sysadmin")) {
|
||||
return "beetl:/mobile/member/school_Audit.html";
|
||||
} /*else if (stateId == MemberApplyState.NORMAL_MEMBER || stateId == MemberApplyState.UNION_FAIL || stateId == MemberApplyState.SCHOOL_UNION_FAIL) {
|
||||
return "beetl:/mobile/member/detail.html";
|
||||
}*/
|
||||
return "beetl:/mobile/member/detail.html";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.v.nutz.zhgh.mobile.member;
|
||||
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName MemberChangeAuditController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/8/1 9:21
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/member/change/audit")
|
||||
@Ok("json:full")
|
||||
public class MemberChangeAuditController {
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:/mobile/member/union_audit_change_list.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:/mobile/member/school_audit_change_list.html")
|
||||
public void index2() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package io.v.nutz.zhgh.mobile.member;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.member.service.MemberService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/member")
|
||||
@Ok("json:full")
|
||||
public class MemberMobileController {
|
||||
|
||||
@Inject
|
||||
private MemberService memberService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("/apply")
|
||||
@Ok("re")
|
||||
@RequiresAuthentication
|
||||
public String index() {
|
||||
String user_id = ShiroUtil.getPrincipalProperty("id").toString();
|
||||
Sys_user user = memberService.fetch(user_id);
|
||||
Integer member = user.getMember();
|
||||
int applyCount = memberService.count("member_apply_record", Cnd.where("userId", "=", user_id).and("stateId", "!=", 30));
|
||||
if (member != null && member == 1) {
|
||||
return "beetl:/mobile/member/detail.html";
|
||||
} else if ((member != null && member == 0) && applyCount > 0) {
|
||||
return "beetl:/mobile/member/detail.html";
|
||||
} else {
|
||||
return "beetl:/mobile/member/apply.html";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@At("/edit")
|
||||
@Ok("beetl:/mobile/member/edit.html")
|
||||
@RequiresRoles(value = {"H01", "sysadmin"}, logical = Logical.OR)
|
||||
public void edit() {
|
||||
}
|
||||
|
||||
|
||||
@At("/detail")
|
||||
@Ok("beetl:/mobile/member/detail.html")
|
||||
@RequiresRoles(value = {"H01", "sysadmin"}, logical = Logical.OR)
|
||||
public void detail() {
|
||||
}
|
||||
|
||||
// @At("/auditUnion")
|
||||
// @Ok("beetl:/mobile/member/auditUnion.html")
|
||||
// public void auditUnion() {
|
||||
// }
|
||||
|
||||
@At("/query")
|
||||
@Ok("beetl:/mobile/member/query.html")
|
||||
@RequiresRoles(value = {"H04", "A06","sysadmin"}, logical = Logical.OR)
|
||||
public void query() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAllNation() {
|
||||
return memberService.dao().query("sys_mz", Cnd.NEW());
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getMemberInfo(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresRoles(value = {"H04", "A06","sysadmin"}, logical = Logical.OR)
|
||||
public Object getMemberData(PageForm pageForm, String unionId, String unitId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`member`
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (StrUtil.isNotBlank(unionId)) {
|
||||
cnd.and("unionId", "=", unionId);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(unitId)) {
|
||||
cnd.and("unitId", "=", unitId);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.exps("loginname", "like", "%" + pageForm.getSearchKeyword() + "%").or("username", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
}
|
||||
|
||||
cnd.asc("unioncode").asc("loginname");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresRoles(value = {"H04", "A06","sysadmin"}, logical = Logical.OR)
|
||||
public Object viewInfo(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.username,
|
||||
u.sex,
|
||||
u.age,
|
||||
u.nation,
|
||||
u.education,
|
||||
u.political,
|
||||
u.jobTitle,
|
||||
u.position,
|
||||
u.vita,
|
||||
un.`name` AS unitname
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN sys_unit un ON u.unitid = un.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.id", "=", id);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
return list != null && list.size() > 0 ? list.get(0) : null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package io.v.nutz.zhgh.mobile;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.utils.LoginUtil;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.shiro.exception.CaptchaEmptyException;
|
||||
import io.v.nutz.web.commons.shiro.exception.CaptchaIncorrectException;
|
||||
import io.v.nutz.web.commons.shiro.filter.PlatformAuthenticationFilter;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.*;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.session.SessionException;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/login")
|
||||
@Ok("json")
|
||||
public class mobileLoginController {
|
||||
|
||||
@Inject
|
||||
private LoginUtil loginUtil;
|
||||
|
||||
/**
|
||||
* 登录页
|
||||
*/
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/login.html")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*/
|
||||
@At(value = {"/mobile/home", "/mobile/index"}, top = true)
|
||||
@Ok("beetl:/mobile/home.html")
|
||||
@RequiresAuthentication
|
||||
public void home() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*
|
||||
* @param request request
|
||||
* @param session 会话
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/doLogin")
|
||||
@Ok("json")
|
||||
@Filters(@By(type = PlatformAuthenticationFilter.class))
|
||||
public Object doLogin(@Attr("platformLoginToken") AuthenticationToken token, HttpServletRequest request, HttpSession session) {
|
||||
int errCount = NumberUtils.toInt(Strings.sNull(SecurityUtils.getSubject().getSession(true).getAttribute("platformErrCount")));
|
||||
try {
|
||||
loginUtil.doLogin(token, request, session, LoginUtil.LoginOrigin.WEB_H5);
|
||||
return Result.success("login.success");
|
||||
} catch (CaptchaIncorrectException e) {
|
||||
return Result.error(1, "login.error.captcha");
|
||||
} catch (CaptchaEmptyException e) {
|
||||
return Result.error(2, "验证码为空");
|
||||
} catch (LockedAccountException e) {
|
||||
return Result.error(3, "login.error.locked");
|
||||
} catch (UnknownAccountException e) {
|
||||
errCount++;
|
||||
SecurityUtils.getSubject().getSession(true).setAttribute("platformErrCount", errCount);
|
||||
return Result.error(4, "login.error.user");
|
||||
} catch (AuthenticationException e) {
|
||||
errCount++;
|
||||
SecurityUtils.getSubject().getSession(true).setAttribute("platformErrCount", errCount);
|
||||
return Result.error(5, "login.error.user");
|
||||
} catch (Exception e) {
|
||||
errCount++;
|
||||
SecurityUtils.getSubject().getSession(true).setAttribute("platformErrCount", errCount);
|
||||
return Result.error(6, "login.error.system");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出系统
|
||||
*/
|
||||
@At
|
||||
@Ok(">>:/mobile/login")
|
||||
public void out(HttpSession session, HttpServletRequest req) {
|
||||
try {
|
||||
Subject currentUser = SecurityUtils.getSubject();
|
||||
Sys_user user = (Sys_user) currentUser.getPrincipal();
|
||||
currentUser.logout();
|
||||
session.setAttribute("currentUser", null);
|
||||
} catch (SessionException ise) {
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package io.v.nutz.zhgh.mobile.proposal;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.proposal.models.ProposalType;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/proposal/analysis")
|
||||
@Ok("json:full")
|
||||
public class MProposalAnalysisController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/proposal/analysis.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getData(String sessionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
type.typeCode,
|
||||
type.typeName,
|
||||
count( 1 ) AS totalCount,
|
||||
count( CASE WHEN info.resultCode IN ( 'determine' ) THEN 1 ELSE NULL END ) laCount,
|
||||
count( CASE WHEN info.resultCode IN ( 'opinion' ) THEN 1 ELSE NULL END ) jyCount,
|
||||
count( CASE WHEN info.resultCode IN ( 'notGive' ) THEN 1 ELSE NULL END ) caCount,
|
||||
count( CASE WHEN ( info.resultCode IN ( 'determine' ) AND fb.feedbackCode = 'satisfied' ) THEN 1 ELSE NULL END ) myCount,
|
||||
count( CASE WHEN info.resultCode IN ( 'determine' ) AND fb.feedbackCode = 'QuiteSatisfied' THEN 1 ELSE NULL END ) ybCount,
|
||||
count( CASE WHEN info.resultCode IN ( 'determine' ) AND fb.feedbackCode = 'NotSatisfied' THEN 1 ELSE NULL END ) bmyCount
|
||||
FROM
|
||||
proposal_type type
|
||||
LEFT JOIN proposal_info info ON info.typeId = type.id
|
||||
LEFT JOIN proposal_feedback fb ON fb.proposalId = info.id
|
||||
WHERE
|
||||
info.teacherMeetingId = @teacherMeetingId
|
||||
AND info.resultCode IS NOT NULL
|
||||
GROUP BY
|
||||
type.id
|
||||
ORDER BY
|
||||
type.typeCode
|
||||
""");
|
||||
sql.setParam("teacherMeetingId", sessionId);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
List<String> typeName = list.stream().map(v -> v.getString("typeName")).collect(Collectors.toList());
|
||||
|
||||
List<ProposalType> proposalTypeList = baseService.dao().query(ProposalType.class, Cnd.where("typeName", "not in", typeName));
|
||||
|
||||
|
||||
proposalTypeList.forEach(v->{
|
||||
NutMap map = NutMap.NEW();
|
||||
map.put("typeCode",v.getTypeCode());
|
||||
map.put("typeName",v.getTypeName());
|
||||
map.put("totalCount",0);
|
||||
map.put("laCount",0);
|
||||
map.put("jyCount",0);
|
||||
map.put("caCount",0);
|
||||
map.put("myCount",0);
|
||||
map.put("ybCount",0);
|
||||
map.put("bmyCount",0);
|
||||
map.put("proportion",0);
|
||||
list.add(map);
|
||||
});
|
||||
|
||||
NumberFormat numberFormat = NumberFormat.getInstance();
|
||||
numberFormat.setMaximumFractionDigits(2);
|
||||
|
||||
long totalCount = list.stream().mapToLong(v -> v.getInt("totalCount")).sum();
|
||||
|
||||
list.forEach(v -> {
|
||||
float proportion = v.getFloat("totalCount") / (float) totalCount;
|
||||
v.put("proportion", numberFormat.format(proportion * 100) + "%");
|
||||
});
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package io.v.nutz.zhgh.mobile.proposal;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.zhgh.jdh.model.cb.Jdh_jdhxx;
|
||||
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt;
|
||||
import io.v.nutz.zhgh.proposal.models.ProposalState;
|
||||
import io.v.nutz.zhgh.proposal.models.ProposalType;
|
||||
import io.v.nutz.sys.models.Sys_dict;
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@At("/mobile/proposal/common")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MProposalCommonController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
/**
|
||||
* 获取所有教代会
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAllSession() {
|
||||
List<Jdh_jdhxx> list = dao.query(Jdh_jdhxx.class, Cnd.NEW().desc("jdhkqsj"));
|
||||
return list.stream().map(x -> new HashMap() {{
|
||||
put("text", x.getJdhallname());
|
||||
put("value", x.getId());
|
||||
}}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取教代会代表团
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getDelegation(String sessionId) {
|
||||
List<Jdh_dbt> list = dao.query(Jdh_dbt.class, Cnd.where("jdhid", "=", sessionId).asc("code"));
|
||||
List<HashMap> list2 = list.stream().map(x -> new HashMap() {{
|
||||
put("text", x.getDbtname());
|
||||
put("value", x.getId());
|
||||
}}).collect(Collectors.toList());
|
||||
|
||||
list2.add(0, new HashMap() {{
|
||||
put("text", "代表团(全部)");
|
||||
put("value", null);
|
||||
}});
|
||||
return list2;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getDelegateType() {
|
||||
HashMap<String, String> delegateMap = new HashMap<>() {{
|
||||
put("正式代表", Roles.ZSDB);
|
||||
put("列席代表", Roles.LXDB);
|
||||
put("特邀代表", Roles.TYDB);
|
||||
}};
|
||||
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
list.add(new HashMap<>() {{
|
||||
put("text", "代表类型(全部)");
|
||||
put("value", null);
|
||||
}});
|
||||
delegateMap.forEach((k, v) -> {
|
||||
list.add(new HashMap<>() {{
|
||||
put("text", k);
|
||||
put("value", v);
|
||||
}});
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getProposalType() {
|
||||
List<ProposalType> list = dao.query(ProposalType.class, Cnd.NEW().asc("typeCode"));
|
||||
List<HashMap> list2 = list.stream().map(v -> new HashMap() {{
|
||||
put("text", v.getTypeName());
|
||||
put("value", v.getId());
|
||||
}}).collect(Collectors.toList());
|
||||
list2.add(0, new HashMap() {{
|
||||
put("text", "提案类型(全部)");
|
||||
put("value", null);
|
||||
}});
|
||||
return list2;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getProposalDict() {
|
||||
List<Sys_dict> list = dao.query(Sys_dict.class, Cnd.where("parentId", "=", "d6e5b98e4e79440395531bb06cffb7dc"));
|
||||
List<HashMap> list2 = list.stream().map(v -> new HashMap() {{
|
||||
put("text", v.getName());
|
||||
put("value", v.getCode());
|
||||
}}).collect(Collectors.toList());
|
||||
list2.add(0, new HashMap() {{
|
||||
put("text", "立案结果(全部)");
|
||||
put("value", null);
|
||||
}});
|
||||
return list2;
|
||||
}
|
||||
/**
|
||||
* 获取全部开启的提案状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getOpenProposalState() {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("isEnable", "=", true);
|
||||
cnd.asc("stateCode");
|
||||
List<ProposalState> stateList = dao.query(ProposalState.class, cnd);
|
||||
List<HashMap> stateList2 = stateList.stream().map(v -> new HashMap() {{
|
||||
put("text", v.getStateName());
|
||||
put("value", v.getStateCode());
|
||||
}}).collect(Collectors.toList());
|
||||
stateList2.add(0, new HashMap() {{
|
||||
put("text", "提案状态(全部)");
|
||||
put("value", null);
|
||||
}});
|
||||
return stateList2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package io.v.nutz.zhgh.mobile.proposal;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 代表查询
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/proposal/delegate")
|
||||
@Ok("json:full")
|
||||
public class MProposalDelegateController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/proposal/delegate/list.html")
|
||||
@RequiresPermissions("jdh.db.dbyl")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/proposal/delegate/info.html")
|
||||
@RequiresPermissions("jdh.db.dbyl")
|
||||
public void viewInfo() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("jdh.db.dbyl")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "sessionId", required = false) String sessionId,
|
||||
@Param(value = "delegationId", required = false) String delegationId,
|
||||
@Param(value = "delegateTypeId", required = false) String delegateTypeId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
db.id,
|
||||
db.dbid,
|
||||
db.jdhid,
|
||||
db.dbunitid,
|
||||
db.dbunitname,
|
||||
db.dbfghid,
|
||||
db.dbfghname,
|
||||
db.dbzt,
|
||||
jdh.jdhallname,
|
||||
dbt.dbtname,
|
||||
r.id as roleid,
|
||||
r.name as rolename
|
||||
FROM
|
||||
jdh_db db
|
||||
LEFT JOIN user u ON u.id = db.dbid
|
||||
LEFT JOIN sys_role r ON r.id = db.roleid
|
||||
LEFT JOIN jdh_dbt dbt ON dbt.id = db.dbtid
|
||||
LEFT JOIN jdh_jdhxx jdh on jdh.id = db.jdhid
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("db.dbzt", "=", 2);
|
||||
cnd.and("db.jdhid", "=", sessionId);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,jdh10,jdh11,tamange")) {
|
||||
if (ShiroUtil.hasRole("jdhdbt01")) {
|
||||
Cnd cand = Cnd.NEW();
|
||||
cand.and("userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
cand.and("roleid", "in", Lang.array(Roles.DBT_TZ, Roles.DBT_FTZ));
|
||||
List<Sys_user_role> roleList = baseService.dao().query(Sys_user_role.class, cand);
|
||||
List<String> dbtids = roleList.stream().map(v -> v.getDbtid()).collect(Collectors.toList());
|
||||
cnd.and("db.dbtid", "in", dbtids);
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(delegationId)) {
|
||||
cnd.and("db.dbtid", "=", delegationId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(delegateTypeId)) {
|
||||
cnd.and("r.id", "=", delegateTypeId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.exps("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%").or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
}
|
||||
cnd.asc("dbt.code").desc("db.dbtid").desc("db.dbunitid");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package io.v.nutz.zhgh.mobile.proposal;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.proposal.constants.ProposalState;
|
||||
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
|
||||
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-11 09:41
|
||||
* @description: 手机端团长审核
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/mobile/proposal/delegation")
|
||||
public class MProposalDelegationController {
|
||||
|
||||
@Inject
|
||||
private ProposalInfoService proposalInfoService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/proposal/delegation/list.html")
|
||||
@RequiresPermissions("proposal.transact.delegation")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/view")
|
||||
@Ok("beetl:/mobile/proposal/delegation/audit.html")
|
||||
@RequiresPermissions("proposal.transact.delegation")
|
||||
public void view() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("proposal.transact.delegation")
|
||||
public Object pageData(PageForm page, ProposalSearch search) {
|
||||
String userId = ShiroUtil.getPrincipalProperty("id").toString();
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if (!ShiroUtil.hasAnyRoles("tamange,sysadmin")) {
|
||||
Sql sql = Sqls.create("SELECT dbtid FROM sys_user_role sur LEFT JOIN proposal_info info ON info.teacherMeetingId = sur.jdhid WHERE sur.roleId = @roleId AND sur.userId = @userId").setParam("roleId", Roles.DBT_TZ).setParam("userId", userId);
|
||||
cnd.and("info.delegationId", "IN", sql);
|
||||
}
|
||||
cnd.and("info.stateCode", search.getIsAudit().equals("true") ? ">" : "=", ProposalState.DELEGATION);
|
||||
if (Strings.isNotBlank(search.getSearchKeyWord())) {
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
sqlExpressionGroup.andLike("info.proposalName", search.getSearchKeyWord());
|
||||
sqlExpressionGroup.orLike("info.proposalCode", search.getSearchKeyWord());
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
|
||||
cnd.andEX("info.typeId", "=", search.getProposalTypeId());
|
||||
cnd.andEX("info.resultCode", "=", search.getProposalResultCode());
|
||||
return proposalInfoService.pageData(page, search, cnd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package io.v.nutz.zhgh.mobile.proposal;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
|
||||
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* 提案查询
|
||||
*
|
||||
* @author jug
|
||||
* @date 2023/07/14
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/mobile/proposal/integrated")
|
||||
public class MProposalIntegratedController {
|
||||
|
||||
@Inject
|
||||
private ProposalInfoService proposalInfoService;
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/proposal/search/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/view")
|
||||
@Ok("beetl:/mobile/proposal/proposalInfo.html")
|
||||
public void view() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, ProposalSearch search, @Param(value = "proposalStateCode", required = false) String proposalStateCode) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "T04", "jdh12", "jdh10"})) {
|
||||
if (ShiroUtil.hasAnyRoles("jdhdbt01")) {
|
||||
Sql sql = Sqls.create("SELECT dbtid FROM sys_user_role sur LEFT JOIN proposal_info info ON info.teacherMeetingId = sur.jdhid WHERE sur.roleId = @roleId AND sur.userId = @userId").setParam("roleId", Roles.DBT_TZ).setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.and("info.delegationId", "IN", sql);
|
||||
} else {
|
||||
cnd.and("info.createUser", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
}
|
||||
if (Strings.isNotBlank(search.getSearchKeyWord())) {
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
sqlExpressionGroup.andLike("info.proposalName", search.getSearchKeyWord());
|
||||
sqlExpressionGroup.orLike("info.proposalCode", search.getSearchKeyWord());
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
cnd.andEX("info.typeId", "=", search.getProposalTypeId());
|
||||
cnd.andEX("info.resultCode", "=", search.getProposalResultCode());
|
||||
cnd.andEX("info.stateCode", "=", proposalStateCode);
|
||||
return proposalInfoService.pageData(page, search, cnd);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package io.v.nutz.zhgh.mobile.proposal;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
|
||||
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@At("/mobile/proposal/compose")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MProposalMineController {
|
||||
|
||||
@Inject
|
||||
private ProposalInfoService proposalInfoService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/proposal/mine/index.html")
|
||||
@RequiresPermissions("proposal.transact.compose")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/view")
|
||||
@Ok("beetl:/mobile/proposal/proposalInfo.html")
|
||||
@RequiresPermissions("proposal.transact.compose")
|
||||
public void view() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/ta/detail.html")
|
||||
@RequiresPermissions("proposal.transact.compose")
|
||||
public void detail() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("proposal.transact.compose")
|
||||
public Object pageData(PageForm page, ProposalSearch search) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
su.username,
|
||||
su.loginname,
|
||||
state.stateName,
|
||||
state.stateColor,
|
||||
type.typeCode,
|
||||
type.typeName,
|
||||
jdh.jdhallname meetingName,
|
||||
dbt.dbtname delegationName,
|
||||
manner.`name` mannerName,
|
||||
result.`name` resultName,
|
||||
(select count(1) from proposal_seconded ps where ps.proposalId = info.id and ps.isAgree = 1) AS alreadySecondedCount
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN `user` su ON su.id = info.createUser
|
||||
LEFT JOIN proposal_state state ON state.stateCode = info.stateCode
|
||||
LEFT JOIN proposal_type type ON type.id = info.typeId
|
||||
LEFT JOIN jdh_jdhxx jdh ON jdh.id = info.teacherMeetingId
|
||||
LEFT JOIN jdh_dbt dbt ON dbt.id = info.delegationId
|
||||
LEFT JOIN sys_dict manner ON manner.`code` = info.mannerCode
|
||||
LEFT JOIN sys_dict result ON result.`code` = info.resultCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
String userId = ShiroUtil.getPrincipalProperty("id").toString();
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if (Strings.isNotBlank(search.getSearchKeyWord())) {
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
sqlExpressionGroup.andLike("info.proposalName", search.getSearchKeyWord());
|
||||
sqlExpressionGroup.orLike("info.proposalCode", search.getSearchKeyWord());
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
cnd.andEX("info.typeId", "=", search.getProposalTypeId());
|
||||
cnd.andEX("info.resultCode", "=", search.getProposalResultCode());
|
||||
cnd.and("info.createUser", "=", userId);
|
||||
cnd.desc("info.createTime");
|
||||
sql.setCondition(cnd);
|
||||
return proposalInfoService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
su.username createUserName,
|
||||
su.loginname,
|
||||
state.stateName,
|
||||
state.stateColor,
|
||||
type.typeName,
|
||||
un.unitName implementUnitName,
|
||||
su.unionname unionName,
|
||||
jdh.jdhallname meetingName,
|
||||
dbt.dbtname delegationName,
|
||||
manner.`name` mannerName,
|
||||
result.`name` resultName,
|
||||
sign.`data` createUserData
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN `user` su ON su.id = info.createUser
|
||||
LEFT JOIN proposal_state state ON state.stateCode = info.stateCode
|
||||
LEFT JOIN proposal_type type ON type.id = info.typeId
|
||||
LEFT JOIN proposal_undertake un ON un.id = info.implementUnitId
|
||||
LEFT JOIN jdh_jdhxx jdh ON jdh.id = info.teacherMeetingId
|
||||
LEFT JOIN jdh_dbt dbt ON dbt.id = info.delegationId
|
||||
LEFT JOIN sys_dict manner ON manner.`code` = info.mannerCode
|
||||
LEFT JOIN sys_dict result ON result.`code` = info.resultCode
|
||||
LEFT JOIN sys_signature sign ON sign.id = info.signId
|
||||
WHERE
|
||||
info.id = @proposalId
|
||||
""").setParam("proposalId", id);
|
||||
NutMap nutMap = proposalInfoService.fetch(sql);
|
||||
nutMap.setv("seconded", getSeconded(id));
|
||||
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据提案ID查询附议人
|
||||
*
|
||||
* @param proposalId
|
||||
* @return
|
||||
*/
|
||||
private Object getSeconded(String proposalId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname
|
||||
FROM
|
||||
proposal_seconded ps
|
||||
LEFT JOIN `user` u ON ps.seconderId = u.id
|
||||
WHERE
|
||||
ps.proposalId = @proposalId
|
||||
ORDER BY
|
||||
ps.secondedTime
|
||||
""").setParam("proposalId", proposalId);
|
||||
|
||||
return proposalInfoService.listMap(sql).isEmpty() ? null : proposalInfoService.listMap(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package io.v.nutz.zhgh.mobile.proposal;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.proposal.constants.ProposalState;
|
||||
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
|
||||
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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;
|
||||
|
||||
|
||||
@At("/mobile/proposal/seconded")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class MProposalSecondedController {
|
||||
|
||||
@Inject
|
||||
private ProposalInfoService proposalInfoService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/proposal/seconded/list.html")
|
||||
@RequiresPermissions("proposal.transact.seconded")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/view")
|
||||
@Ok("beetl:/mobile/proposal/seconded/audit.html")
|
||||
@RequiresPermissions("proposal.transact.seconded")
|
||||
public void view() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("proposal.transact.seconded")
|
||||
public Object pageData(PageForm page, ProposalSearch search) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ps.id secondedId,
|
||||
ps.isAgree,
|
||||
psu.username secondedUserName,
|
||||
su.username,
|
||||
su.loginname,
|
||||
state.stateName,
|
||||
state.stateColor,
|
||||
type.typeName,
|
||||
jdh.jdhallname meetingName,
|
||||
dbt.dbtname delegationName,
|
||||
manner.`name` mannerName,
|
||||
result.`name` resultName
|
||||
FROM
|
||||
proposal_seconded ps
|
||||
LEFT JOIN proposal_info info ON info.id = ps.proposalId
|
||||
LEFT JOIN sys_user su ON su.id = info.createUser
|
||||
LEFT JOIN sys_user psu ON psu.id = ps.seconderId
|
||||
LEFT JOIN proposal_state state ON state.stateCode = info.stateCode
|
||||
LEFT JOIN proposal_type type ON type.id = info.typeId
|
||||
LEFT JOIN jdh_jdhxx jdh ON jdh.id = info.teacherMeetingId
|
||||
LEFT JOIN jdh_dbt dbt ON dbt.id = info.delegationId
|
||||
LEFT JOIN sys_dict manner ON manner.`code` = info.mannerCode
|
||||
LEFT JOIN sys_dict result ON result.`code` = info.resultCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("tamange,sysadmin")) {
|
||||
cnd.and("ps.seconderId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
cnd.andEX("info.typeId", "=", search.getProposalTypeId());
|
||||
cnd.and("info.stateCode", ">=", ProposalState.UNSUBMIT);
|
||||
cnd.and("ps.isAgree", search.getIsAudit().equals("true") ? "IS NOT" : "IS", null);
|
||||
|
||||
return proposalInfoService.pageData(sql, page, search, cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("proposal.transact.seconded")
|
||||
public Object getSecondedCount(String proposalId, String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.stateCode,
|
||||
ps.*,
|
||||
u.username
|
||||
FROM
|
||||
proposal_seconded ps
|
||||
LEFT JOIN proposal_info info on info.id = ps.proposalId
|
||||
LEFT JOIN sys_user u on u.id = ps.seconderId
|
||||
WHERE
|
||||
ps.proposalId = @proposalId
|
||||
AND ps.id = @id
|
||||
""").setParam("proposalId", proposalId).setParam("id", id);
|
||||
|
||||
return proposalInfoService.fetch(sql);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package io.v.nutz.zhgh.mobile.proposal;
|
||||
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2022/3/3 10:50
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/proposal/writeProposal")
|
||||
@Ok("json:full")
|
||||
public class MProposalWriteProposalCon {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/proposal/write/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
package io.v.nutz.zhgh.mobile.psychology;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.psychology.models.PsychologyAppointmentInfo;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/7/15
|
||||
* @Description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/psychologyPro")
|
||||
@Ok("json:full")
|
||||
public class MPsychologyApplyProController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/psychologyPro/entrance.html")
|
||||
@RequiresAuthentication
|
||||
public void entrance() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/psychologyPro/apply.html")
|
||||
@RequiresAuthentication
|
||||
public void apply() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/psychologyPro/myApplyList.html")
|
||||
@RequiresAuthentication
|
||||
public void myApplyList() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "doctorId", required = false) String doctorId,
|
||||
@Param(value = "typeId", required = false) String typeId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pd.*,
|
||||
u.username
|
||||
FROM
|
||||
psychology_doctor pd
|
||||
LEFT JOIN `user` u ON pd.userid = u.id
|
||||
LEFT JOIN psychology_appointment_info pai ON pai.doctorUser = pd.userid
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (StrUtil.isNotBlank(doctorId)) {
|
||||
cnd.and("pd.userid", "=", doctorId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId) && "thisWeek".equals(typeId)) {
|
||||
DateTime start = DateUtil.beginOfWeek(new Date());
|
||||
DateTime end = DateUtil.endOfWeek(new Date());
|
||||
cnd.and("pai.startTime", ">=", start).and("pai.endTime", "<=", end);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId) && "nextWeek".equals(typeId)) {
|
||||
DateTime start = DateUtil.beginOfWeek(DateUtil.nextWeek());
|
||||
DateTime end = DateUtil.endOfWeek(DateUtil.nextWeek());
|
||||
cnd.and("pai.startTime", ">=", start).and("pai.endTime", "<=", end);
|
||||
}
|
||||
cnd.groupBy("userid");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
return list;
|
||||
}
|
||||
|
||||
/*根据咨询师查询咨询师的时间段*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getDataByDoctorId(PageForm pageForm,
|
||||
@Param(value = "id", required = false) String id,
|
||||
@Param(value = "typeId", required = false) String typeId) {
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pa.*,
|
||||
pd.mobile,
|
||||
u.username
|
||||
FROM
|
||||
psychology_appointment_info pa
|
||||
LEFT JOIN psychology_doctor pd ON pa.doctorUser = pd.userid
|
||||
LEFT JOIN `user` u ON pa.doctorUser = u.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (StrUtil.isNotBlank(typeId) && "thisWeek".equals(typeId)) {
|
||||
DateTime start = DateUtil.beginOfWeek(new Date());
|
||||
DateTime end = DateUtil.endOfWeek(new Date());
|
||||
cnd.and("pa.startTime", ">=", start).and("pa.endTime", "<=", end);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId) && "nextWeek".equals(typeId)) {
|
||||
DateTime start = DateUtil.beginOfWeek(DateUtil.nextWeek());
|
||||
DateTime end = DateUtil.endOfWeek(DateUtil.nextWeek());
|
||||
cnd.and("pa.startTime", ">=", start).and("pa.endTime", "<=", end);
|
||||
}
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
cnd.and("doctorUser", "=", id);
|
||||
}
|
||||
|
||||
cnd.orderBy("startTimeTs", "asc");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doApply(String id, String appointmentUserNote, String userMobile, String appointmentAskTypeValue, Boolean isAdd) {
|
||||
PsychologyAppointmentInfo info = dao.fetch(PsychologyAppointmentInfo.class, id);
|
||||
String userid = ShiroUtil.getPrincipalProperty("id").toString();
|
||||
if (StrUtil.isNotBlank(info.getAppointmentUser()) && !userid.equals(info.getAppointmentUser())) {
|
||||
return Result.error(2, "该时段刚刚已经被人预约过了喔!");
|
||||
}
|
||||
info.setAppointmentUserNote(appointmentUserNote);
|
||||
info.setAppointmentAskTypeValue(appointmentAskTypeValue);
|
||||
info.setAppointmentUser((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
info.setStateId(2330);
|
||||
int update = dao.update(info);
|
||||
|
||||
if (update > 0 && isAdd) {
|
||||
Sys_user doctorUser = dao.fetch(Sys_user.class, info.getDoctorUser());
|
||||
Sys_user applyUser = dao.fetch(Sys_user.class, info.getAppointmentUser());
|
||||
applyUser.setMobile(userMobile);
|
||||
dao.update(applyUser);
|
||||
String content = "%s老师您好,%s老师预约了%s至%s的心理咨询!"
|
||||
.formatted(doctorUser.getUsername(), applyUser.getUsername(), info.getStartTime(), info.getEndTime());
|
||||
ArrayList<Map> list2 = new ArrayList<>();
|
||||
list2.add(Map.of("type", "User", "userId", doctorUser.getLoginname(), "name", doctorUser.getUsername()));
|
||||
// msgApi.sendMsg(content, list2, "心理咨询", "WeChat", MsgApi.sendMode.normal.name());
|
||||
|
||||
String contentAdmin = "%s老师预约了%s至%s的心理咨询!"
|
||||
.formatted(applyUser.getUsername(), info.getStartTime(), info.getEndTime());
|
||||
ArrayList<Map> list1 = new ArrayList<>();
|
||||
list1.add(Map.of("type", "User", "userId", "02449", "name", "金自如"));
|
||||
list1.add(Map.of("type", "User", "userId", "80141", "name", "朱汇博"));
|
||||
// msgApi.sendMsg(contentAdmin, list1, "心理咨询", "WeChat", MsgApi.sendMode.normal.name());
|
||||
}
|
||||
return Result.success().addMsg("预约成功!");
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object MyPageData(PageForm page,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "stateId", required = false) 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
|
||||
`psychology_appointment_info` pai
|
||||
LEFT JOIN `user` au ON au.id = pai.appointmentUser
|
||||
LEFT JOIN psychology_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);
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doCancel(String id) {
|
||||
PsychologyAppointmentInfo info = dao.fetch(PsychologyAppointmentInfo.class, id);
|
||||
Chain cancelChain = Chain.make("appointmentUser", null);
|
||||
cancelChain.add("appointmentUserNote", null);
|
||||
cancelChain.add("stateId", null);
|
||||
int update = dao.update(PsychologyAppointmentInfo.class, cancelChain, Cnd.where("id", "=", id));
|
||||
if (update > 0) {
|
||||
Sys_user doctorUser = dao.fetch(Sys_user.class, info.getDoctorUser());
|
||||
Sys_user applyUser = dao.fetch(Sys_user.class, info.getAppointmentUser());
|
||||
|
||||
String content = "%s老师您好,%s老师取消了%s至%s的心理咨询预约!"
|
||||
.formatted(doctorUser.getUsername(), applyUser.getUsername(), info.getStartTime(), info.getEndTime());
|
||||
String contentAdmin = "%s老师取消了%s至%s的心理咨询预约!"
|
||||
.formatted(applyUser.getUsername(), info.getStartTime(), info.getEndTime());
|
||||
|
||||
ArrayList<Map> list1 = new ArrayList<>();
|
||||
list1.add(Map.of("type", "User", "userId", doctorUser.getLoginname(), "name", doctorUser.getUsername()));
|
||||
// msgApi.sendMsg(content, list1, "心理咨询", "WeChat", MsgApi.sendMode.normal.name());
|
||||
|
||||
ArrayList<Map> list2 = new ArrayList<>();
|
||||
list2.add(Map.of("type", "User", "userId", "02449", "name", "金自如"));
|
||||
list2.add(Map.of("type", "User", "userId", "80141", "name", "朱汇博"));
|
||||
// msgApi.sendMsg(contentAdmin, list2, "心理咨询", "WeChat", MsgApi.sendMode.normal.name());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.v.nutz.zhgh.mobile.rxdj;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import org.nutz.dao.Cnd;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/10/15 14:47
|
||||
* @description 手机端子女入学登记
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/rxdj/apply")
|
||||
@Ok("json:full")
|
||||
public class MRxdjApplyController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/rxdj/applyList.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(Integer pageNumber, Integer pageSize) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("bmkqzt", "=", 1);
|
||||
return baseService.listPage(pageNumber, pageSize, "fw_rxdj_year", cnd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
package io.v.nutz.zhgh.mobile.selfApplyUser.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.zhgh.member.UserMode;
|
||||
import io.v.nutz.zhgh.mobile.selfApplyUser.models.SelfApplyUser;
|
||||
import io.v.nutz.zhgh.shopping.models.ShoppingType;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @ClassName MApplyUserAuditController
|
||||
* @Description 审核
|
||||
* @Author zhf
|
||||
* @Date 2023/11/8 11:08
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/self/applyUser/audit")
|
||||
@Ok("json:full")
|
||||
public class MApplyUserAuditController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("")
|
||||
@RequiresRoles(value = {"sysadmin", "A06"}, logical = Logical.OR)
|
||||
@Ok("beetl:/mobile/selfApplyUser/applyUserAudit.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresRoles(value = {"sysadmin", "A06"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page, @Param(value = "timeSwitch", required = false) Boolean timeSwitch,
|
||||
@Param(value = "time", required = false) String time,
|
||||
@Param(value = "auditState", required = false) Integer auditState) {
|
||||
Sql sql = Sqls.create("""
|
||||
select * from self_apply_user $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!timeSwitch) {
|
||||
cnd.and("LEFT( applyDate, 7 )", "=", time);
|
||||
}
|
||||
if (StrUtil.isNotBlank(page.getSearchKeyword())) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("applyUserName", page.getSearchKeyword());
|
||||
group.orLike("userName", page.getSearchKeyword());
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.andEX("auditState", "=", auditState);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresRoles(value = {"sysadmin", "A06"}, logical = Logical.OR)
|
||||
public Object doDelete(String id) {
|
||||
baseService.dao().delete(SelfApplyUser.class, id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresRoles(value = {"sysadmin", "A06"}, logical = Logical.OR)
|
||||
public Object doSubmit(SelfApplyUser selfApplyUser, Boolean checked) {
|
||||
selfApplyUser.setAuditState(checked ? 3 : 2);
|
||||
selfApplyUser.setAuditTime(DateUtil.now());
|
||||
baseService.updateIgnoreNull(selfApplyUser);
|
||||
String passWord = selfApplyUser.getIdCard().substring(selfApplyUser.getIdCard().length() - 6) + "@" + Globals.schoolCode + selfApplyUser.getIdCard().substring(selfApplyUser.getIdCard().length() - 6);
|
||||
|
||||
String content;
|
||||
if (checked) {
|
||||
Sys_user user = new Sys_user();
|
||||
user.setPassword(passWord);
|
||||
user.setLoginname(selfApplyUser.getMobile());
|
||||
user.setUsername(selfApplyUser.getUserName());
|
||||
user.setIdcard(selfApplyUser.getIdCard());
|
||||
user.setSex(selfApplyUser.getSex());
|
||||
user.setMobile(selfApplyUser.getMobile());
|
||||
user.setPersonType("其他");
|
||||
user.setUnitid("1599");
|
||||
user = UserMode.initUserPush(user);
|
||||
UserMode.addRoleAndFlush(user.getId(), selfApplyUser.getApplyModel() == 1 ? Roles.FLGYSLR : Roles.LXYGYSLR);
|
||||
content = "您申请的账号已通过,智慧工会网址:" + Globals.AppDomain + "/platform/login,请使用电脑访问网址进行录入套餐,如进入系统没有看到录入的地方请联系工会,账号为您申请的手机号,密码为:'申请时的身份证后六位'+@" + Globals.schoolCode + "+'申请时的身份证后六位'";
|
||||
|
||||
|
||||
if (selfApplyUser.getApplyModel() == 1) {
|
||||
ShoppingType shoppingType = new ShoppingType();
|
||||
shoppingType.setYear(String.valueOf(DateUtil.thisYear()));
|
||||
shoppingType.setShoppingName(selfApplyUser.getUserName());
|
||||
shoppingType.setLoginName(selfApplyUser.getMobile());
|
||||
shoppingType.setUserName(selfApplyUser.getApplyUserName());
|
||||
shoppingType.setMobile(selfApplyUser.getMobile());
|
||||
shoppingType.setTypeName("供应商录入");
|
||||
shoppingType.setEnable(true);
|
||||
for (String id : selfApplyUser.getWelfareProjectIds()) {
|
||||
shoppingType.setWelfareId(id);
|
||||
baseService.insert(shoppingType);
|
||||
}
|
||||
} else {
|
||||
//如果是疗休养
|
||||
TheRapyRecuperationTravelAgency travelAgency = new TheRapyRecuperationTravelAgency();
|
||||
travelAgency.setTravelAgencyName(user.getUsername());
|
||||
travelAgency.setContact(selfApplyUser.getApplyUserName());
|
||||
travelAgency.setContactMobileNumber(selfApplyUser.getMobile());
|
||||
travelAgency.setYear(DateUtil.thisYear());
|
||||
travelAgency.setDisabled(false);
|
||||
baseService.insert(travelAgency);
|
||||
|
||||
//绑定目的地
|
||||
selfApplyUser.getBaseManagementIds().forEach(b -> {
|
||||
baseService.dao().update(TheRapyRecuperationBaseManagement.class,
|
||||
Chain.make("travelAgencyId", travelAgency.getId())
|
||||
.add("baseContactPerson", selfApplyUser.getApplyUserName())
|
||||
.add("baseContactNumber", selfApplyUser.getMobile()), Cnd.where("id", "=", b));
|
||||
});
|
||||
//绑定线路
|
||||
selfApplyUser.getLineIds().forEach(b -> {
|
||||
baseService.dao().update(TheRapyRecuperationLine.class,
|
||||
Chain.make("travelAgencyId", travelAgency.getId())
|
||||
.add("lineContact", selfApplyUser.getApplyUserName())
|
||||
.add("lineContactPhone", selfApplyUser.getMobile()),
|
||||
Cnd.where("id", "=", b));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
content = "您申请的账号不通过,请点击:" + Globals.AppDomain + "/mobile/self/applyUser,前往查看不通过原因";
|
||||
}
|
||||
// msgApi.sendMsg(content, selfApplyUser.getMobile(), MsgApi.SMS_TEMPLATE_ID);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
package io.v.nutz.zhgh.mobile.selfApplyUser.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.mobile.selfApplyUser.models.SelfApplyUser;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.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.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @ClassName applyUserController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/11/8 9:38
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/self/applyUser")
|
||||
@Ok("json:full")
|
||||
public class MApplyUserController {
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/selfApplyUser/applyUser.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/list")
|
||||
@Ok("beetl:/mobile/selfApplyUser/applyUserList.html")
|
||||
public void list() {
|
||||
}
|
||||
|
||||
@At("/openQRCode")
|
||||
@Ok("beetl:/mobile/selfApplyUser/openQRCode.html")
|
||||
public void openQRCode() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getApplyData(
|
||||
@Param(value = "mobile", required = false) String mobile,
|
||||
@Param(value = "idCard", required = false) String idCard) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("mobile", "=", mobile);
|
||||
cnd.andEX("idCard", "=", idCard);
|
||||
return baseService.dao().query(SelfApplyUser.class, cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOne(@Param(value = "id", required = false) String id) {
|
||||
return baseService.dao().fetch(SelfApplyUser.class, id);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doSubmit(SelfApplyUser selfApplyUser) {
|
||||
selfApplyUser.setApplyDate(DateUtil.now());
|
||||
selfApplyUser.setAuditState(1);
|
||||
baseService.insertOrUpdate(selfApplyUser);
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public boolean getUserByMobile(String mobile) {
|
||||
Sys_user user = baseService.dao().fetch(Sys_user.class, Cnd.where("mobile", "=", mobile));
|
||||
if (Lang.isNotEmpty(user)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object welfareProjectList() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
`name`
|
||||
FROM
|
||||
welfare_project
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.where("flexible", "=", 1);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("welfareUnionId", "is", null);
|
||||
cnd.and(seg);
|
||||
cnd.andEX("choiceTimeStart", ">", DateUtil.now());
|
||||
cnd.desc("updatedAt");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getBaseManagementList() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
baseName
|
||||
FROM
|
||||
`the_rapy_recuperation_base_management`
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.where("isDisabled", "=", 0)
|
||||
.and("year", "=", DateUtil.thisYear());
|
||||
cnd.andEX("signUpStartTime", ">", DateUtil.now());
|
||||
cnd.and(Cnd.exps("travelAgencyId", "=", "").or("travelAgencyId", "is", null));
|
||||
cnd.asc("sortNumber");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getLineList() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
lineName
|
||||
FROM
|
||||
`the_rapy_recuperation_line`
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.where("isDisabled", "=", 0)
|
||||
.and("year", "=", DateUtil.thisYear());
|
||||
cnd.and(Cnd.exps("travelAgencyId", "=", "").or("travelAgencyId", "is", null));
|
||||
cnd.asc("serialNumber");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package io.v.nutz.zhgh.mobile.selfApplyUser.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SelfApplyUser
|
||||
* @Description 个人申请
|
||||
* @Author zhf
|
||||
* @Date 2023/11/8 10:27
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
public class SelfApplyUser {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("申请人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyUserName;
|
||||
|
||||
@Column
|
||||
@Comment("供应商名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("联系电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("身份证号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyDate;
|
||||
|
||||
@Column
|
||||
@Comment("审核状态")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer auditState;
|
||||
|
||||
@Column
|
||||
@Comment("申请模式(1.福利2.疗休养)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer applyModel;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("审核意见")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String auditOpinion;
|
||||
|
||||
@Column
|
||||
@Comment("申请的福利项目ids")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> welfareProjectIds;
|
||||
|
||||
@Column
|
||||
@Comment("申请的目的地ids")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> baseManagementIds;
|
||||
|
||||
@Column
|
||||
@Comment("申请的线路ids")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> lineIds;
|
||||
|
||||
@Column
|
||||
@Comment("申请的项目name")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String projectNames;
|
||||
|
||||
@Column
|
||||
@Comment("审核时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String auditTime;
|
||||
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package io.v.nutz.zhgh.mobile.therapyRecuperation;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/6/2
|
||||
* @Description 疗休养页面跳转controller
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/mobile/theRapyRecuperation")
|
||||
@Ok("json:full")
|
||||
public class MobileTheRapyRecuperationEnrollController {
|
||||
|
||||
/**
|
||||
* 手机端 首页
|
||||
*/
|
||||
@At("/index")
|
||||
@Ok("beetl:/mobile/therapyRecuperation/index.html")
|
||||
@RequiresAuthentication
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机端 线路列表页面
|
||||
*/
|
||||
@At("/mobileLineListPage")
|
||||
@Ok("beetl:/mobile/therapyRecuperation/lineList.html")
|
||||
@RequiresAuthentication
|
||||
public void mobileLinePage() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机端 线路详情页面
|
||||
*/
|
||||
@At("/lineInfo")
|
||||
@Ok("beetl:/mobile/therapyRecuperation/lineInfo.html")
|
||||
@RequiresAuthentication
|
||||
public void lineInfo() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机端 基地详情页面
|
||||
*/
|
||||
@At("/baseInfo")
|
||||
@Ok("beetl:/mobile/therapyRecuperation/baseManagement.html")
|
||||
@RequiresAuthentication
|
||||
public void baseInfo() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机端 我的疗休养页面
|
||||
*/
|
||||
@At("/myRecuperation")
|
||||
@Ok("beetl:/mobile/therapyRecuperation/myRecuperation.html")
|
||||
@RequiresAuthentication
|
||||
public void myRecuperation() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
package io.v.nutz.zhgh.mobile.trainEducation;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.trainEducation.models.TrainEduVideo;
|
||||
import io.v.nutz.zhgh.trainEducation.models.TrainEduVideoWatchRecord;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.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;
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/trainEducation")
|
||||
@Ok("json:full")
|
||||
public class MTrainEducationController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At
|
||||
@RequiresAuthentication
|
||||
@Ok("beetl:/mobile/trainEducation/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresAuthentication
|
||||
@Ok("beetl:/mobile/trainEducation/AlbumList.html")
|
||||
public void AlbumList() {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresAuthentication
|
||||
@Ok("beetl:/mobile/trainEducation/videoPage.html")
|
||||
public void videoPage() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最新的视频
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getNewestVideo() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tea.*,
|
||||
count( tev.id ) AS videoCount,
|
||||
tet.typeName
|
||||
FROM
|
||||
train_edu_album tea
|
||||
LEFT JOIN train_edu_video tev ON tev.albumId = tea.id
|
||||
LEFT JOIN train_edu_type tet ON tet.id = tea.typeId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(new Static("tea.id = (select albumId from train_edu_video order by createdAt desc LIMIT 0,1)"));
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
return sql.getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个类型下的专辑
|
||||
*
|
||||
* @param typeId
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getAlbumList(@Param(value = "typeId", required = false) String typeId,
|
||||
@Param("pageNumber") Integer pageNumber,
|
||||
@Param("pageSize") Integer pageSize) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tea.*,
|
||||
count( tev.id ) AS videoCount,
|
||||
tet.typeName
|
||||
FROM
|
||||
train_edu_album tea
|
||||
LEFT JOIN train_edu_video tev ON tev.albumId = tea.id
|
||||
LEFT JOIN train_edu_type tet ON tet.id = tea.typeId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tea.typeId", "=", typeId);
|
||||
cnd.groupBy("tea.id");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个专辑的详细信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getAlbumInfo(@Param(value = "id", required = false) String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tea.*,
|
||||
count( tev.id ) AS videoCount,
|
||||
tet.typeName
|
||||
FROM
|
||||
train_edu_album tea
|
||||
LEFT JOIN train_edu_video tev ON tev.albumId = tea.id
|
||||
LEFT JOIN train_edu_type tet ON tet.id = tea.typeId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tea.id", "=", id);
|
||||
cnd.groupBy("tea.id");
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
return (NutMap) sql.getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据专辑获取视频
|
||||
*
|
||||
* @param albumId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getVideoList(@Param(value = "albumId", required = false) String albumId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tev.*,
|
||||
tea.title AS albumTitle,
|
||||
tet.typeName,
|
||||
tea.cover
|
||||
FROM
|
||||
train_edu_video tev
|
||||
LEFT JOIN train_edu_album tea ON tea.id = tev.albumId
|
||||
LEFT JOIN train_edu_type tet ON tet.id = tea.typeId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tev.albumId", "=", albumId);
|
||||
cnd.and("tev.disabled", "=", 0);
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 储存观看记录
|
||||
*
|
||||
* @param videoId 视频ID
|
||||
* @param currentTime 观看时长(秒)
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object addWatchRecord(@Param(value = "videoId", required = false) String videoId,
|
||||
@Param(value = "albumId", required = false) String albumId,
|
||||
@Param(value = "currentTime", required = false) long currentTime) {
|
||||
String userId = (String) ShiroUtil.getPrincipalProperty("id");
|
||||
TrainEduVideo video = dao.fetch(TrainEduVideo.class, Cnd.where("id", "=", videoId));
|
||||
TrainEduVideoWatchRecord thisVideoRecord = dao.fetch(TrainEduVideoWatchRecord.class, Cnd.where("userId", "=", userId).and("videoId", "=", videoId));
|
||||
|
||||
if(Lang.isNotEmpty(thisVideoRecord) && thisVideoRecord.getFinish()){
|
||||
//已看完的就不要更改了
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Lang.isEmpty(thisVideoRecord)) {
|
||||
TrainEduVideoWatchRecord videoWatchRecord = new TrainEduVideoWatchRecord();
|
||||
videoWatchRecord.setVideoId(videoId);
|
||||
videoWatchRecord.setWatchDuration(currentTime);
|
||||
videoWatchRecord.setAlbumId(albumId);
|
||||
videoWatchRecord.setUserId((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
videoWatchRecord.setFinish(video.getFileDuration() == currentTime);
|
||||
dao.insert(videoWatchRecord);
|
||||
} else {
|
||||
Chain updateChain = Chain.make("watchDuration", currentTime);
|
||||
updateChain.add("finish", video.getFileDuration() == currentTime ? 1 : 0);
|
||||
Cnd cnd = Cnd.where("userId", "=", userId).and("videoId", "=", videoId);
|
||||
dao.update(TrainEduVideoWatchRecord.class, updateChain, cnd);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的观看记录
|
||||
*
|
||||
* @param albumId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getMyWatchRecord(@Param(value = "albumId", required = false) String albumId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tevwr.*
|
||||
FROM
|
||||
`train_edu_video_watch_record` tevwr
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tevwr.albumId", "=", albumId);
|
||||
cnd.andEX("tevwr.userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
package io.v.nutz.zhgh.mobile.unioncomment;
|
||||
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentPeoService;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentZbService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentBz;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentPeo;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentResult;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/unioncomment/appraisal")
|
||||
@Ok("json:full")
|
||||
public class MUnionCommentController {
|
||||
|
||||
@Inject
|
||||
private CommentZbService commentZbService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private CommentPeoService commentPeoService;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/unioncomment/appraisal.html")
|
||||
@RequiresAuthentication
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/unioncomment/commentator.html")
|
||||
@RequiresAuthentication
|
||||
public void commentator() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/unioncomment/mine.html")
|
||||
@RequiresAuthentication
|
||||
public void mine() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 民主测评首页展示
|
||||
* @param pageForm
|
||||
* @param annual
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "annual", required = false) String annual) {
|
||||
Sql sql = Sqls.create("SELECT * FROM `comment_zb` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(annual) && Strings.isNotBlank(annual)) {
|
||||
cnd.and("annual", "=", annual);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return commentZbService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取测评内容
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getById(String id) {
|
||||
return commentZbService.khzb(id);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doSubmit(@Param("data") CommentBz[] bzList,
|
||||
@Param("id")String id,
|
||||
@Param("reviewResult") String reviewResult,
|
||||
@Param(value = "evaluatedPersonId",required = false) String evaluatedPersonId,
|
||||
@Param(value = "evaluatedPersonName",required = false) String evaluatedPersonName,
|
||||
@Param(value = "evaluatedPersonType",required = false) String evaluatedPersonType,
|
||||
@Param(value = "presidentOpinions", required = false) String presidentOpinions) {
|
||||
try {
|
||||
CommentPeo peo = new CommentPeo();
|
||||
if (Strings.isNotBlank(evaluatedPersonId)){
|
||||
peo.setEvaluatedPersonId(evaluatedPersonId);
|
||||
peo.setEvaluatedPersonName(evaluatedPersonName);
|
||||
peo.setEvaluatedPersonType(evaluatedPersonType);
|
||||
}
|
||||
peo.setReviewResult(reviewResult);
|
||||
peo.setZbId(id);
|
||||
peo.setReviewTime(DateUtil.getDateTime());
|
||||
peo.setUserId((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
if (Strings.isNotBlank(presidentOpinions)) {
|
||||
peo.setPresidentOpinions(presidentOpinions);
|
||||
}
|
||||
baseService.dao().insert(peo);
|
||||
List<CommentResult> commentResults = new ArrayList<>();
|
||||
for (CommentBz v : bzList) {
|
||||
CommentResult result = new CommentResult();
|
||||
result.setBz_id(v.getId());
|
||||
result.setAssessResult(v.getResultScore());
|
||||
result.setRecommendation(v.getOptions() != null ? v.getOptions() : null);
|
||||
result.setPeo_id(peo.getId());
|
||||
commentResults.add(result);
|
||||
}
|
||||
baseService.dao().insert(commentResults);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断是否测评过
|
||||
* @param id 指标id
|
||||
* @param evaluatedPersonId 被测评人id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
public Object isAssess(@Param("id") String id,
|
||||
@Param(value = "evaluatedPersonId",required = false) String evaluatedPersonId){
|
||||
//主席测评
|
||||
if (Strings.isNotBlank(evaluatedPersonId)){
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("evaluatedPersonId","=",evaluatedPersonId);
|
||||
cnd.and("userId","=",ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.and("zbId","=",id);
|
||||
return Result.success().addData(baseService.dao().count(CommentPeo.class,cnd));
|
||||
}else {//会员评家测评
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
cp.*,
|
||||
cz.annual,
|
||||
cz.assessment,
|
||||
cz.assessmentMode,
|
||||
cz.scoringMode,
|
||||
cz.commentTarget
|
||||
FROM
|
||||
`comment_peo` cp
|
||||
LEFT JOIN `comment_zb` cz ON cz.id = cp.zbId
|
||||
where cp.zbId=@zbId and cp.userId=@userId
|
||||
""").setParam("zbId", id).setParam("userId",ShiroUtil.getPrincipalProperty("id"));
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
NutMap nutMap = list.stream().findFirst().orElse(null);
|
||||
if (Strings.isNotBlank(nutMap.getString("commentTarget")) && "1".equals(nutMap.getString("assessmentMode"))) {
|
||||
return Result.success().addData(1);
|
||||
} else {
|
||||
return Result.success().addData(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 我的测评页面展示
|
||||
* @param pageForm
|
||||
* @param annual
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object onLoad(PageForm pageForm,
|
||||
@Param(value = "annual",required = false)String annual){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
cp.*,
|
||||
cz.annual,
|
||||
cz.assessment,
|
||||
cz.assessmentMode,
|
||||
cz.scoringMode,
|
||||
cz.commentTarget
|
||||
FROM
|
||||
`comment_peo` cp
|
||||
LEFT JOIN `comment_zb` cz ON cz.id = cp.zbId
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.andEX("cz.annual","=",annual);
|
||||
cnd.and("cp.userId","=",ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.desc("cp.reviewTime");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取测评结果信息
|
||||
* @param peoId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getBzById(@Param("peoId") String peoId){
|
||||
return commentPeoService.getBzById(peoId);
|
||||
}
|
||||
|
||||
private static final String GH01 = "9c1f19e385914fef82bc35da7c9ded36";
|
||||
private static final String GH02 = "672b47cfc79c4a77878c0f2cfd5734be";
|
||||
|
||||
/**
|
||||
* 获取分工会主席和副主席
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getPresidents(){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
sr.`name` evaluatedPersonType,
|
||||
GROUP_CONCAT( DISTINCT u.username, '(', sr.`name`, ')' ) presidents
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN `sys_user_role` sur ON u.id = sur.userId
|
||||
LEFT JOIN `sys_role` sr ON sur.roleId = sr.id
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("sr.`id`","in", Lang.array(GH01,GH02));
|
||||
cnd.and("u.unionid","=", Vi.getUnionId());
|
||||
cnd.groupBy("u.id");
|
||||
cnd.asc("u.loginname");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package io.v.nutz.zhgh.mobile.welfare;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.welfare.mode.WelfareProvideMode;
|
||||
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
||||
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubject;
|
||||
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubjectOption;
|
||||
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
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.dao.util.cri.Static;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月13日 14:09:00
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/welfare/list")
|
||||
@Ok("json:full")
|
||||
public class MWelfareController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@Inject
|
||||
private WelfareProjectService welfareProjectService;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/welfare/list/index.html")
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/welfare/list/receive.html")
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public void receive() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/welfare/list/receive_success.html")
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public void receive_success() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/welfare/list/option_desc.html")
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public void option_desc() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询福利列表
|
||||
*
|
||||
* @param pageForm
|
||||
* @param tabName
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public Object pageData(PageForm pageForm, String tabName) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT *,
|
||||
( SELECT count( 1 ) > 0 FROM welfare_project_user_selection WHERE welfareId = welfare_project.id AND selectUserId = @selectUserId ) AS isSelect,
|
||||
( SELECT count( 1 ) > 0 FROM welfare_list WHERE projectId = welfare_project.id AND userId = @selectUserId AND isReceive IS TRUE ) AS isReceive
|
||||
FROM
|
||||
welfare_project
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("selectUserId", ShiroUtil.getPrincipalProperty("id"));
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("isDisabled", "=", 0);
|
||||
SqlExpressionGroup exps = Cnd.exps("conditionStructureId", "is", null);
|
||||
|
||||
if (tabName.equals("ing")) {
|
||||
cnd.and(new Static("((provideTimeStart < '%s' and provideTimeEnd > '%s') or (choiceTimeStart < '%s' and choiceTimeEnd > '%s'))"
|
||||
.formatted(DateUtil.getDateTime(),DateUtil.getDateTime(),DateUtil.getDateTime(),DateUtil.getDateTime())));
|
||||
// cnd.and(Cnd.exps("provideTimeStart", "<", DateUtil.getDateTime()).and("provideTimeEnd", ">", DateUtil.getDateTime()))
|
||||
// .or(Cnd.exps("choiceTimeStart", "<", DateUtil.getDateTime()).and("choiceTimeEnd", ">", DateUtil.getDateTime()));
|
||||
|
||||
/* cnd.and("provideTimeStart", "<", DateUtil.getDateTime());
|
||||
cnd.and("provideTimeEnd", ">", DateUtil.getDateTime());*/
|
||||
} else if (tabName.equals("end")) {
|
||||
cnd.and("provideTimeEnd", "<", DateUtil.getDateTime());
|
||||
}
|
||||
String user_id = (String) ShiroUtil.getPrincipalProperty("id");
|
||||
cnd.and(new Static("id in (select projectId from welfare_list where userId = '%s')".formatted(user_id)));
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = simpleService.list(pageForm, sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(v -> {
|
||||
v.put("isSelect", v.getInt("isSelect") == 1);
|
||||
if (v.getInt("provideMode") == WelfareProvideMode.WELFARE_UNIT.getCode()) {
|
||||
v.put("isSelect", true);
|
||||
}
|
||||
if (v.getInt("provideMode") == WelfareProvideMode.PERSON_CHOICE.getCode() || v.getInt("provideMode") == WelfareProvideMode.PERSONAL.getCode()) {
|
||||
WelfareProjectSubject subject = dao.fetch(WelfareProjectSubject.class, Cnd.where("projectId", "=", v.getString("id")));
|
||||
v.put("gift", subject.getSubjectName());
|
||||
}
|
||||
});
|
||||
return pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个福利信息
|
||||
*
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public Object findOne(String projectId) {
|
||||
return welfareProjectService.projectInfo(projectId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param year
|
||||
* @return java.lang.Object
|
||||
* @description 找出这次福利的上一次福利
|
||||
* @author zhf
|
||||
* @date 2023/2/17 10:48
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public Object getWelfareOneByYear(Integer year) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("year", "=", year);
|
||||
cnd.desc("createdAt");
|
||||
List<WelfareProject> welfareProjects = welfareProjectService.query(cnd);
|
||||
if (Lang.isNotEmpty(welfareProjects) && welfareProjects.size() >= 2) {
|
||||
return welfareProjects.get(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return java.lang.Object
|
||||
* @description 找出福利选项
|
||||
* @author zhf
|
||||
* @date 2023/2/17 11:47
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public Object getFlXx(String id) {
|
||||
return welfareProjectService.dao().fetch(WelfareProjectSubjectOption.class, Cnd.where("id", "=", id));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,438 @@
|
||||
package io.v.nutz.zhgh.mobile.welfare;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.welfare.mode.WelfareProvideMode;
|
||||
import io.v.nutz.zhgh.welfare.model.*;
|
||||
import io.v.nutz.zhgh.zgfw.model.UserSign;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月13日 14:42:00
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/welfare/mine")
|
||||
@Ok("json:full")
|
||||
public class MWelfareMineController {
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/welfare/mine/index.html")
|
||||
@RequiresPermissions("welfare.addressManage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("welfare.addressManage")
|
||||
@Ok("beetl:/mobile/welfare/mine/address.html")
|
||||
public void address() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/welfare/mine/address_edit.html")
|
||||
@RequiresPermissions("welfare.addressManage")
|
||||
public void addressEdit() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/welfare/mine/sign.html")
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public void sign() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/welfare/mine/myWelfare.html")
|
||||
@RequiresPermissions("welfare.mine")
|
||||
public void myWelfare() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存地址
|
||||
*
|
||||
* @param welfareMemberAddress
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("welfare.addressManage")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doSaveUserAddress(WelfareMemberAddress welfareMemberAddress) {
|
||||
try {
|
||||
String userId = StrUtil.isNotBlank(welfareMemberAddress.getUserId()) ? welfareMemberAddress.getUserId() : ShiroUtil.getUserId();
|
||||
if (welfareMemberAddress.isDefault()) {
|
||||
simpleService.dao().update(WelfareMemberAddress.class, Chain.make("isDefault", false), Cnd.where("userId", "=", userId));
|
||||
}
|
||||
welfareMemberAddress.setUserId(userId);
|
||||
simpleService.dao().insertOrUpdate(welfareMemberAddress);
|
||||
return Result.success().addMsg("保存成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.success().addMsg("保存失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("welfare.addressManage")
|
||||
public Object selectUserAddress() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
userName AS `name`,
|
||||
userName ,
|
||||
tel,
|
||||
addressDetail AS address,
|
||||
isDefault,
|
||||
province,
|
||||
city,
|
||||
county
|
||||
FROM
|
||||
`welfare_member_address`
|
||||
WHERE userId = @userId
|
||||
""");
|
||||
sql.setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
return simpleService.listMap(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个地址信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("welfare.addressManage")
|
||||
public Object findOneUserAddress(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
*,
|
||||
userName AS `name`
|
||||
FROM
|
||||
`welfare_member_address`
|
||||
WHERE id = @id
|
||||
""");
|
||||
sql.setParam("id", id);
|
||||
return simpleService.fetch(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地址
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("welfare.addressManage")
|
||||
public Object deleteAddress(String id) {
|
||||
try {
|
||||
simpleService.dao().clear(WelfareMemberAddress.class, Cnd.where("id", "=", id));
|
||||
return Result.success().addMsg("删除成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.success().addMsg("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户签字
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getMySignature(String prefix) {
|
||||
UserSign sign = simpleService.dao().fetch(UserSign.class,
|
||||
Cnd.where("user_id", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.andEX("prefix", "=", prefix));
|
||||
if (Lang.isEmpty(sign)) return new UserSign();
|
||||
return sign;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存用户签字
|
||||
*
|
||||
* @param signData
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object saveMySignature(String signData, String prefix) {
|
||||
UserSign userSign = new UserSign();
|
||||
userSign.setData(signData);
|
||||
userSign.setUser_id((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
userSign.setPrefix(prefix);
|
||||
return simpleService.dao().insertOrUpdate(userSign);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户选择福利
|
||||
*
|
||||
* @param projectId
|
||||
* @param answers
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresRoles("welfareMember")
|
||||
public Object doChoice(String projectId, String answers, String receiveAddress, Boolean isAutoSelect) {
|
||||
Trans.exec(() -> {
|
||||
Dao dao = simpleService.dao();
|
||||
WelfareProject project = dao.fetchLinks(dao.fetch(WelfareProject.class, projectId), "welfareProjectSubjects");
|
||||
|
||||
//删除上次选择的
|
||||
dao.clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId).and("selectUserId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
|
||||
|
||||
if (project.getFlexible() && Lang.isNotEmpty(project.getWelfareProjectSubjects())) {
|
||||
//套餐
|
||||
ArrayList<WelfareUserSelection> insertList = new ArrayList<>();
|
||||
List<NutMap> list = Json.fromJsonAsList(NutMap.class, answers);
|
||||
list.forEach(v -> {
|
||||
List<String> userSelection = v.getList("selection", String.class);
|
||||
userSelection.forEach(s -> {
|
||||
WelfareUserSelection selection = new WelfareUserSelection();
|
||||
selection.setWelfareId(v.getString("projectId"));
|
||||
selection.setSubjectId(v.getString("id"));
|
||||
selection.setSelectUserId((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
selection.setSelectTime(new Date());
|
||||
selection.setSelectOptionId(s);
|
||||
selection.setReceiveAddress(receiveAddress);
|
||||
insertList.add(selection);
|
||||
});
|
||||
});
|
||||
simpleService.dao().insert(insertList);
|
||||
} else {
|
||||
//单礼品
|
||||
WelfareUserSelection selection = new WelfareUserSelection();
|
||||
selection.setWelfareId(projectId);
|
||||
selection.setSelectUserId((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
selection.setSelectTime(new Date());
|
||||
selection.setReceiveAddress(receiveAddress);
|
||||
dao.insert(selection);
|
||||
}
|
||||
simpleService.dao().update(WelfareList.class,
|
||||
Chain.make("isAutoSelect", isAutoSelect).add("isReceive", true),
|
||||
Cnd.where("projectId", "=", projectId)
|
||||
.and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
|
||||
});
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户签收福利
|
||||
*
|
||||
* @param mySignature
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doReceive(String projectId, String mySignature) {
|
||||
Trans.exec(() -> {
|
||||
Dao dao = simpleService.dao();
|
||||
Cnd cnd = Cnd.where("welfareId", "=", projectId).and("selectUserId", "=", io.v.nutz.web.commons.utils.ShiroUtil.getUserId());
|
||||
dao.update(WelfareUserSelection.class, Chain.make("isReceive", true), cnd);
|
||||
|
||||
dao.update(WelfareList.class, Chain.make("isReceive", true), Cnd.where("projectId", "=", projectId).and("userId", "=", io.v.nutz.web.commons.utils.ShiroUtil.getUserId()));
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否领取
|
||||
*
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object isReceive(String projectId) {
|
||||
int count = simpleService.dao().count(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")).and("isReceive", "=", true));
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有选择下次自动选
|
||||
*
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object isAutoSelect(String projectId) {
|
||||
int count = simpleService.dao().count(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")).and("isAutoSelect", "=", true));
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否选择
|
||||
*
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object isChoice(String projectId) {
|
||||
int count = simpleService.dao().count(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")).and("isReceive", "=", true));
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户选择数据
|
||||
*
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUserSelection(String projectId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wpus.id AS selectId,
|
||||
wpus.subjectId,
|
||||
wpus.selectOptionId,
|
||||
wpus.receiveAddress,
|
||||
wpso.optionName
|
||||
FROM
|
||||
`welfare_project_user_selection` wpus
|
||||
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
||||
WHERE
|
||||
welfareId = @projectId
|
||||
AND selectUserId = @userId
|
||||
""");
|
||||
sql.setParam("projectId", projectId);
|
||||
sql.setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
return simpleService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUserSelect(String projectId) {
|
||||
WelfareProject welfareProject = simpleService.dao().fetch(WelfareProject.class, Cnd.where("id", "=", projectId));
|
||||
if (welfareProject.getFlexible()) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
optionName
|
||||
FROM
|
||||
welfare_project_subject_option
|
||||
WHERE
|
||||
id IN (
|
||||
SELECT
|
||||
selectOptionId
|
||||
FROM
|
||||
`welfare_project_user_selection`
|
||||
WHERE
|
||||
welfareId = @projectId
|
||||
AND selectUserId = @userId
|
||||
)
|
||||
ORDER BY
|
||||
optionSort ASC
|
||||
""");
|
||||
sql.setParam("projectId", projectId);
|
||||
sql.setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
List<NutMap> list = simpleService.listMap(sql);
|
||||
return list.stream().map(v -> v.getString("optionName")).collect(Collectors.joining("、"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
return welfareProject.getGift();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 福利券
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getMyWelfare() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wp.*,
|
||||
(select count(1) > 0 from welfare_project_user_selection where welfareId = wp.id and selectUserId = @userId) AS isChoice,
|
||||
(select count(1) > 0 from welfare_project_user_selection where welfareId = wp.id and selectUserId = @userId AND isReceive IS TRUE) AS isReceive
|
||||
FROM
|
||||
welfare_project wp
|
||||
""");
|
||||
sql.setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
List<NutMap> list = simpleService.listMap(sql);
|
||||
|
||||
list.forEach(v -> {
|
||||
v.put("isReceive", v.getInt("isReceive") == 1);
|
||||
|
||||
if (v.getInt("provideMode") == WelfareProvideMode.WELFARE_UNIT.getCode()) {
|
||||
v.put("isReceive", true);
|
||||
}
|
||||
if (v.getInt("provideMode") == 2) {
|
||||
WelfareProjectSubject subject = simpleService.dao().fetch(WelfareProjectSubject.class, Cnd.where("projectId", "=", v.getString("id")));
|
||||
v.put("gift", subject.getSubjectName());
|
||||
}
|
||||
Sql sqlo = Sqls.create("""
|
||||
select optionName from welfare_project_subject_option where id in (
|
||||
select selectOptionId from welfare_project_user_selection where selectUserId = @userid and welfareId = @welfareId
|
||||
)
|
||||
""");
|
||||
sqlo.setParam("userid", ShiroUtil.getPrincipalProperty("id"));
|
||||
sqlo.setParam("welfareId", v.getString("id"));
|
||||
List<NutMap> optionNameList = simpleService.listMap(sqlo);
|
||||
v.setv("optionName", optionNameList.stream().map(x -> x.getString("optionName")).collect(Collectors.joining("、")));
|
||||
|
||||
if (v.getInt("provideMode") == WelfareProvideMode.PERSONAL.getCode()) {
|
||||
Sql courierNumberSql = Sqls.create("select courierNumber from welfare_project_user_selection where welfareId = @welfareId and selectUserId = @userid");
|
||||
courierNumberSql.setParam("welfareId", v.getString("id"));
|
||||
courierNumberSql.setParam("userid", ShiroUtil.getPrincipalProperty("id"));
|
||||
NutMap courierNumberMap = simpleService.fetch(courierNumberSql);
|
||||
if (courierNumberMap == null) {
|
||||
v.setv("courierNumber", "暂无");
|
||||
} else {
|
||||
v.setv("courierNumber", courierNumberMap.getString("courierNumber", "暂无"));
|
||||
}
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package io.v.nutz.zhgh.mobile.wmhd;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/11/17 13:59
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/wmhd/apply")
|
||||
@Ok("json:full")
|
||||
public class WmhdApplyController {
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/wmhd/applyList.html")
|
||||
@RequiresAuthentication
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At()
|
||||
@ViReturn
|
||||
public Object pageData(Integer year, PageForm page) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
u.username
|
||||
FROM
|
||||
hd_wm_xx xx
|
||||
LEFT JOIN sys_user u ON u.id = xx.hdcjr
|
||||
WHERE
|
||||
activityGroupId IN ( SELECT groupId FROM `activity_user_scope` $condition)
|
||||
AND YEAR ( hdkssj )= @year and xx.hdflag=true and xx.hdtype=1
|
||||
""").setParam("year", year);
|
||||
if (!io.v.nutz.web.commons.utils.ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("userId", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package io.v.nutz.zhgh.mobile.wmhd;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/11/24 17:16
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/wmhd/audit")
|
||||
@Ok("json:full")
|
||||
public class WmhdAuditController {
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/wmhd/auditList.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/unionAudit")
|
||||
@Ok("beetl:/mobile/wmhd/unionAudit.html")
|
||||
public void unionAudit() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "isAudit", required = false) boolean isAudit,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "lx", required = false) Integer lx,
|
||||
Integer pageNumber,
|
||||
Integer pageSize) {
|
||||
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname AS 'dwname',
|
||||
u.unionname AS 'ghname',
|
||||
hdlb.lname AS hdlbname,
|
||||
zplb.zname AS zplbname,
|
||||
zt.hdname,
|
||||
state.stateColor,
|
||||
state.stateName
|
||||
FROM
|
||||
hd_wm_sbxx xx
|
||||
LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx
|
||||
LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2
|
||||
LEFT JOIN hd_wm_xx zt ON zt.hdid = xx.hdid
|
||||
LEFT JOIN `user` u ON u.id = xx.hdsbrid
|
||||
LEFT JOIN audit_state state ON state.stateId = xx.auditState
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(xx.hdsbsj)", "=", year);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("xx.hdid", "=", hdid);
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
if (ShiroUtil.hasAnyRoles("H10")) {
|
||||
cnd.and("xx.auditState", "in", isAudit ? "4250,4300,4400" : "4200");
|
||||
} else {
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
cnd.and("xx.auditState", "in", isAudit ? "4100,4150,4200" : "4000");
|
||||
}
|
||||
|
||||
} else {
|
||||
cnd.and("xx.auditState", "in", isAudit ? "4100,4150,4250,4300,4400" : "4000,4200");
|
||||
}
|
||||
cnd.desc("xx.hdsbsj");
|
||||
cnd.desc("u.unionname");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
|
||||
return baseService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
|
||||
@At("/auditHtml")
|
||||
@Ok("re")
|
||||
public String auditHtml(Integer auditState) {
|
||||
if (auditState == 4000 || auditState == 4250) {
|
||||
return "beetl:/mobile/wmhd/unionAudit.html";
|
||||
} else if (auditState == 4200) {
|
||||
return "beetl:/mobile/wmhd/schoolAudit.html";
|
||||
}
|
||||
return "beetl:/mobile/wmhd/viewInfo.html";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package io.v.nutz.zhgh.mobile.wmhd;
|
||||
|
||||
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
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("/mobile/wmhd/list")
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
public class WmhdListController {
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/wmhd/userList.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/view")
|
||||
@Ok("beetl:/mobile/wmhd/viewInfo.html")
|
||||
public void view() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Object findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
u.username,
|
||||
u.loginname,
|
||||
hdlb.lname,
|
||||
hdlb.llocation,
|
||||
zplb.zname
|
||||
FROM
|
||||
`hd_wm_sbxx` xx
|
||||
LEFT JOIN `user` u ON u.id = xx.hdsbrid
|
||||
LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx
|
||||
LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2
|
||||
WHERE xx.id=@id
|
||||
""").setParam("id", id);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package io.v.nutz.zhgh.mobile.znxx;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName MZnxxManageController
|
||||
* @Description 手机端子女信息填报我的填报
|
||||
* @Author zhf
|
||||
* @Date 2023/7/20 10:01
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/znxx/manage")
|
||||
@Ok("json:full")
|
||||
public class MZnxxManageController {
|
||||
|
||||
|
||||
@At("")
|
||||
@RequiresPermissions("zgfw.znxx.apply")
|
||||
@Ok("beetl:/mobile/znxx/applyList.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At("/apply")
|
||||
@RequiresPermissions("zgfw.znxx.apply")
|
||||
@Ok("beetl:/mobile/znxx/apply.html")
|
||||
public void apply() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user