教代会机构成员角色bug

This commit is contained in:
那些花儿
2025-08-11 15:28:12 +08:00
parent 7e3bafafb9
commit d647ebd92b
2 changed files with 82 additions and 11 deletions
@@ -321,18 +321,38 @@ public class MechanismController {
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object updateSf(String jdhid, String userid, String jgid, Integer sf) {
Jdh_jgcy jgcy = jgcyViService.fetch(Cnd.where("jgid", "=", jgid).and("userid", "=", userid).and("jdhid", "=", jdhid));
MechanismRolesEnum byId = MechanismRolesEnum.getById(jgid);
if (Lang.isNotEmpty(byId)) {
Chain surChain = Chain.make("roleid", getRoleId(sf, jgid));
Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", getRoleId(jgcy.getSf(), jgid))
.and("jdhid", "=", jdhid);
sysUserRoleService.update(surChain, surCnd);
}
Chain cyChain = Chain.make("sf", sf);
jgcyViService.update(cyChain, Cnd.where("userid", "=", userid)
.and("jgid", "=", jgid));
jgcy.setSf(sf);
jgcyViService.updateIgnoreNull(jgcy);
// Jdh_jgcy jgcy = jgcyViService.fetch(Cnd.where("jgid", "=", jgid).and("userid", "=", userid).and("jdhid", "=", jdhid));
// MechanismRolesEnum byId = MechanismRolesEnum.getById(jgid);
// if (Lang.isNotEmpty(byId)) {
// Chain surChain = Chain.make("roleid", getRoleId(sf, jgid));
// Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", getRoleId(jgcy.getSf(), jgid))
// .and("jdhid", "=", jdhid);
// sysUserRoleService.update(surChain, surCnd);
// }
// Chain cyChain = Chain.make("sf", sf);
// jgcyViService.update(cyChain, Cnd.where("userid", "=", userid)
// .and("jgid", "=", jgid));
MechanismRolesEnum rolesEnum = MechanismRolesEnum.getById(jgid);
String directorRoleId = rolesEnum.getDirectorRoleId();
String viceDirectorRoleId = rolesEnum.getViceDirectorRoleId();
String committeeRoleId = rolesEnum.getCommitteeRoleId();
// 删除
jgcyViService.dao().clear(Sys_user_role.class, Cnd.where("userId", "=", userid).and("roleId", "in", List.of(directorRoleId, viceDirectorRoleId, committeeRoleId)).and("jdhid", "=", jdhid));
// 新增
String roleId = getRoleId(sf, jgid);
Sys_user_role userRole = new Sys_user_role();
userRole.setRoleId(roleId);
userRole.setJdhid(jdhid);
userRole.setUserId(userid);
jgcyViService.dao().insert(userRole);
sysUserService.clearCache();
sysRoleService.clearCache();
return Result.success();
@@ -0,0 +1,51 @@
package io.v.nutz.web.commons.controller;
import org.apache.commons.io.IOUtils;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
/**
* @Author: 1V
* @DateTime: 2020/12/3 8:50
* @Description: TODO
*/
@At("/platform/basics")
@IocBean
@Ok("json")
public class BasicsController {
private static final Log log = Logs.get();
private final String TEMPLATE_PATH = "templates";
/**
* 下载模板文件
*
* @param filePath
* @param fileName
* @param response
*/
@At
public void downloadTemplate(String filePath, String fileName, HttpServletResponse response) throws IOException {
try {
response.setHeader("Content-Disposition", "attachment;filename="
.concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
if (filePath.startsWith("/")) {
filePath = filePath.substring(1);
}
InputStream fin = Thread.currentThread().getContextClassLoader().getResourceAsStream(TEMPLATE_PATH + "/" + filePath);
IOUtils.copy(fin, response.getOutputStream());
} catch (Exception e) {
log.error(e);
}
}
}