Merge branch 'main' of https://dd3skj.picp.vip/zhengziru/zhgh_hrbnu
This commit is contained in:
@@ -30,7 +30,7 @@ import javax.servlet.http.HttpSession;
|
||||
public class LoginUtil {
|
||||
|
||||
public enum LoginOrigin {
|
||||
APP, WEB, WEB_H5, CAS, QI_YE_WEI_XIN, WEI_XIN, SMS_CODE;
|
||||
APP, WEB, WEB_H5, CAS, QI_YE_WEI_XIN, WEI_XIN, WEI_XIN_SUCCESS, SMS_CODE;
|
||||
}
|
||||
|
||||
@Inject
|
||||
|
||||
@@ -126,7 +126,7 @@ public class PwdUtil {
|
||||
// System.out.println(dbPwd);
|
||||
// System.out.println(s);
|
||||
|
||||
String pwd = "123456";
|
||||
String pwd = "002154";
|
||||
String dbPwd = PwdUtil.doSm4CbcEncrypt(pwd);
|
||||
System.out.println(dbPwd);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
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 io.v.nutz.web.commons.slog.SLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
@@ -27,10 +28,7 @@ import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Attr;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
@@ -140,7 +138,7 @@ public class SysWechatController {
|
||||
String loginName = Optional.ofNullable(sysUser).map(Sys_user::getLoginname).orElse(null);
|
||||
|
||||
try {
|
||||
loginUtil.doLogin(loginName, request, session, LoginUtil.LoginOrigin.WEI_XIN);
|
||||
loginUtil.doLogin(loginName, request, session, LoginUtil.LoginOrigin.WEI_XIN_SUCCESS);
|
||||
if (StrUtil.isNotBlank(redirect)) {
|
||||
return ">>:" + redirect;
|
||||
}
|
||||
@@ -151,9 +149,6 @@ public class SysWechatController {
|
||||
} catch (UnknownAccountException e) {
|
||||
request.setAttribute("errMsg", "系统中没有此用户");
|
||||
return ">>:" + Globals.AppDomain + "/error/UnknownAccountError.html";
|
||||
} catch (AuthenticationException e) {
|
||||
request.setAttribute("errMsg", "系统中没有此用户");
|
||||
return ">>:" + Globals.AppDomain + "/error/UnknownAccountError.html";
|
||||
} catch (Exception e) {
|
||||
request.setAttribute("errMsg", "用户名或密码错误");
|
||||
return ">>:" + Globals.AppDomain + "/error/500.html";
|
||||
@@ -162,7 +157,8 @@ public class SysWechatController {
|
||||
|
||||
|
||||
@At
|
||||
@Ok("re")
|
||||
@Ok("json")
|
||||
@Filters(@By(type = PlatformAuthenticationFilter.class))
|
||||
public Result doLogin(@Attr("platformLoginToken") AuthenticationToken token, HttpServletRequest request, HttpSession session, @Param("state") String state) {
|
||||
|
||||
System.out.println(state);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class EasyCredentialsMatch extends HashedCredentialsMatcher {
|
||||
LoginUtil.LoginOrigin loginOrigin = platformCaptchaToken.getLoginOrigin();
|
||||
|
||||
//cas和企业微信实现免密登录
|
||||
if (loginOrigin.equals(LoginUtil.LoginOrigin.CAS) || loginOrigin.equals(LoginUtil.LoginOrigin.QI_YE_WEI_XIN)){
|
||||
if (loginOrigin.equals(LoginUtil.LoginOrigin.CAS) || loginOrigin.equals(LoginUtil.LoginOrigin.QI_YE_WEI_XIN) || loginOrigin.equals(LoginUtil.LoginOrigin.WEI_XIN_SUCCESS)){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class PlatformAuthorizingRealm extends AuthorizingRealm {
|
||||
throw Lang.makeThrow(AuthenticationException.class, "验证码失效,请重新获取");
|
||||
}
|
||||
user = sysUserService.fetch(Cnd.NEW().and("mobile", "=", mobile));
|
||||
}else if (!loginOrigin.equals(LoginUtil.LoginOrigin.CAS) && !loginOrigin.equals(LoginUtil.LoginOrigin.QI_YE_WEI_XIN) && !loginOrigin.equals(LoginUtil.LoginOrigin.WEI_XIN)) {
|
||||
}else if (!loginOrigin.equals(LoginUtil.LoginOrigin.CAS) && !loginOrigin.equals(LoginUtil.LoginOrigin.QI_YE_WEI_XIN) && !loginOrigin.equals(LoginUtil.LoginOrigin.WEI_XIN_SUCCESS)) {
|
||||
validateService.checkCode(key, captcha);
|
||||
if (Strings.isBlank(loginname)) {
|
||||
throw Lang.makeThrow(AuthenticationException.class, "登录账号不可为空");
|
||||
@@ -120,7 +120,7 @@ public class PlatformAuthorizingRealm extends AuthorizingRealm {
|
||||
}
|
||||
|
||||
if (!loginOrigin.equals(LoginUtil.LoginOrigin.CAS) && !loginOrigin.equals(LoginUtil.LoginOrigin.QI_YE_WEI_XIN)
|
||||
&& !loginOrigin.equals(LoginUtil.LoginOrigin.WEI_XIN)) {
|
||||
&& !loginOrigin.equals(LoginUtil.LoginOrigin.WEI_XIN_SUCCESS)) {
|
||||
int errCount = NumberUtils.toInt(Strings.sNull(session.getAttribute("platformErrCount")));
|
||||
if (errCount >= 4) {
|
||||
//输错5次禁用账户10分钟
|
||||
|
||||
+2
-2
@@ -235,7 +235,7 @@ public class ActivityBasicScopeController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H06,H10")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H06,H10,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"H04", "club01"})) {
|
||||
cnd.and("creator", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
@@ -284,7 +284,7 @@ public class ActivityBasicScopeController {
|
||||
addv("is_H04", ShiroUtil.hasRole("H04"));
|
||||
addv("is_H02", ShiroUtil.hasRole("club01"));
|
||||
addv("is_H03", ShiroUtil.hasRole("SchoolUnionMemberAdmin"));
|
||||
addv("is_sysadmin", ShiroUtil.hasRole("sysadmin"));
|
||||
addv("is_sysadmin", ShiroUtil.hasRole("sysadmin,SCHOOL_UNION_SPORTS_ADMIN"));
|
||||
addv("unionid", Vi.getUnionId());
|
||||
}};
|
||||
}
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ public class ActivityBasicUserController {
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
cnd.andEX("aus.creator", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ public class ActivityUnionController {
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.and(searchName, "like", "%" + searchKeyword + "%");
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
cnd.and("gh.id", "=", basicUnit.getUnionid());
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
@@ -233,7 +233,7 @@ public class ActivityUnionController {
|
||||
try {
|
||||
union.setSource("activity");
|
||||
sysUnionService.insert(union);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin.H04")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin.H04,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
sysUnitService.dao().update(ActivityBasicUnit.class, Chain.make("unionid", union.getId()), Cnd.where("id", "=", Vi.getUnit().getId()));
|
||||
}
|
||||
return Result.success();
|
||||
|
||||
+79
-38
@@ -1,10 +1,10 @@
|
||||
package io.v.nutz.zhgh.activity.controller.school;
|
||||
|
||||
import cn.afterturn.easypoi.entity.ImageEntity;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.deepoove.poi.data.PictureType;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
@@ -18,16 +18,14 @@ import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.sys.models.Sys_unit;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.activity.models.*;
|
||||
import io.v.nutz.zhgh.activity.services.ActivitySchoolApplyService;
|
||||
import io.v.nutz.zhgh.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.zhgh.activity.services.ActivitySchoolTeamService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.ddr.poi.html.HtmlRenderPolicy;
|
||||
import org.nutz.aop.interceptor.async.Async;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -46,15 +44,14 @@ import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
@@ -62,6 +59,7 @@ import java.util.stream.Collectors;
|
||||
* @description: 活动报名
|
||||
**/
|
||||
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/apply")
|
||||
@@ -70,23 +68,16 @@ public class ActivityApplyController {
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
protected SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolTeamService activitySchoolTeamService;
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> activitySchoolEventViService;
|
||||
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
@Inject
|
||||
@@ -196,7 +187,7 @@ public class ActivityApplyController {
|
||||
// cnd.and(new Static("now() > school.applyEndTime"));
|
||||
// }
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("H04,sysadmin")) {
|
||||
if (!ShiroUtil.hasAnyRoles("H04,sysadmin,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
cnd.and(new Static("JSON_CONTAINS(school.applyWay,JSON_ARRAY( 1))>0"));
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId=school.activityGroupId AND userId='%s') >0".formatted(ShiroUtil.getUserId())));
|
||||
}
|
||||
@@ -673,7 +664,7 @@ public class ActivityApplyController {
|
||||
""").setParam("unionId", getUnionId()).setParam("userId", ShiroUtil.getUserId());
|
||||
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("H04,sysadmin")) {
|
||||
if (!ShiroUtil.hasAnyRoles("H04,sysadmin,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
cnd.where().andLike("school.applyWay ", "1");
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId=school.activityGroupId AND userId='%s') >0".formatted(ShiroUtil.getUserId())));
|
||||
}
|
||||
@@ -833,15 +824,16 @@ public class ActivityApplyController {
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object dshApplyUserList(
|
||||
@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId) {
|
||||
public Object dshApplyUserList(@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "activityIsAudit", required = false) String activityIsAudit) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asa.id,
|
||||
asa.username,
|
||||
asa.loginname,
|
||||
asa.sex,
|
||||
asa.mobile,
|
||||
asa.identity,
|
||||
asa.`status`,
|
||||
asa.applyUserSign,
|
||||
@@ -849,9 +841,23 @@ public class ActivityApplyController {
|
||||
FROM
|
||||
`activity_school_apply` asa
|
||||
LEFT JOIN sys_user us ON asa.applyUser = us.id
|
||||
WHERE asa.activityId=@activityId and asa.eventId=@eventId and asa.activityUnionId=@activityUnionId
|
||||
ORDER BY asa.applyUser
|
||||
""").setParam("activityId", activityId).setParam("eventId", eventId).setParam("activityUnionId", getUnionId());
|
||||
$condition
|
||||
""");
|
||||
// WHERE
|
||||
// asa.activityId=@activityId and asa.eventId=@eventId and asa.activityUnionId=@activityUnionId
|
||||
// ORDER BY asa.applyUser
|
||||
// .setParam("activityId", activityId).setParam("eventId", eventId).setParam("activityUnionId", getUnionId());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("asa.activityId", "=", activityId);
|
||||
cnd.and("asa.eventId", "=", eventId);
|
||||
cnd.and("asa.activityUnionId", "=", getUnionId());
|
||||
if ("false".equals(activityIsAudit)) {
|
||||
cnd.and("asa.status", "=", 1);
|
||||
} else {
|
||||
cnd.and("asa.status", "!=", 1);
|
||||
}
|
||||
cnd.asc("asa.applyUser");
|
||||
sql.setCondition(cnd);
|
||||
return activitySchoolApplyService.listMap(sql);
|
||||
}
|
||||
|
||||
@@ -888,6 +894,12 @@ public class ActivityApplyController {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载签名告知书
|
||||
* @param activityId
|
||||
* @param response
|
||||
*/
|
||||
@At
|
||||
@Ok(("void"))
|
||||
@RequiresPermissions("activity.apply")
|
||||
@@ -896,26 +908,44 @@ public class ActivityApplyController {
|
||||
ActivitySchool school = simpleService.dao().fetch(ActivitySchool.class, activityId);
|
||||
List<ActivitySchoolApply> schoolApplyList = simpleService.dao().query(ActivitySchoolApply.class,
|
||||
Cnd.where("activityId", "=", activityId)
|
||||
.and("status", "=", 2)
|
||||
.and("status", "=", 2).and("unionId", "=", Vi.getUnionId())
|
||||
.and("applyUserSign", "is not", null));
|
||||
|
||||
List<NutMap> signList = new ArrayList<>();
|
||||
for (int i = 0; i < schoolApplyList.size(); i++) {
|
||||
ActivitySchoolApply apply = schoolApplyList.get(i);
|
||||
ByteArrayOutputStream signOs = new ByteArrayOutputStream();
|
||||
ftpService.download(apply.getApplyUserSign(), signOs);
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(signOs.toByteArray());
|
||||
BufferedImage bufferImg = ImageIO.read(bais);
|
||||
|
||||
/*byte[] bytes = Base64.getDecoder().decode(bufferImg.toByteArray());
|
||||
signList.add(NutMap.NEW().addv("sign", new PictureRenderData(70, 30, ".png", bytes)));*/
|
||||
}
|
||||
List<NutMap> signList = schoolApplyList.stream().map(v -> {
|
||||
try {
|
||||
PictureRenderData image = getImage(v.getApplyUserSign());
|
||||
return NutMap.NEW().setv("image", image);
|
||||
} catch (IOException e) {
|
||||
log.error("下载签名失败", e);
|
||||
return null;
|
||||
}
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("signList", policy).build();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
// 平均分组签字
|
||||
int totalSize = signList.size();
|
||||
// 计算每个子列表的大小
|
||||
int chunkSize = (int) Math.ceil(totalSize / 4.0);
|
||||
|
||||
List<List<NutMap>> collect = IntStream.range(0, 4)
|
||||
.mapToObj(i -> {
|
||||
int start = i * chunkSize;
|
||||
int end = Math.min((i + 1) * chunkSize, totalSize);
|
||||
return start < totalSize ? new ArrayList<>(signList.subList(start, end)) : List.of(NutMap.NEW());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
for (int i = 0; i < collect.size(); i++) {
|
||||
map.put("signList" + i, collect.get(i));
|
||||
}
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("signList0", policy).bind("signList1", policy)
|
||||
.bind("signList2", policy).bind("signList3", policy).build();
|
||||
// HtmlRenderPolicy policy = new HtmlRenderPolicy();
|
||||
// Configure config = Configure.newBuilder().bind("signList", policy).build();
|
||||
map.put("activityName", school.getName());
|
||||
map.put("signList", signList);
|
||||
map.put("dateTime", cn.hutool.core.date.DateUtil.format(new Date(), "yyyy年MM月dd日"));
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String((school.getName() + "自愿参赛责任及风险告知书").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
@@ -923,8 +953,19 @@ public class ActivityApplyController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private PictureRenderData getImage(String base64) throws IOException {
|
||||
if (base64.startsWith("data:")) {
|
||||
String s = base64.split(",")[1];
|
||||
byte[] bytes = Base64.getDecoder().decode(s);
|
||||
return new PictureRenderData(70, 30, ".png", bytes);
|
||||
} else {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
ftpService.download(base64, os);
|
||||
os.close();
|
||||
return new PictureRenderData(70, 30, PictureType.PNG, os.toByteArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -232,7 +232,7 @@ public class ActivityCommonController {
|
||||
app.sex
|
||||
""").setParam("id", id);
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06") && ShiroUtil.hasRole("H04")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN") && ShiroUtil.hasRole("H04")) {
|
||||
sql1.setVar("union", " AND app.unionId = '" + unionid + "' ");
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ public class ActivityCommonController {
|
||||
|
||||
Cnd unionCnd = Cnd.NEW();
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06") && ShiroUtil.hasRole("H04")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN") && ShiroUtil.hasRole("H04")) {
|
||||
unionCnd.and("id", "=", unionid);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ public class ActivityInfoManageController {
|
||||
} else if ("four".equals(query)) {
|
||||
cnd.and(new Static("now() > school.endTime"));
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("school.belongUnionId", "=", Vi.getUnionId());
|
||||
}
|
||||
|
||||
+4
-4
@@ -88,7 +88,7 @@ public class ActivityReadingController {
|
||||
cnd.and("close", "!=", true);
|
||||
cnd.and("YEAR(startTime)", "=", year);
|
||||
cnd.and("activityLevel", "=", activityLevel);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (activityLevel.equals("40002")) {
|
||||
cnd.and("belongUnionId", "=", getUnionId());
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class ActivityReadingController {
|
||||
cnd.and("app.activityId", "=", id);
|
||||
// cnd.and("YEAR(app.applyDate)", "=", year);
|
||||
sql.setCondition(cnd);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (ShiroUtil.hasRole("H04") && activityLevel.equals("40002")) {
|
||||
cnd.and("app.activityUnionId", "=", basicUnit.getUnionid());
|
||||
cnd.and("school.belongUnionId", "=", basicUnit.getUnionid());
|
||||
@@ -150,7 +150,7 @@ public class ActivityReadingController {
|
||||
List<NutMap> apply = new ArrayList();
|
||||
|
||||
Cnd unionCnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
unionCnd.and("id", "=", basicUnit.getUnionid());
|
||||
}
|
||||
@@ -353,7 +353,7 @@ public class ActivityReadingController {
|
||||
}
|
||||
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H10")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H10,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (!user.getUnionid().equals(getUnionId())) {
|
||||
setObj(v.getLoginName() + "此用户不是本工会人员");
|
||||
throw new RuntimeException(v.getLoginName() + "此用户不是本工会人员");
|
||||
|
||||
+1
-1
@@ -214,7 +214,7 @@ public class ActivityRemindController {
|
||||
@ViReturn
|
||||
public Object getActivitys() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("belongUnionId", "=", Vi.getUnionId());
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SiteRecordController {
|
||||
cnd.and("asr.isRetire","=",isRetire);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
cnd.and("asr.reserve_person_unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if (Strings.isNotBlank(time)) {
|
||||
|
||||
@@ -100,7 +100,7 @@ public class SiteReserveController {
|
||||
if (StrUtil.isNotBlank(isRetire)) {
|
||||
cnd.and("asr.isRetire","=",isRetire);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
cnd.and("reserve_person_id", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
if (Strings.isNotBlank(time)) {
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public class SiteUnionProcessController {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("asr.reserve_state", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", 6098);
|
||||
cnd.and("asr.isRetire","=",0);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
cnd.and("reserve_person_unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if (Strings.isNotBlank(time)) {
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ public class ActivityUnionApplyUserController {
|
||||
cnd.where().andLike("tissue.name", name);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("A06,sysadmin")) {
|
||||
if (!ShiroUtil.hasAnyRoles("A06,sysadmin,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId=tissue.groupId AND userId='%s') >0".formatted(ShiroUtil.getUserId())));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -124,7 +124,7 @@ public class ActivityUnionManageController {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT id userId,username userName,loginname loginName,sex,mobile,unitname unitName,unionname unionName FROM `user` $condition
|
||||
""");
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (activity_type == 40002) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
} else if (activity_type == 40003) {
|
||||
@@ -158,7 +158,7 @@ public class ActivityUnionManageController {
|
||||
tissue.setUserId(ShiroUtil.getUserId());
|
||||
}
|
||||
tissue.setApplyTime(DateUtil.getDate());
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
tissue.setState(1);
|
||||
} else {
|
||||
tissue.setState(3);
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ public class ActivityUnionUserStatisticsController {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("atp.tissueId", "=", activityId);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (!tissue.getUserId().equals(ShiroUtil.getUserId())) {
|
||||
if (type == 40002) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
|
||||
+2
-2
@@ -110,13 +110,13 @@ public class ActivityUnionYearSummaryController {
|
||||
str += " left join `user` u on su.userId = u.id";
|
||||
if ("2".equals(summaryFrom)) {
|
||||
str += " left join sys_union un on su.tissueId = un.id";
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06", "SCHOOL_UNION_SPORTS_ADMIN"})) {
|
||||
cnd.and("su.tissueId", "=", Vi.getUnionId());
|
||||
}
|
||||
}
|
||||
if ("3".equals(summaryFrom)) {
|
||||
str += " left join sys_club club on su.tissueId = club.id";
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06", "SCHOOL_UNION_SPORTS_ADMIN"})) {
|
||||
cnd.and("su.tissueId", "=", vi.getClubId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.v.nutz.zhgh.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -17,6 +18,14 @@ public class ActivityMobileSignUpParam {
|
||||
|
||||
private List<String> userIds;
|
||||
|
||||
private List<teamUserInfo> teamUserInfos;
|
||||
|
||||
private String applyUserSign;
|
||||
|
||||
|
||||
@Data
|
||||
public static class teamUserInfo implements Serializable {
|
||||
private String userId;
|
||||
private String mobile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ActivityPlanServiceImpl extends ViServiceImpl<ActivityPlan> impleme
|
||||
cnd.where().andLike("ap.name", name);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H10,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H10,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("tissueId", "in", vi.getMangeUnionStr());
|
||||
} else if (ShiroUtil.hasRole("club01")) {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ActivityTissueServiceImpl extends ViServiceImpl<ActivityTissue> imp
|
||||
cnd.where().andLike("tissue.name", name);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H10,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H10,A06,SCHOOL_UNION_SPORTS_ADMIN")) {
|
||||
cnd.and("tissue.userId", "=", ShiroUtil.getUserId());
|
||||
/* if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("tissue.unionId", "in", vi.getMangeUnionStr());
|
||||
|
||||
+3
-2
@@ -66,6 +66,7 @@ public class mobileActivityListController {
|
||||
@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "applyUserSign", required = false) String applyUserSign,
|
||||
@Param(value = "teamId", required = false) String teamId,
|
||||
@Param(value = "mobile", required = false) String mobile,
|
||||
@Param(value = "teamName", required = false) String teamName) {
|
||||
|
||||
User user = baseService.dao().fetch(User.class, Cnd.where("id", "=", ShiroUtil.getUserId()));
|
||||
@@ -84,7 +85,7 @@ public class mobileActivityListController {
|
||||
schoolApply.setTeam(teamName);
|
||||
schoolApply.setApplyUser(user.getId());
|
||||
schoolApply.setUserId(user.getId());
|
||||
schoolApply.setMobile(user.getMobile());
|
||||
schoolApply.setMobile(mobile);
|
||||
schoolApply.setSex(user.getSex());
|
||||
schoolApply.setUnitId(user.getUnitid());
|
||||
schoolApply.setUnionId(user.getUnionid());
|
||||
@@ -268,7 +269,7 @@ public class mobileActivityListController {
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object doTeamSignUp(ActivityMobileSignUpParam param) {
|
||||
mobileActivityApplyService.doTeamSignUp(param.getActivityId(), param.getUserIds(), param.getEventId(), param.getTeamId(), param.getTeamName(),param.getApplyUserSign());
|
||||
mobileActivityApplyService.doTeamSignUp(param.getActivityId(), param.getUserIds(), param.getEventId(), param.getTeamId(), param.getTeamName(),param.getApplyUserSign(), param.getTeamUserInfos());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+14
-1
@@ -1,11 +1,24 @@
|
||||
package io.v.nutz.zhgh.mobile.activity.Sports.service;
|
||||
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityMobileSignUpParam;
|
||||
import io.v.nutz.zhgh.activity.models.ActivitySchoolApply;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MobileActivityApplyService extends BaseService<ActivitySchoolApply> {
|
||||
void doDeleteApply(String activityId, String eventId);
|
||||
void doTeamSignUp(String activityId, List<String> userIds, String eventId, String teamId, String teamName,String applyUserSign);
|
||||
|
||||
/**
|
||||
* 组队报名
|
||||
* @param activityId
|
||||
* @param userIds
|
||||
* @param eventId
|
||||
* @param teamId
|
||||
* @param teamName
|
||||
* @param applyUserSign
|
||||
* @param teamUserInfos
|
||||
*/
|
||||
void doTeamSignUp(String activityId, List<String> userIds, String eventId, String teamId, String teamName,
|
||||
String applyUserSign, List<ActivityMobileSignUpParam.teamUserInfo> teamUserInfos);
|
||||
}
|
||||
|
||||
+13
-10
@@ -7,19 +7,14 @@ import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.activity.models.*;
|
||||
import io.v.nutz.zhgh.mobile.activity.Sports.service.MobileActivityApplyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.web.filter.mgt.DefaultFilter;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.shiro.web.filter.mgt.DefaultFilter.user;
|
||||
|
||||
/**
|
||||
* @ClassName ActivitySchoolApplyServiceImpl
|
||||
* @Description TODO
|
||||
@@ -39,16 +34,24 @@ public class MobileActivityApplyServiceImpl extends BaseServiceImpl<ActivityScho
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTeamSignUp(String activityId, List<String> userIds, String eventId, String teamId, String teamName, String applyUserSign) {
|
||||
public void doTeamSignUp(String activityId, List<String> userIds, String eventId, String teamId,
|
||||
String teamName, String applyUserSign, List<ActivityMobileSignUpParam.teamUserInfo> teamUserInfos) {
|
||||
List<ActivitySchoolApply> schoolApplyArrayList = new ArrayList<>();
|
||||
userIds.forEach(i -> {
|
||||
ActivitySchoolApply schoolApply = getApply(activityId, eventId, i, teamId, teamName, applyUserSign);
|
||||
|
||||
// userIds.forEach(i -> {
|
||||
// ActivitySchoolApply schoolApply = getApply(activityId, eventId, i, teamId, teamName, applyUserSign);
|
||||
// schoolApplyArrayList.add(schoolApply);
|
||||
// });
|
||||
|
||||
teamUserInfos.forEach( v -> {
|
||||
ActivitySchoolApply schoolApply = getApply(activityId, eventId, v.getUserId(), teamId, teamName, applyUserSign, v.getMobile());
|
||||
schoolApplyArrayList.add(schoolApply);
|
||||
});
|
||||
|
||||
insert(schoolApplyArrayList);
|
||||
}
|
||||
|
||||
public ActivitySchoolApply getApply(String activityId, String eventId, String userId, String teamId, String teamName, String applyUserSign) {
|
||||
public ActivitySchoolApply getApply(String activityId, String eventId, String userId, String teamId, String teamName, String applyUserSign, String mobile) {
|
||||
ActivitySchool activitySchool = dao().fetch(ActivitySchool.class, activityId);
|
||||
User user = dao().fetch(User.class, Cnd.where("id", "=", userId));
|
||||
ActivityBasicUnit basicUnit = dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", user.getUnitid()));
|
||||
@@ -70,7 +73,7 @@ public class MobileActivityApplyServiceImpl extends BaseServiceImpl<ActivityScho
|
||||
schoolApply.setTeam(teamName);
|
||||
schoolApply.setApplyUser(ShiroUtil.getUserId());
|
||||
schoolApply.setUserId(userId);
|
||||
schoolApply.setMobile(user.getMobile());
|
||||
schoolApply.setMobile(mobile);
|
||||
schoolApply.setSex(user.getSex());
|
||||
schoolApply.setUnitId(user.getUnitid());
|
||||
schoolApply.setUnionId(user.getUnionid());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.v.nutz.zhgh.mobile;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.utils.LoginUtil;
|
||||
import io.v.nutz.base.utils.PwdUtil;
|
||||
@@ -21,8 +22,6 @@ import org.apache.shiro.subject.Subject;
|
||||
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.Strings;
|
||||
@@ -127,22 +126,24 @@ public class mobileLoginController {
|
||||
@Param("isFirstLogin") boolean isFirstLogin, @Param("newPwd") String newPwd) {
|
||||
Sys_user user = dao.fetch(Sys_user.class, Cnd.where("id", "=", ShiroUtil.getUserId()));
|
||||
|
||||
if (isFirstLogin) {
|
||||
sourcePwd = user.getLoginname();
|
||||
if (!isFirstLogin) {
|
||||
String userSourcePwd = PwdUtil.doSm4CbcDecrypt(user.getPassword());
|
||||
|
||||
if (!userSourcePwd.equals(sourcePwd)) {
|
||||
return Result.error("原密码错误");
|
||||
}
|
||||
|
||||
if (userSourcePwd.equals(newPwd)) {
|
||||
return Result.error("新密码不能与原密码相同");
|
||||
}
|
||||
}
|
||||
|
||||
String userSourcePwd = PwdUtil.doSm4CbcDecrypt(user.getPassword());
|
||||
|
||||
if (!userSourcePwd.equals(sourcePwd)) {
|
||||
return Result.error("原密码错误");
|
||||
}
|
||||
|
||||
if (userSourcePwd.equals(newPwd)) {
|
||||
return Result.error("新密码不能与原密码相同");
|
||||
if (user.getLoginname().equals(newPwd)) {
|
||||
return Result.error("请勿以工号作为密码");
|
||||
}
|
||||
|
||||
String pwd = PwdUtil.doSm4CbcEncrypt(newPwd);
|
||||
dao.update(Sys_user.class, Chain.make("password", pwd), Cnd.where("id", "=", ShiroUtil.getUserId()));
|
||||
dao.update(Sys_user.class, Chain.make("password", pwd).add("weAppLoginCount", user.getWeAppLoginCount() + 1), Cnd.where("id", "=", ShiroUtil.getUserId()));
|
||||
|
||||
sysUserService.deleteCacheAndUpdate(ShiroUtil.getUserId());
|
||||
return Result.success("修改成功");
|
||||
@@ -156,10 +157,11 @@ public class mobileLoginController {
|
||||
@At
|
||||
@RequiresAuthentication
|
||||
public Object checkIsFirstLogin(){
|
||||
Sql sql = Sqls.create("select weAppLoginCount from sys_user where id = @userId").setParam("userId", ShiroUtil.getUserId());
|
||||
sql.setCallback(Sqls.callback.integer());
|
||||
dao.execute(sql);
|
||||
int count = sql.getInt();
|
||||
return count == 0 ? Result.error() : Result.success();
|
||||
Sys_user user = dao.fetch(Sys_user.class, Cnd.where("id", "=", ShiroUtil.getUserId()));
|
||||
if ((user.getWeAppLoginCount() == null || user.getWeAppLoginCount() == 1) && StrUtil.isNotBlank(user.getOpenId())) {
|
||||
return Result.error();
|
||||
} else {
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user