教代会机构成员角色bug
This commit is contained in:
@@ -321,18 +321,38 @@ public class MechanismController {
|
|||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
@RequiresPermissions("sys.jdh.zzjg.mechanism")
|
@RequiresPermissions("sys.jdh.zzjg.mechanism")
|
||||||
public Object updateSf(String jdhid, String userid, String jgid, Integer sf) {
|
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));
|
Jdh_jgcy jgcy = jgcyViService.fetch(Cnd.where("jgid", "=", jgid).and("userid", "=", userid).and("jdhid", "=", jdhid));
|
||||||
MechanismRolesEnum byId = MechanismRolesEnum.getById(jgid);
|
jgcy.setSf(sf);
|
||||||
if (Lang.isNotEmpty(byId)) {
|
jgcyViService.updateIgnoreNull(jgcy);
|
||||||
Chain surChain = Chain.make("roleid", getRoleId(sf, jgid));
|
|
||||||
Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", getRoleId(jgcy.getSf(), jgid))
|
// Jdh_jgcy jgcy = jgcyViService.fetch(Cnd.where("jgid", "=", jgid).and("userid", "=", userid).and("jdhid", "=", jdhid));
|
||||||
.and("jdhid", "=", jdhid);
|
// MechanismRolesEnum byId = MechanismRolesEnum.getById(jgid);
|
||||||
sysUserRoleService.update(surChain, surCnd);
|
// if (Lang.isNotEmpty(byId)) {
|
||||||
}
|
// Chain surChain = Chain.make("roleid", getRoleId(sf, jgid));
|
||||||
Chain cyChain = Chain.make("sf", sf);
|
// Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", getRoleId(jgcy.getSf(), jgid))
|
||||||
jgcyViService.update(cyChain, Cnd.where("userid", "=", userid)
|
// .and("jdhid", "=", jdhid);
|
||||||
.and("jgid", "=", jgid));
|
// 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();
|
sysUserService.clearCache();
|
||||||
sysRoleService.clearCache();
|
sysRoleService.clearCache();
|
||||||
return Result.success();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user