This commit is contained in:
zhengziru
2024-07-26 16:53:41 +08:00
parent ddf52e5e86
commit 1f4284acbf
22 changed files with 518 additions and 442 deletions
@@ -52,8 +52,27 @@ public class SignatureController {
@At
@Ok("json")
@RequiresAuthentication
public Object doSub(String prefix, String id, String base64) {
redisService.setex(prefix + ":" + id, 60 * 10, base64);
public Object doSub(String prefix, String id, String base64, Boolean is_value_base64) {
if (is_value_base64) {
redisService.setex(prefix + ":" + id, 60 * 10, base64);
} else {
String today = DateUtil.today();
String[] split = today.split("-");
String todayPath = "/signature/" + split[0] + "/" + split[1] + "/" + split[2];
String fileName = R.UU32() + ".png";
String fullPath = todayPath + "/" + fileName;
String replaceData = base64.replaceAll("data:image/png;base64,", "");
try (InputStream is = new ByteArrayInputStream(Base64.decode(replaceData))) {
ftpService.upload(todayPath, fileName, is);
redisService.setex(prefix + ":" + id, 60 * 10, fullPath);
} catch (Exception e) {
return Result.error("签字数据上传失败");
}
}
return Result.success();
}
@@ -94,6 +113,7 @@ public class SignatureController {
try (InputStream is = new ByteArrayInputStream(Base64.decode(replaceData))) {
ftpService.upload(todayPath, fileName, is);
} catch (Exception e) {
e.printStackTrace();
return Result.error("签字数据上传失败");
}
@@ -105,11 +125,11 @@ public class SignatureController {
@Ok("void")
@RequiresAuthentication
public void getSignData(String path, HttpServletResponse response) {
try{
try {
response.setContentType("image/jpg");
response.setHeader("Content-Disposition", "attachment;filename=1.png");
ftpService.download(path, response.getOutputStream());
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -175,7 +175,7 @@ public class ActivityUnionManageController {
});
tissue.getCover();
if (tissue.getIsPushHome()!=0) {
if (tissue.getIsPushHome()!= null && tissue.getIsPushHome()!=0) {
mobileHomeService.handle(tissue, "ActivityTissue", "/mobile/activity/unionActivity", tissue.getIsPushHome());
}
@@ -188,7 +188,7 @@ public class ActivityUnionManageController {
@ViReturn
@RequiresPermissions(value = {"activity.union.info", "activity.club.info", "activity.school.info2"}, logical = Logical.OR)
public Object doEdit(@Param("tissue") ActivityTissue tissue) {
if (tissue.getIsPushHome()!=0) {
if (tissue.getIsPushHome()!= null && tissue.getIsPushHome()!=0) {
mobileHomeService.handle(tissue, "ActivityTissue", "/mobile/activity/unionActivity", tissue.getIsPushHome());
} else {
mobileHomeService.delete(tissue.getId());
@@ -108,13 +108,13 @@ public class ActivityReimbursementMineController {
Cnd cnd = Cnd.NEW();
if (!ShiroUtil.hasAnyRoles("sysadmin,wyh02,H10,xghng")) {
SqlExpressionGroup group2 = new SqlExpressionGroup();
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
group2.or("u.unionid", "=", vi.getUnionId());
} else if (ShiroUtil.hasRole("H02")) {
group2.or("scu.clubid", "=", vi.getClubId());
} else {
group2.or("act.user_id", "=", ShiroUtil.getUserId());
}
// if (ShiroUtil.hasAnyRoles("gh01,H04")) {
// group2.or("u.unionid", "=", vi.getUnionId());
// } else if (ShiroUtil.hasRole("H02")) {
// group2.or("scu.clubid", "=", vi.getClubId());
// } else {
// }
group2.or("act.user_id", "=", ShiroUtil.getUserId());
cnd.and(group2);
}
@@ -30,10 +30,10 @@ public class updateSign {
@At
public void update(String sign, String user_id) {
if(StrUtil.isBlank(user_id)){
if (StrUtil.isBlank(user_id)) {
user_id = (String) ShiroUtil.getPrincipalProperty("id");
}
if (Strings.isNotBlank(getMySign())) {
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));
@@ -41,8 +41,21 @@ public class updateSign {
}
@At
public String getMySign() {
List<UserSign> userSigns = userSignService.query(Cnd.NEW().and("user_id", "=", ShiroUtil.getPrincipalProperty("id")));
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();
}
}