package cn.com.taiji.zhongxiao.service; import java.math.BigDecimal; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.inject.Inject; import javax.persistence.EntityManager; import javax.persistence.Query; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Join; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import javax.sql.DataSource; import cn.com.taiji.zhongxiao.domain.TinfoClass; import cn.com.taiji.zhongxiao.domain.TshareApply; import cn.com.taiji.zhongxiao.domain.TshareApplyRepository; import org.apache.commons.codec.digest.DigestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; import org.springframework.data.domain.Sort.Order; import org.springframework.data.jpa.domain.Specification; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import cn.com.taiji.sys.domain.Dept; import cn.com.taiji.sys.domain.DeptRepository; import cn.com.taiji.sys.domain.MenuRepository; import cn.com.taiji.sys.domain.Role; import cn.com.taiji.sys.domain.RoleMenuRepository; import cn.com.taiji.sys.domain.RoleUser; import cn.com.taiji.sys.domain.RoleUserPK; import cn.com.taiji.sys.domain.RoleUserRepository; import cn.com.taiji.sys.domain.User; import cn.com.taiji.sys.domain.UserRepository; import cn.com.taiji.sys.dto.LoginUserDto; import cn.com.taiji.sys.dto.OnlineUserDetail; import cn.com.taiji.sys.dto.OnlineUserDto; import cn.com.taiji.sys.dto.RoleDto; import cn.com.taiji.sys.dto.UserDto; import cn.com.taiji.util.Pagination; import cn.com.taiji.util.SpringUtil; import cn.com.taiji.util.ToolUtil; @Service public class DbdcUserService { private static final Logger log = LoggerFactory.getLogger(DbdcUserService.class); @Value("${admin_id}") String admin_id; @Inject JdbcTemplate jdbcTemplate; @Inject EntityManager em; @Value("${database_type}") String database_type; @Inject DataSource dataSource; @Inject DeptRepository deptRepository; @Autowired NamedParameterJdbcTemplate namedParameterJdbcTemplate; @Inject UserRepository userRepository; @Inject RoleUserRepository roleUserRepository; @Inject DbdcRoleService dbdcRoleService; @Inject RoleMenuRepository roleMenuRepository; @Inject TshareApplyRepository tshareApplyRepository; @Inject MenuRepository menuRepository; @Value("${xsjpg_roleid}") private String xsjpg_roleid; @Value("${sjpz_roleid}") private String sjpz_roleid; @Value("${fwkf_roleid}") private String fwkf_roleid; @Value("${zgbmgl_role}") private String zgbmgl_role; @Value("${bmsh_role}") String bmsh_role; @Value("${zgbmsh_role}") String zgbmsh_role; /** * 修改密码 * * @param userId * @param password */ @Transactional(propagation = Propagation.REQUIRED) public void savePwd(String userId, String password) { password = DigestUtils.sha256Hex(password); this.userRepository.updatePwd(userId, password, ToolUtil.date2Str(new Date(), "yyyy-MM-dd HH:mm:ss")); } public UserDto findById(String id) { if (id == null) { return new UserDto(); } User user = this.userRepository.findOne(id); UserDto dto = new UserDto(); if (user != null) BeanUtils.copyProperties(user, dto); String deptnames = ""; String rolenames = ""; if (dto != null && !ToolUtil.isNull(dto.getUserId())) { for (Dept dept : dto.getDepts()) { deptnames = deptnames + dept.getDeptName() + ","; } for (Role role : dto.getRoles()) { rolenames = rolenames + role.getRoleName() + ","; } } if (rolenames.length() > 0) { rolenames = rolenames.substring(0, rolenames.length() - 1); } if (deptnames.length() > 0) { deptnames = deptnames.substring(0, deptnames.length() - 1); } dto.setDeptnames(deptnames); dto.setRolenames(rolenames); return dto; } @Transactional(propagation = Propagation.REQUIRED) public void deleteUserRoleByUserId(String userId) { List ru = roleUserRepository.findByUserId(userId); for (RoleUser u : ru) { roleUserRepository.delete(u); } } /** * 用户删除 * * @param code */ @Transactional(propagation = Propagation.REQUIRED) public void deleteUser(UserDto code) { User c = new User(); BeanUtils.copyProperties(code, c); userRepository.delete(c); ; } public List findRoleUserByUserId(String userid) { List ru = roleUserRepository.findByUserId(userid); List roleids = new ArrayList(); for (RoleUser r : ru) { String roleid = r.getId().getRoleId(); roleids.add(roleid); } return roleids; } public List findRolemenuByRoleId(String roleid) { List roleids = roleMenuRepository.findMenuIdsByRoleId(roleid); return roleids; } public List findAllUserByRole() { List ru = roleUserRepository.findAll(); List userids = new ArrayList(); for (RoleUser r : ru) { String userid = r.getId().getUserId(); if (!userids.contains(userid)) { userids.add(userid); } } return userids; } public List findRoleByUserId(String id) { List ru = new ArrayList(); List list = new ArrayList(); ru = findRoleUserByUserId(id); for (int i = 0; i < ru.size(); i++) { Role role = dbdcRoleService.findRoleById(ru.get(i).toString()); RoleDto dto = new RoleDto(); BeanUtils.copyProperties(role, dto); list.add(dto); } return list; } public void insertRoleUser(RoleUserPK pk) { String userid = pk.getUserId(); String roleids = pk.getRoleId(); String[] role = roleids.split(","); // role.length for (int i = 0; i < role.length; i++) { if (role[i] != null && !"".equals(role[i])) { pk.setUserId(userid); pk.setRoleId(role[i]); RoleUser ru = new RoleUser(); ru.setId(pk); roleUserRepository.save(ru); } } } public List checkRolestr(String str) { String[] role = str.split(","); List checkrole = new ArrayList(); for (int i = 0; i < role.length; i++) { if (role[i] != null && !"".equals(role[i])) { checkrole.add(role[i]); } } return checkrole; } /** * * @Description: 简要进行方法说明,并对基础数据类型的参数和返回值加以说明 * @param dto * @param page * @return Pagination * @throws @author liujing * @date 2016年7月14日 */ public Pagination findAllUserList(final UserDto pr, Pagination pag, final String deptId, final String roleid, Map searchParameters) { List orders = new ArrayList(); Order order = new Order(Direction.DESC, "updateTime"); Order order1 = new Order(Direction.DESC, "userId"); Order order2 = new Order(Direction.DESC, "userName"); Order order3 = new Order(Direction.ASC, "usertype"); orders.add(order3); orders.add(order); orders.add(order1); orders.add(order2); Sort sort = new Sort(orders); PageRequest request = new PageRequest(pag.getPageCurrentNum() - 1, pag.getPageSize(), sort); Page page; page = userRepository.findAll(new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { List pl = new ArrayList(); if (pr.getLoginName() != null && !"".equals(pr.getLoginName())) { pl.add(cb.like(root.get("loginName"), "%" + pr.getLoginName() + "%")); } if (pr.getUserName() != null && !"".equals(pr.getUserName())) { pl.add(cb.like(root.get("userName"), "%" + pr.getUserName() + "%")); } if (deptId != null) { pl.add(cb.like(root.get("pdeptids"), "%" + deptId + "%")); } if (!ToolUtil.isNull(roleid)) { Join join = root.join("roles"); pl.add(cb.equal(join.get("roleId"), roleid)); } if (!ToolUtil.isNull(pr.getDeptnames())) { Join join2 = root.join("depts"); pl.add(cb.like(join2.get("deptName"), "%" + pr.getDeptnames() + "%")); } return cb.and(pl.toArray(new Predicate[0])); } }, request); List dataList = page.getContent(); List dtolsit = new ArrayList(); for (User u : dataList) { UserDto code = new UserDto(); String deptnames = ""; String rolenames = ""; BeanUtils.copyProperties(u, code); for (Dept dept : code.getDepts()) { deptnames = deptnames + dept.getDeptName() + ","; } for (Role role : code.getRoles()) { rolenames = rolenames + role.getRoleName() + ","; } if (rolenames.length() > 0) { rolenames = rolenames.substring(0, rolenames.length() - 1); } if (deptnames.length() > 0) { deptnames = deptnames.substring(0, deptnames.length() - 1); } code.setDeptnames(deptnames); code.setRolenames(rolenames); dtolsit.add(code); } pag.setPageResult(dtolsit); pag.setPageCount(page.getTotalPages()); pag.setPageTotal((int) page.getTotalElements()); return pag; } /** * * @Description: 更新用户信息 * @param dto void * @throws @author user * @date 2016年7月14日 */ public void updateUser(UserDto dto) { User dt = new User(); BeanUtils.copyProperties(dto, dt); userRepository.saveAndFlush(dt); } /** * * @Description: 后台添加用户 * @param dto void * @throws @author user * @date 2016年7月14日 */ public void userInsert(UserDto dto) { User dt = new User(); BeanUtils.copyProperties(dto, dt); dt.setPassword(dto.getPassword()); userRepository.save(dt); } public String findUserByLoginName(String name) { User user = userRepository.findByLoginName(name); String message = "true"; if (user != null) { message = "false"; } return message; } @SuppressWarnings("unchecked") public Pagination findPaginationBySQL(String sql, List paramList, Pagination page) { List list = new ArrayList(); Query query = em.createQuery(sql); int i = 1; for (Object obj : paramList) { query.setParameter(i++, obj); } int total = query.getResultList().size(); page.setPageTotal(total); if (page.getPageSize() > 0 && page.getPageStartNo() >= 0) { int totalPage = ((int) page.getPageTotal() + page.getPageSize() - 1) / page.getPageSize(); page.setPageCount(totalPage); query.setFirstResult(page.getPageStartNo()); query.setMaxResults(page.getPageSize()); } list = query.getResultList(); page.setPageResult(list); return page; } public UserDto findByLoginName(String loginname) { // TODO Auto-generated method stub UserDto dto = new UserDto(); User user = userRepository.findByLoginName(loginname); if (user != null) { BeanUtils.copyProperties(user, dto); } return dto; } public void updateUserByCid(String loginname, String cid, String company) { userRepository.updateUserByCid(loginname, cid, company); } public String comparePsw(UserDto dto, String oldpsw) { String password = DigestUtils.sha256Hex(oldpsw); String message; if (dto.getPassword().equals(password)) { message = "good"; } else { message = "bad"; } return message; } public void saveDeptUser(String deptid, String userId) { String[] deptids = deptid.split(","); for (String d : deptids) { List> list = jdbcTemplate.queryForList( "select user_id from dept_user where user_id=? and dept_id=?", new Object[] { userId, d }); if (list == null || list.size() == 0) { jdbcTemplate.execute("insert into dept_user(user_id,dept_id) values ('" + userId + "','" + d + "')"); } } } @Transactional public void deleteDeptUser(String deptid, String userId) { String[] deptids = deptid.split(","); for (String d : deptids) { jdbcTemplate.execute("delete from dept_user where user_id ='" + userId + "'"); } } /** * * @Description: 获取deptid的所有父节点id * @param deptid * @return String * @throws @author lijiezhi_pc * @date 2017年12月12日 */ public String getPdeptidsByDeptid(String deptid) { String pdeptids = ""; if ("oracle".equals(database_type)) { List> menuList = jdbcTemplate.queryForList( "select distinct(dept_id) from deptinfo start with instr(?,dept_id)>0 connect by prior parent_id=dept_id order by dept_id ", new Object[] { deptid }); for (Map map : menuList) { pdeptids += map.get("dept_id") + ","; } } else if ("mysql".equals(database_type)) { List> menuList = jdbcTemplate .queryForList("select parent_id from deptinfo where instr('" + deptid + "',dept_id)>0"); while (menuList != null && menuList.size() > 0) { String ids = ""; for (Map map : menuList) { ids = ids + "'" + map.get("parent_id") + "',"; if (!pdeptids.contains(map.get("parent_id") + "")) pdeptids += map.get("parent_id") + ","; } if (!ToolUtil.isNull(ids)) { ids = ids.substring(0, ids.length() - 1); menuList = jdbcTemplate .queryForList("select parent_id from deptinfo where dept_id in (" + ids + ")"); } } pdeptids = pdeptids + deptid + ","; } if (pdeptids.length() > 0) { pdeptids = pdeptids.substring(0, pdeptids.length() - 1); } return pdeptids; } public Pagination findOnlineUserDetailList(UserDto dto, OnlineUserDto onLineUser, LoginUserDto loginUser, Pagination pag) { StringBuffer sql = new StringBuffer( "select q.sessionid,q.login_name,q.last_request,p.ip_addr,p.creation_time,p.max_inactiveinterval,u.user_name from t_online_user q left join t_login_user p on q.sessionid=p.sessionid " + " left join userinfo u on u.login_name=q.login_name where p.creation_time is not null"); List paramList = new ArrayList(); if (!ToolUtil.isNull(dto.getUserName())) { sql.append(" AND u.user_name like '%" + dto.getUserName() + "%'"); } if (!ToolUtil.isNull(dto.getLoginName())) { sql.append(" and q.login_name like '%" + dto.getLoginName() + "%'"); } Object[] args = new Object[] {}; int length = paramList.size(); if (length > 0) { args = new Object[length]; for (int i = 0; i < length; i++) { args[i] = paramList.get(i); } } sql.append(" order by p.creation_time,q.last_request"); pag = pag.findPagination(sql.toString(), pag, args, new RowMapper() { @Override public OnlineUserDetail mapRow(ResultSet rs, int rowNum) throws SQLException { OnlineUserDetail info = new OnlineUserDetail(); OnlineUserDto online = new OnlineUserDto(); LoginUserDto login = new LoginUserDto(); UserDto user = new UserDto(); online.setLastRequest(rs.getString("last_request")); online.setLoginName(rs.getString("login_name")); online.setSessionid(rs.getString("sessionid")); login.setCreationTime(rs.getString("creation_time")); login.setIpAddr(rs.getString("ip_addr")); login.setMaxInactiveInterval(rs.getString("max_inactiveinterval")); login.setSessionid(rs.getString("sessionid")); user.setUserName(rs.getString("user_name")); /* * info.setLogin(login); info.setOnline(online); info.setUser(user); */ info.setSessionid(online.getSessionid()); info.setLoginName(online.getLoginName()); info.setLastRequest(online.getLastRequest()); info.setIpAddr(login.getIpAddr()); info.setCreationTime(login.getCreationTime()); info.setMaxInactiveInterval(login.getMaxInactiveInterval()); info.setUserName(user.getUserName()); info.setStatus("在线"); return info; } }, jdbcTemplate, database_type); return pag; } public void sendMsg() { List> maplist = new ArrayList<>(); maplist = jdbcTemplate.queryForList("select * from T_MESSAGEINFO where state='0'"); for (Map map : maplist) { // try // { // URL u=new URL("http://210.76.72.40/oasms/SMInterface.aspx"); // HttpURLConnection h=(HttpURLConnection)u.openConnection(); // h.setDoOutput(true); // h.setRequestMethod("POST"); //设置为post请求 // h.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); //设置发送数据的类型 // OutputStream out=h.getOutputStream(); // String strMobile = "18933222233"; // String strMsg = URLEncoder.encode("中文 !@#$%^&*()123"); // String postData = "Account=ctgc01&PWD=ctgc01#gdic&Msg1="+strMsg+"&Mobile1="+strMobile; // out.write(postData.getBytes()); // BufferedReader r = new BufferedReader(new InputStreamReader(h.getInputStream())); // String line = r.readLine(); // if(line=="OK") // { // // } // else // { // // } // } // catch(Exception ex) // { // // } jdbcTemplate.update("update T_MESSAGEINFO set state='1' where id=?", map.get("id")); } } public void generateMessageInfo() { List> infolist = new ArrayList>(); List userList = userRepository.findAll(); int length = userList.size(); for (int i = 0; i < length; i++) { User user = userList.get(i); infolist = findReminderinfoByUser(user, ""); if (infolist != null && infolist.size() > 0) { String message = ""; int count = 0; for (Map map : infolist) { count += new BigDecimal(map.get("count") + "").intValue(); message += map.get("message") + ","; } if (!ToolUtil.isNull(message)) { message = "您有" + count + "个待办,其中" + message + "请及时处理!"; jdbcTemplate.update( "insert into t_messageinfo (id,user_id,user_name,phone_num,messageinfo,state,createtime,sendtime) values (?,?,?,?,?,?,?,?)", new Object[] { ToolUtil.getUUID(), user.getUserId(), user.getUserName(), user.getPhoneNum(), message, "0", ToolUtil.date2Str(new Date(), "yyyy-MM-dd HH:mm:ss"), null }); } } } } public List> findReminderinfoByUser(User userInfo, String type) { List> infolist = new ArrayList>(); Set serRole = userInfo.getRoles(); boolean flag = false; boolean flag_bmsh_role = false; boolean flag_zgbmsh_role = false; boolean flag_zgbmgl_role = false; for (Role role : serRole) { if (admin_id.equals(role.getRoleId())) { flag = true; } if (bmsh_role.equals(role.getRoleId())) { flag_bmsh_role = true; } if (zgbmsh_role.equals(role.getRoleId())) { flag_zgbmsh_role = true; } if (zgbmgl_role.equals(role.getRoleId())) { flag_zgbmgl_role = true; } } String deptids = ""; String xzqhcodes = ""; for (Dept dept : userInfo.getDepts()) { deptids = deptids + dept.getDeptId() + ","; xzqhcodes = xzqhcodes + dept.getXzqhcode(); } if ("zc".equals(type)) {// 我的注册 // 代码集注册: /** * select count(1) from t_codeset where creator=? and state in ('1','7') select * count(1) from t_codeset where creator=? and state in * ('2','3','4','5','6','7','8') */ StringBuffer dmjzc = new StringBuffer(""); Map mapdmjzc = new HashMap<>(); StringBuffer dmjzc_zs = new StringBuffer(""); Map mapdmjzc_zs = new HashMap<>(); if (!flag) { dmjzc = new StringBuffer("select count(1) zs from t_codeset where creator=? and state in ('1','7')"); mapdmjzc = jdbcTemplate.queryForMap(dmjzc.toString(), new Object[] { userInfo.getUserId() }); dmjzc_zs = new StringBuffer( "select count(1) zs from t_codeset where creator=? and state in ('2','3','4','5','6','7','8')"); mapdmjzc_zs = jdbcTemplate.queryForMap(dmjzc_zs.toString(), new Object[] { userInfo.getUserId() }); } else { dmjzc = new StringBuffer("select count(1) zs from t_codeset where state in ('1','7')"); mapdmjzc = jdbcTemplate.queryForMap(dmjzc.toString(), new Object[] {}); dmjzc_zs = new StringBuffer( "select count(1) zs from t_codeset where state in ('2','3','4','5','6','7','8')"); mapdmjzc_zs = jdbcTemplate.queryForMap(dmjzc_zs.toString(), new Object[] {}); } Map resultMapdmjzc = new HashMap(); resultMapdmjzc.put("info", "代码集注册:" + mapdmjzc_zs.get("ZS") + "个,待处理代码集注册:" + mapdmjzc.get("ZS") + "个,请到 数据目录->目录规范->代码集注册->我的注册 功能模块进行操作。"); resultMapdmjzc.put("message", mapdmjzc.get("ZS") + "个代码集注册"); resultMapdmjzc.put("count", mapdmjzc.get("ZS")); infolist.add(resultMapdmjzc); /** * 数据元注册: select count(1) from t_datameta where creator=? and state in * ('1','6','7') select count(1) from t_datameta where creator=? */ StringBuffer sjyzc = new StringBuffer(""); Map mapsjyzc = new HashMap<>(); StringBuffer sjyzc_zs = new StringBuffer(""); Map mapsjyzc_zs = new HashMap<>(); if (!flag) { sjyzc = new StringBuffer( "select count(1) zs from t_datameta where creator=? and state in ('1','6','7')"); mapsjyzc = jdbcTemplate.queryForMap(sjyzc.toString(), new Object[] { userInfo.getUserId() }); sjyzc_zs = new StringBuffer("select count(1) zs from t_datameta where creator=?"); mapsjyzc_zs = jdbcTemplate.queryForMap(sjyzc_zs.toString(), new Object[] { userInfo.getUserId() }); } else { sjyzc = new StringBuffer("select count(1) zs from t_datameta where state in ('1','6','7')"); mapsjyzc = jdbcTemplate.queryForMap(sjyzc.toString(), new Object[] {}); sjyzc_zs = new StringBuffer("select count(1) zs from t_datameta "); mapsjyzc_zs = jdbcTemplate.queryForMap(sjyzc_zs.toString(), new Object[] {}); } Map resultMapsjyzc = new HashMap(); resultMapsjyzc.put("info", "数据元注册:" + mapsjyzc_zs.get("ZS") + "个,待处理数据元注册:" + mapsjyzc.get("ZS") + "个,请到 数据目录->目录规范->数据元管理->数据元注册 功能模块进行操作。"); resultMapsjyzc.put("message", mapsjyzc.get("ZS") + "个数据元注册"); resultMapsjyzc.put("count", mapsjyzc.get("ZS")); infolist.add(resultMapsjyzc); /** * 信息类注册: select count(1) zs from t_infoclass where creator=? and inprocess in * ('0','1','2','3') */ StringBuffer xxlzc = new StringBuffer(""); Map mapxxlzc = new HashMap<>(); if (!flag) { xxlzc = new StringBuffer( "select count(1) zs from t_infoclass where creator=? and inprocess in ('0','1','2','3')"); mapxxlzc = jdbcTemplate.queryForMap(xxlzc.toString(), new Object[] { userInfo.getUserId() }); } else { xxlzc = new StringBuffer("select count(1) zs from t_infoclass where inprocess in ('0','1','2','3')"); mapxxlzc = jdbcTemplate.queryForMap(xxlzc.toString(), new Object[] {}); } Map resultMapxxlzc = new HashMap(); resultMapxxlzc.put("info", "信息类注册:" + mapxxlzc.get("ZS") + "个,请到 数据目录->目录规划->信息类管理->信息类注册 功能模块进行操作。"); resultMapxxlzc.put("message", mapxxlzc.get("ZS") + "个信息类注册"); resultMapxxlzc.put("count", mapxxlzc.get("ZS")); infolist.add(resultMapxxlzc); /** * 服务注册: select count(1) zs from t_service_reginfo where creator=? and inprocess * in ('0','1','2','3') and isbg='0' */ StringBuffer fwzc = new StringBuffer(""); Map mapfwzc = new HashMap<>(); if (!flag) { fwzc = new StringBuffer( "select count(1) zs from t_service_reginfo where creator=? and inprocess in ('0','1','2','3') and isbg='0'"); mapfwzc = jdbcTemplate.queryForMap(fwzc.toString(), new Object[] { userInfo.getUserId() }); } else { fwzc = new StringBuffer( "select count(1) zs from t_service_reginfo where inprocess in ('0','1','2','3') and isbg='0'"); mapfwzc = jdbcTemplate.queryForMap(fwzc.toString(), new Object[] {}); } Map resultMapfwzc = new HashMap(); resultMapfwzc.put("info", "服务注册:" + mapfwzc.get("ZS") + "个,请到 服务管理->目录规划->服务注册 功能模块进行操作。"); resultMapfwzc.put("message", mapfwzc.get("ZS") + "个服务注册"); resultMapfwzc.put("count", mapfwzc.get("ZS")); infolist.add(resultMapfwzc); return infolist; } else if ("apply".equals(type)) { /** * 已申请资源 select count(1) zs from t_shareapply q,t_infoclass p where * q.tinfoclassid=p.id and q.applyuserid=? */ StringBuffer sqzy = new StringBuffer(""); Map mapsqzy = new HashMap<>(); if (!flag) { sqzy = new StringBuffer( "select count(1) zs from t_shareapply q,t_infoclass p where q.tinfoclassid=p.id and state!='4' and (q.applyuserid=? or instr(?,applydeptid)>0) and q.isrevoke is null"); mapsqzy = jdbcTemplate.queryForMap(sqzy.toString(), new Object[] { userInfo.getUserId(),deptids }); } else { sqzy = new StringBuffer( "select count(1) zs from t_shareapply q,t_infoclass p where q.tinfoclassid=p.id and state!='4'"); mapsqzy = jdbcTemplate.queryForMap(sqzy.toString(), new Object[] {}); } Map resultMapsqzy = new HashMap(); resultMapsqzy.put("info", "已申请资源:" + mapsqzy.get("ZS") + "个,请到 共享管理->共享申请->资源共享申请 功能模块进行操作。"); resultMapsqzy.put("message", mapsqzy.get("ZS") + "个申请资源"); resultMapsqzy.put("count", mapsqzy.get("ZS")); infolist.add(resultMapsqzy); /** * 已申请服务 select count(1) zs from t_service_applyinfo p,t_service_reginfo r where * p.reqid=r.regid and p.inprocess!='4' and p.creator=? */ List paramList2 = new ArrayList(); StringBuffer sqfw = new StringBuffer( "select count(1) zs from t_service_applyinfo p,t_service_reginfo r where p.reqid=r.regid and p.inprocess!='4' "); if(flag_zgbmsh_role) { sqfw.append(" and (p.creator = ? or exists(select dept_id from deptinfo where instr(?,xzqhcode)>0 and dept_id=p.mingchengid)) "); paramList2.add(userInfo.getUserId()); paramList2.add(deptids); } else if(flag_bmsh_role) { sqfw.append(" and (p.creator = ? or instr(?,p.mingchengid)>0) "); paramList2.add(userInfo.getUserId()); paramList2.add(deptids); } else if(!flag) { sqfw.append(" and (p.creator = ?) "); paramList2.add(userInfo.getUserId()); } Object[] args2 = new Object[] {}; int length2 = paramList2.size(); if (length2 > 0) { args2 = new Object[length2]; for (int i = 0; i < length2; i++) { args2[i] = paramList2.get(i); } } Map map = jdbcTemplate.queryForMap(sqfw.toString(), args2); Map resultMap = new HashMap(); resultMap.put("info", "已申请服务:" + map.get("ZS") + "个,请到 服务管理->服务申请->服务调用申请 功能模块进行操作。"); resultMap.put("message", map.get("ZS") + "个申请服务"); resultMap.put("count", map.get("ZS")); infolist.add(resultMap); return infolist; } else if ("ys".equals(type)) { /** * 信息类已审 select count(1) zs from V_HISTASKLIST_T t,t_infoclass p where * t.proinstid=p.processid and p.id=t.busid and t.taskman =? */ StringBuffer xxlys = new StringBuffer(); Map mapxxlys = new HashMap<>(); xxlys = new StringBuffer( "select count(1) zs from V_HISTASKLIST_T t,t_infoclass p where t.proinstid=p.processid and p.id=t.busid and t.taskman =?"); mapxxlys = jdbcTemplate.queryForMap(xxlys.toString(), new Object[] { userInfo.getUserId() }); Map resultMapxxlys = new HashMap(); resultMapxxlys.put("info", "信息类已审:" + mapxxlys.get("ZS") + "个,请到 数据目录->目录规划->信息类管理->我的已审 功能模块进行操作。"); resultMapxxlys.put("message", mapxxlys.get("ZS") + "个信息类已审"); resultMapxxlys.put("count", mapxxlys.get("ZS")); infolist.add(resultMapxxlys); /** * 服务已审 select count(1) zs from V_HISTASKLIST_T t,t_service_reginfo p where * t.proinstid=p.processid and p.regid=t.busid and t.taskman =? */ StringBuffer fwys = new StringBuffer(); Map mapfwys = new HashMap<>(); fwys = new StringBuffer( "select count(1) zs from V_HISTASKLIST_T t,t_service_reginfo p where t.proinstid=p.processid and p.regid=t.busid and t.taskman =?"); mapfwys = jdbcTemplate.queryForMap(fwys.toString(), new Object[] { userInfo.getUserId() }); Map resultMapfwys = new HashMap(); resultMapfwys.put("info", "服务注册已审:" + mapfwys.get("ZS") + "个,请到 服务管理->服务审核->服务注册已审 功能模块进行操作。"); resultMapfwys.put("message", mapfwys.get("ZS") + "个服务注册已审"); resultMapfwys.put("count", mapfwys.get("ZS")); infolist.add(resultMapfwys); /** * 资源申请已审 select count(1) zs from V_HISTASKLIST_T t,t_shareapply p where * t.proinstid=p.processid and p.id=t.busid and t.taskman =? */ StringBuffer zysq = new StringBuffer(); Map mapzysq = new HashMap<>(); zysq = new StringBuffer( "select count(1) zs from V_HISTASKLIST_T t,t_shareapply p where t.proinstid=p.processid and p.id=t.busid and t.taskman =?"); mapzysq = jdbcTemplate.queryForMap(zysq.toString(), new Object[] { userInfo.getUserId() }); Map resultMapzysq = new HashMap(); resultMapzysq.put("info", "资源申请已审:" + mapzysq.get("ZS") + "个,请到 共享管理->共享审核->资源共享已审 功能模块进行操作。"); resultMapzysq.put("message", mapzysq.get("ZS") + "个资源申请已审"); resultMapzysq.put("count", mapzysq.get("ZS")); infolist.add(resultMapzysq); /** * 服务申请已审 select count(1) zs from V_HISTASKLIST_T t,t_service_applyinfo p where * t.proinstid=p.processid and p.applyid=t.busid and t.taskman =? */ StringBuffer fwsq = new StringBuffer(); Map mapfwsq = new HashMap<>(); fwsq = new StringBuffer( "select count(1) zs from V_HISTASKLIST_T t,t_service_applyinfo p where t.proinstid=p.processid and p.applyid=t.busid and t.taskman =?"); mapfwsq = jdbcTemplate.queryForMap(fwsq.toString(), new Object[] { userInfo.getUserId() }); Map resultMapfwsq = new HashMap(); resultMapfwsq.put("info", "服务申请已审:" + mapfwsq.get("ZS") + "个,请到 服务管理->服务审核->服务申请已审 功能模块进行操作。"); resultMapfwsq.put("message", mapfwsq.get("ZS") + "个服务申请已审"); resultMapfwsq.put("count", mapfwsq.get("ZS")); infolist.add(resultMapfwsq); return infolist; } else if ("dy".equals(type)) { /** * 我的订阅 select count(1) zs from subscribemanage t where t.state='1' and * t.createnameid =? */ StringBuffer dy = new StringBuffer( "select count(1) zs from subscribemanage t,t_infoclass p where t.infoclassids=p.id and t.state='1' and t.createnameid =?"); Map map = jdbcTemplate.queryForMap(dy.toString(), new Object[] { userInfo.getUserId() }); Map resultMap = new HashMap(); resultMap.put("info", "订阅资源:" + map.get("ZS") + "个,请到 数据目录->目录规划->信息类管理->我的订阅 功能模块进行操作。"); resultMap.put("message", map.get("ZS") + "个资源订阅"); resultMap.put("count", map.get("ZS")); infolist.add(resultMap); return infolist; } else { if (flag_zgbmsh_role) { Map ty = jdbcTemplate.queryForMap("select count(1) ZS from t_infoclass where disablestate=1 and inprocess='2' and LATESTVERSION='1' and instr(?,xzqhcode)>0", new Object[] {xzqhcodes}); Map resultMapa = new HashMap(); resultMapa.put("info", "您有" + ty.get("ZS") + "个信息类停用申请待审任务,请到 数据目录管理->目录规划->信息类管理->信息类停启 功能模块进行操作。"); resultMapa.put("message", ty.get("ZS") + "个信息类停用申请待审任务"); resultMapa.put("count", ty.get("ZS")); if(ty.get("ZS")!=null&&!"0".equals(String.valueOf(ty.get("ZS")))) infolist.add(resultMapa); } if (flag_zgbmgl_role || flag) { // 到期未停用 List tshareApplyList = tshareApplyRepository.findAll(new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { List pl = new ArrayList(); pl.add(cb.isNull(root.get("isrevoke"))); pl.add(cb.equal(root.get("state"), "2")); pl.add(cb.equal(root.get("actualize"), "2")); return cb.and(pl.toArray(new Predicate[0])); } }); Map resultMapa = new HashMap(); resultMapa.put("info", "您有" + tshareApplyList.size() + "个共享申请任务已到期,共享任务需停止,请到 数据共享管理-> 共享备案 功能模块进行操作。"); resultMapa.put("message", tshareApplyList.size() + "个共享任务需要停止"); resultMapa.put("count", tshareApplyList.size()); if (tshareApplyList.size() > 0) { infolist.add(resultMapa); } // 撤销未停用 tshareApplyList = tshareApplyRepository.findAll(new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { List pl = new ArrayList(); pl.add(cb.isNotNull(root.get("isrevoke"))); pl.add(cb.equal(root.get("state"), "2")); pl.add(cb.equal(root.get("actualize"), "2")); return cb.and(pl.toArray(new Predicate[0])); } }); resultMapa = new HashMap(); resultMapa.put("info", "您有" + tshareApplyList.size() + "个共享申请任务撤销,共享任务需停止,请到 数据共享管理-> 共享备案 功能模块进行操作。"); resultMapa.put("message", tshareApplyList.size() + "个共享任务需要停止"); resultMapa.put("count", tshareApplyList.size()); if (tshareApplyList.size() > 0) { infolist.add(resultMapa); } } List> hasPerssion = jdbcTemplate.queryForList("select m.menu_id from role_user p,ROLE_MENU q,menu m where p.user_id=? and p.ROLE_ID=q.role_id and m.menu_id=q.menu_id and m.MENU_URL=?", new Object[]{userInfo.getUserId(), "/tinfoclass/tinfoclass_hitchImplement"}); if(hasPerssion!=null&&hasPerssion.size()>0) { Map ty = jdbcTemplate.queryForMap("select count(1) ZS from t_infoclass where HITCH_STATUS=1 and inprocess='2' and latestversion='1' and (implementation_state=0 or implementation_state is null)", new Object[] {}); Map resultMapa = new HashMap(); resultMapa.put("info", "您有" + ty.get("ZS") + "个信息类挂接实施任务,请到 数据目录管理->目录规划->信息类管理->挂接实施 功能模块进行操作。"); resultMapa.put("message", ty.get("ZS") + "个信息类挂接实施任务"); resultMapa.put("count", ty.get("ZS")); if(ty.get("ZS")!=null&&!"0".equals(String.valueOf(ty.get("ZS")))) infolist.add(resultMapa); } List paramList = new ArrayList(); StringBuffer sqlBuffer = new StringBuffer( "select count(1)zs from t_service_applyinfo p where p.knowstate='1' and p.inprocess!='4'"); if (flag_zgbmsh_role) { sqlBuffer.append( " and (p.creator = ? or exists(select dept_id from deptinfo where instr(?,xzqhcode)>0 and dept_id=p.mingchengid)) "); paramList.add(userInfo.getUserId()); paramList.add(deptids); } else if (flag_bmsh_role) { sqlBuffer.append(" and (p.creator = ? or instr(?,p.mingchengid)>0) "); paramList.add(userInfo.getUserId()); paramList.add(deptids); } else if (!flag) { sqlBuffer.append(" and (p.creator = ?) "); paramList.add(userInfo.getUserId()); } Object[] args = new Object[] {}; int length = paramList.size(); if (length > 0) { args = new Object[length]; for (int i = 0; i < length; i++) { args[i] = paramList.get(i); } } Map mapa = jdbcTemplate.queryForMap(sqlBuffer.toString(), args); Map resultMapa = new HashMap(); resultMapa.put("info", "您申请的服务接口,现有" + mapa.get("ZS") + "个服务正在变更中,需要进行知悉反馈,请到 服务目录管理->服务申请->服务调用申请 功能模块进行操作。"); resultMapa.put("message", mapa.get("ZS") + "个变更待知悉反馈"); resultMapa.put("count", mapa.get("ZS")); if(mapa.get("ZS")!=null&&!"0".equals(String.valueOf(mapa.get("ZS")))) infolist.add(resultMapa); Map mape = null; if (!flag) { mape = jdbcTemplate.queryForMap( "select count(1)zs from t_shareapply p where p.knowstate='1' and p.state!='4' and (applyuserid=? or instr(?,applydeptid)>0)", new Object[] { userInfo.getUserId(), deptids }); } else { mape = jdbcTemplate.queryForMap( "select count(1)zs from t_shareapply p where p.knowstate='1' and p.state!='4' ", new Object[] {}); } Map resultMape = new HashMap(); resultMape.put("info", "您申请的目录信息,现有" + mape.get("ZS") + "个正在变更中,需要进行知悉反馈,请到 数据共享管理->共享申请->数据共享申请 功能模块进行操作。"); resultMape.put("message", mape.get("ZS") + "个变更待知悉反馈"); resultMape.put("count", mape.get("ZS")); if(mape.get("ZS")!=null&&!"0".equals(String.valueOf(mape.get("ZS")))) infolist.add(resultMape); if (flag_bmsh_role || flag) { StringBuffer sql_tcodeset_check = new StringBuffer( "select count(1) zs from t_codeset p where p.state='2' ");// 代码集审核 Map map = null; if (flag) { map = jdbcTemplate.queryForMap(sql_tcodeset_check.toString(), new Object[] {}); } else { sql_tcodeset_check.append("and instr(?,creator_org)>0"); map = jdbcTemplate.queryForMap(sql_tcodeset_check.toString(), new Object[] { deptids }); } if (map != null && !"0".equals(String.valueOf(map.get("ZS")))) { Map resultMap = new HashMap(); resultMap.put("info", "您有" + map.get("ZS") + "个代码集部门审核任务,请到 数据目录->目录规范->代码集注册->代码集审核 功能模块进行操作。"); resultMap.put("message", map.get("ZS") + "个代码集审核任务"); resultMap.put("count", map.get("ZS")); infolist.add(resultMap); } // 数据元审核待办 Map map1 = null; if (flag) { StringBuffer sql_datameta_check = new StringBuffer( "select count(1) zs from t_datameta p where p.state='2' "); map1 = jdbcTemplate.queryForMap(sql_datameta_check.toString(), new Object[] {}); } else { StringBuffer sql_datameta_check = new StringBuffer( "select count(1) zs from t_datameta p where p.state='2' and instr(?,creator_org)>0"); map1 = jdbcTemplate.queryForMap(sql_datameta_check.toString(), new Object[] { deptids }); } if (map1 != null && !"0".equals(String.valueOf(map1.get("ZS")))) { Map resultMap1 = new HashMap(); resultMap1.put("info", "您有" + map1.get("ZS") + "个数据元审核任务,请到 数据目录->目录规范->数据元管理->数据元审核 功能模块进行操作。"); resultMap1.put("message", map1.get("ZS") + "个数据元审核任务"); resultMap1.put("count", map1.get("ZS")); infolist.add(resultMap1); } } if (flag_zgbmsh_role || flag) { // 主管部门信息类挂接审核 StringBuffer gjcheck = new StringBuffer( " select count(1) zs from t_infoclass where inprocess='2' and LATESTVERSION='1' and (hitch_status=0 or hitch_status is null) and gjcheckstate='1' "); // 主管部门挂接审核 Map mapgj = null; if (flag) { mapgj = jdbcTemplate.queryForMap(gjcheck.toString(), new Object[] {}); } else { gjcheck.append("and instr(?,xzqhcode)>0"); mapgj = jdbcTemplate.queryForMap(gjcheck.toString(), new Object[] { xzqhcodes }); } if (mapgj != null && !"0".equals(String.valueOf(mapgj.get("ZS")))) { Map resultMapzg = new HashMap(); resultMapzg.put("info", "您有" + mapgj.get("ZS") + "个信息类挂接审核任务,请到 数据目录->目录规划->信息类管理->挂接待审 功能模块进行操作。"); resultMapzg.put("message", mapgj.get("ZS") + "个信息类挂接审核任务"); resultMapzg.put("count", mapgj.get("ZS")); infolist.add(resultMapzg); } // 主管部门服务挂接审核 String deptid = "cf6f00caea2c49d68c0ddb132e8f9727";// 网信办 boolean isgjcheckdept = false; for (Dept dept : userInfo.getDepts()) { if (dept.getDeptId().equals(deptid)) { isgjcheckdept = true; } } if (isgjcheckdept) { StringBuffer fwgjcheck = new StringBuffer( " select count(1) zs from t_service_reginfo where latestversion='1' and inprocess='2' and isgj='0' and gjcheckstate='1' "); // 主管部门挂接审核 Map mapfwgj = null; mapfwgj = jdbcTemplate.queryForMap(fwgjcheck.toString(), new Object[] {}); if (mapfwgj != null && !"0".equals(String.valueOf(mapfwgj.get("ZS")))) { Map resultMapzg = new HashMap(); resultMapzg.put("info", "您有" + mapfwgj.get("ZS") + "个服务挂接审核任务,请到 服务目录管理->服务挂接审核 功能模块进行操作。"); resultMapzg.put("message", mapfwgj.get("ZS") + "个服务挂接审核任务"); resultMapzg.put("count", mapfwgj.get("ZS")); infolist.add(resultMapzg); } } StringBuffer sql_tcodeset_zgcheck = new StringBuffer( "select count(1) zs from t_codeset p where p.state='6' ");// 代码集审核 Map mapzg = null; if (flag) { mapzg = jdbcTemplate.queryForMap(sql_tcodeset_zgcheck.toString(), new Object[] {}); } else { sql_tcodeset_zgcheck.append("and instr(?,xzqhcode)>0"); mapzg = jdbcTemplate.queryForMap(sql_tcodeset_zgcheck.toString(), new Object[] { xzqhcodes }); } if (mapzg != null && !"0".equals(String.valueOf(mapzg.get("ZS")))) { Map resultMapzg = new HashMap(); resultMapzg.put("info", "您有" + mapzg.get("ZS") + "个代码集主管部门审核任务,请到 数据目录->目录规范->代码集注册->代码集审核 功能模块进行操作。"); resultMapzg.put("message", mapzg.get("ZS") + "个代码集审核任务"); resultMapzg.put("count", mapzg.get("ZS")); infolist.add(resultMapzg); } // 数据元审核待办 if (!flag) { StringBuffer sql_datameta_check = new StringBuffer( "select count(1) zs from t_datameta p where p.state='5' and instr(?,xzqhcode)>0"); Map map1 = jdbcTemplate.queryForMap(sql_datameta_check.toString(), new Object[] { xzqhcodes }); if (map1 != null && !"0".equals(String.valueOf(map1.get("ZS")))) { Map resultMap1 = new HashMap(); resultMap1.put("info", "您有" + map1.get("ZS") + "个数据元审核任务,请到 数据目录->目录规范->数据元管理->数据元审核 功能模块进行操作。"); resultMap1.put("message", map1.get("ZS") + "个数据元审核任务"); resultMap1.put("count", map1.get("ZS")); infolist.add(resultMap1); } } else { StringBuffer sql_datameta_check = new StringBuffer( "select count(1) zs from t_datameta p where p.state='5'"); Map map1 = jdbcTemplate.queryForMap(sql_datameta_check.toString(), new Object[] {}); if (map1 != null && !"0".equals(String.valueOf(map1.get("ZS")))) { Map resultMap1 = new HashMap(); resultMap1.put("info", "您有" + map1.get("ZS") + "个数据元审核任务,请到 数据目录->目录规范->数据元管理->数据元审核 功能模块进行操作。"); resultMap1.put("message", map1.get("ZS") + "个数据元审核任务"); resultMap1.put("count", map1.get("ZS")); infolist.add(resultMap1); } } } // 信息类待审核 StringBuffer sql_t_infoclass = new StringBuffer( "select count(p.id) zs from v_tasklist t,t_infoclass p where t.PROC_INST_ID=p.processid and p.inprocess!='4' "); Map map2 = null; if (!flag) { sql_t_infoclass.append("and (t.assignee =? or t.candidate=?)"); map2 = jdbcTemplate.queryForMap(sql_t_infoclass.toString(), new Object[] { userInfo.getUserId(), userInfo.getUserId() }); } else { map2 = jdbcTemplate.queryForMap(sql_t_infoclass.toString(), new Object[] {}); } if (map2 != null && !"0".equals(String.valueOf(map2.get("ZS")))) { Map resultMap2 = new HashMap(); resultMap2.put("info", "您有" + map2.get("ZS") + "个信息类注册、变更审核任务,请到 数据目录->目录规划->信息类管理->我的待审 功能模块进行操作。"); resultMap2.put("message", map2.get("ZS") + "个信息类注册、变更审核任务"); resultMap2.put("count", map2.get("ZS")); infolist.add(resultMap2); } // 服务注册待审核 StringBuffer sqlfwzc = new StringBuffer( "select count(1) zs from v_tasklist t,t_service_reginfo p where t.PROC_INST_ID=p.processid and p.inprocess!='4' "); Map mapfwzc = null; if (!flag) { sqlfwzc.append("and (t.assignee =? or t.candidate=?)"); mapfwzc = jdbcTemplate.queryForMap(sqlfwzc.toString(), new Object[] { userInfo.getUserId(), userInfo.getUserId() }); } else { mapfwzc = jdbcTemplate.queryForMap(sqlfwzc.toString(), new Object[] {}); } if (mapfwzc != null && !"0".equals(String.valueOf(mapfwzc.get("ZS")))) { Map resultMapfwzc = new HashMap(); resultMapfwzc.put("info", "您有" + mapfwzc.get("ZS") + "服务注册待审任务,请到 服务管理->服务审核->服务注册审核 功能模块进行操作。"); resultMapfwzc.put("message", mapfwzc.get("ZS") + "个服务注册待审任务"); resultMapfwzc.put("count", mapfwzc.get("ZS")); infolist.add(resultMapfwzc); } // 服务申请待审核 StringBuffer sqlfwsq = new StringBuffer( "select count(1) zs from v_tasklist t,t_service_applyinfo p where t.PROC_INST_ID=p.processid and p.inprocess!='4' "); Map mapfwsq = null; if (!flag) { sqlfwsq.append("and (t.assignee =? or t.candidate=?)"); mapfwsq = jdbcTemplate.queryForMap(sqlfwsq.toString(), new Object[] { userInfo.getUserId(), userInfo.getUserId() }); } else { mapfwsq = jdbcTemplate.queryForMap(sqlfwsq.toString(), new Object[] {}); } if (mapfwsq != null && !"0".equals(String.valueOf(mapfwsq.get("ZS")))) { Map resultMapfwsq = new HashMap(); resultMapfwsq.put("info", "您有" + mapfwsq.get("ZS") + "服务申请待审任务,请到 服务管理->服务审核->服务申请审核 功能模块进行操作。"); resultMapfwsq.put("message", mapfwsq.get("ZS") + "个服务申请待审任务"); resultMapfwsq.put("count", mapfwsq.get("ZS")); infolist.add(resultMapfwsq); } if (flag_bmsh_role) { // 信息类待挂接 StringBuffer sql_t_infoclass_dgj = new StringBuffer( "select count(1) zs from t_infoclass where inprocess='2' and latestversion='1' and (hitch_status='0' or hitch_status is null) and ( creator=? or instr(?,providebmcode)>0) "); Map map3 = jdbcTemplate.queryForMap(sql_t_infoclass_dgj.toString(), new Object[] { userInfo.getUserId(), deptids }); if (map3 != null && !"0".equals(String.valueOf(map3.get("ZS")))) { Map resultMap3 = new HashMap(); resultMap3.put("info", "您有" + map3.get("ZS") + "信息类待挂接,请到 数据目录->目录规划->信息类管理->待挂接列表 功能模块进行操作。"); resultMap3.put("message", map3.get("ZS") + "个信息类待挂接任务"); resultMap3.put("count", map3.get("ZS")); infolist.add(resultMap3); } } // 信息类变更任务 StringBuffer sql_t_infoclass_bgtask = new StringBuffer( "select count(q.id) zs from t_changeapply p,t_infoclass q where p.state='2' and p.tinfoclassid=q.id and q.creator=? and (instr(?,q.providebmcode)>0 or instr(?,q.providecode)>0)"); Map map4 = jdbcTemplate.queryForMap(sql_t_infoclass_bgtask.toString(), new Object[] { userInfo.getUserId(), deptids, deptids }); if (map4 != null && !"0".equals(String.valueOf(map4.get("ZS")))) { Map resultMap4 = new HashMap(); resultMap4.put("info", "您有" + map4.get("ZS") + "个变更任务,请到 数据目录->目录规划->信息类管理->我的变更任务 功能模块进行操作。"); resultMap4.put("message", map4.get("ZS") + "个信息类变更任务"); resultMap4.put("count", map4.get("ZS")); infolist.add(resultMap4); } // 资源共享审核 StringBuffer sql_t_infoclass_zygxsh = new StringBuffer( "select count(1) zs from v_tasklist t,t_shareapply p where t.PROC_INST_ID=p.processid "); Map map7 = null; if (!flag) { sql_t_infoclass_zygxsh.append("and (t.assignee =? or t.candidate=?)"); map7 = jdbcTemplate.queryForMap(sql_t_infoclass_zygxsh.toString(), new Object[] { userInfo.getUserId(), userInfo.getUserId() });// } else { map7 = jdbcTemplate.queryForMap(sql_t_infoclass_zygxsh.toString(), new Object[] {});// } if (map7 != null && !"0".equals(String.valueOf(map7.get("ZS")))) { Map resultMap7 = new HashMap(); resultMap7.put("info", "您有" + map7.get("ZS") + "个资源共享申请待审任务,请到 共享管理->共享审核->资源共享待审 功能模块进行操作。"); resultMap7.put("message", map7.get("ZS") + "个资源共享审核"); resultMap7.put("count", map7.get("ZS")); infolist.add(resultMap7); } } return infolist; } public void deptSynJob() { DataSource dataSource = (DataSource) SpringUtil.getBean("secondaryDataSource"); JdbcTemplate drds = new JdbcTemplate(dataSource); List> maplist = drds.queryForList( "select id dept_id, parent_id,concat(parent_ids,',',id) pdeptids, name dept_name, sort dept_index, code remark,region_code xzqhcode, business_code ywbmcode, zip_code creditno from sys_office where issyn is null"); log.info("maplist==" + maplist.size()); Dept dept = new Dept(); List deptlist = new ArrayList(); Dept pdept = new Dept(); for (Map map : maplist) { drds.update("update sys_office set issyn=? where id=?", new Object[] { "1", map.get("dept_id") }); pdept = deptRepository.findOne(map.get("parent_id") + ""); if (pdept != null && !"".equals(pdept.getDeptId())) { dept = new Dept(); dept.setDeptId(map.get("dept_id") + ""); dept.setParent(pdept); dept.setPdeptids(map.get("pdeptids") + ""); dept.setDeptName(map.get("dept_name") + ""); dept.setDeptIndex(Integer.parseInt(map.get("dept_index") + "")); dept.setRemark(map.get("remark") + ""); dept.setXzqhcode(map.get("xzqhcode") + ""); dept.setYwbmcode(map.get("ywbmcode") + ""); dept.setCreditno(map.get("creditno") + ""); deptlist.add(dept); } } log.info("deptlist==" + deptlist.size()); if (deptlist.size() > 0) deptRepository.save(deptlist); } public String findUserByUserkey(String userkey, String userid) { User user = userRepository.findByUserkey(userkey); String message = "true"; if (user != null && !userid.equals(user.getUserId())) { message = "false"; } return message; } public UserDto findByUserkey(String userkey) { // TODO Auto-generated method stub UserDto dto = new UserDto(); User user = userRepository.findByUserkey(userkey); if (user != null) { BeanUtils.copyProperties(user, dto); } return dto; } }