12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289 |
- 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<RoleUser> 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<String> findRoleUserByUserId(String userid) {
- List<RoleUser> ru = roleUserRepository.findByUserId(userid);
- List<String> roleids = new ArrayList<String>();
- for (RoleUser r : ru) {
- String roleid = r.getId().getRoleId();
- roleids.add(roleid);
- }
- return roleids;
- }
- public List<String> findRolemenuByRoleId(String roleid) {
- List<String> roleids = roleMenuRepository.findMenuIdsByRoleId(roleid);
- return roleids;
- }
- public List<String> findAllUserByRole() {
- List<RoleUser> ru = roleUserRepository.findAll();
- List<String> userids = new ArrayList<String>();
- for (RoleUser r : ru) {
- String userid = r.getId().getUserId();
- if (!userids.contains(userid)) {
- userids.add(userid);
- }
- }
- return userids;
- }
- public List<RoleDto> findRoleByUserId(String id) {
- List<String> ru = new ArrayList<String>();
- List<RoleDto> list = new ArrayList<RoleDto>();
- 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<String> checkRolestr(String str) {
- String[] role = str.split(",");
- List<String> checkrole = new ArrayList<String>();
- 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<UserDto> findAllUserList(final UserDto pr, Pagination<UserDto> pag, final String deptId,
- final String roleid, Map<String, Object> searchParameters) {
- List<Order> orders = new ArrayList<Sort.Order>();
- 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<User> page;
- page = userRepository.findAll(new Specification<User>() {
- @Override
- public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
- List<Predicate> pl = new ArrayList<Predicate>();
- if (pr.getLoginName() != null && !"".equals(pr.getLoginName())) {
- pl.add(cb.like(root.<String>get("loginName"), "%" + pr.getLoginName() + "%"));
- }
- if (pr.getUserName() != null && !"".equals(pr.getUserName())) {
- pl.add(cb.like(root.<String>get("userName"), "%" + pr.getUserName() + "%"));
- }
- if (deptId != null) {
- pl.add(cb.like(root.<String>get("pdeptids"), "%" + deptId + "%"));
- }
- if (!ToolUtil.isNull(roleid)) {
- Join<User, Role> join = root.join("roles");
- pl.add(cb.equal(join.<String>get("roleId"), roleid));
- }
- if (!ToolUtil.isNull(pr.getDeptnames())) {
- Join<User, Dept> join2 = root.join("depts");
- pl.add(cb.like(join2.<String>get("deptName"), "%" + pr.getDeptnames() + "%"));
- }
- return cb.and(pl.toArray(new Predicate[0]));
- }
- }, request);
- List<User> dataList = page.getContent();
- List<UserDto> dtolsit = new ArrayList<UserDto>();
- 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<Map<String, Object>> 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<Map<String, Object>> 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<Map<String, Object>> menuList = jdbcTemplate
- .queryForList("select parent_id from deptinfo where instr('" + deptid + "',dept_id)>0");
- while (menuList != null && menuList.size() > 0) {
- String ids = "";
- for (Map<String, Object> 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<OnlineUserDetail> findOnlineUserDetailList(UserDto dto, OnlineUserDto onLineUser,
- LoginUserDto loginUser, Pagination<OnlineUserDetail> 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<String> paramList = new ArrayList<String>();
- 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<OnlineUserDetail>() {
- @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<Map<String, Object>> maplist = new ArrayList<>();
- maplist = jdbcTemplate.queryForList("select * from T_MESSAGEINFO where state='0'");
- for (Map<String, Object> 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<Map<String, Object>> infolist = new ArrayList<Map<String, Object>>();
- List<User> 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<String, Object> 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<Map<String, Object>> findReminderinfoByUser(User userInfo, String type) {
- List<Map<String, Object>> infolist = new ArrayList<Map<String, Object>>();
- Set<Role> 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<String, Object>();
- resultMapdmjzc.put("info", "代码集注册:<font color=\"red\">" + mapdmjzc_zs.get("ZS") + "</font>个,待处理代码集注册:"
- + mapdmjzc.get("ZS")
- + "个,请到<a href-name=\"我的注册\" href-url=\"/tcodeSet/tcodeSet_list\"> <font color=\"green\">数据目录->目录规范->代码集注册->我的注册</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapsjyzc.put("info", "数据元注册:<font color=\"red\">" + mapsjyzc_zs.get("ZS") + "</font>个,待处理数据元注册:"
- + mapsjyzc.get("ZS")
- + "个,请到<a href-name=\"数据元注册\" href-url=\"/DatametaController/datameta_listzc\"> <font color=\"green\">数据目录->目录规范->数据元管理->数据元注册</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapxxlzc.put("info", "信息类注册:<font color=\"red\">" + mapxxlzc.get("ZS")
- + "</font>个,请到<a href-name=\"信息类注册\" href-url=\"/tinfoclass/tinfoclass_zclist\"> <font color=\"green\">数据目录->目录规划->信息类管理->信息类注册</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapfwzc.put("info", "服务注册:<font color=\"red\">" + mapfwzc.get("ZS")
- + "</font>个,请到<a href-name=\"服务注册\" href-url=\"/reginfo/zclist\"> <font color=\"green\">服务管理->目录规划->服务注册</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapsqzy.put("info", "已申请资源:<font color=\"red\">" + mapsqzy.get("ZS")
- + "</font>个,请到<a href-name=\"资源共享申请\" href-url=\"/tshareApply/tshareApply_list\"> <font color=\"green\">共享管理->共享申请->资源共享申请</font></a> 功能模块进行操作。");
- 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<String> paramList2 = new ArrayList<String>();
- 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<String, Object>();
- resultMap.put("info", "已申请服务:<font color=\"red\">" + map.get("ZS")
- + "</font>个,请到<a href-name=\"服务调用申请\" href-url=\"/reginfo/applylist\"> <font color=\"green\">服务管理->服务申请->服务调用申请</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapxxlys.put("info", "信息类已审:<font color=\"red\">" + mapxxlys.get("ZS")
- + "</font>个,请到<a href-name=\"我的已审\" href-url=\"/tinfoclass/tinfoclass_myyslist\"> <font color=\"green\">数据目录->目录规划->信息类管理->我的已审</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapfwys.put("info", "服务注册已审:<font color=\"red\">" + mapfwys.get("ZS")
- + "</font>个,请到<a href-name=\"服务注册已审\" href-url=\"/reginfo/ysfwchecklist\"> <font color=\"green\">服务管理->服务审核->服务注册已审</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapzysq.put("info", "资源申请已审:<font color=\"red\">" + mapzysq.get("ZS")
- + "</font>个,请到<a href-name=\"资源共享已审\" href-url=\"/tshareApply/tshareApply_yshlist\"> <font color=\"green\">共享管理->共享审核->资源共享已审</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapfwsq.put("info", "服务申请已审:<font color=\"red\">" + mapfwsq.get("ZS")
- + "</font>个,请到<a href-name=\"服务申请已审\" href-url=\"/reginfo/ysapplychecklist\"> <font color=\"green\">服务管理->服务审核->服务申请已审</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMap.put("info", "订阅资源:<font color=\"red\">" + map.get("ZS")
- + "</font>个,请到<a href-name=\"我的订阅\" href-url=\"/tinfoclass/mysubscri\"> <font color=\"green\">数据目录->目录规划->信息类管理->我的订阅</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapa.put("info", "您有<font color=\"red\">" + ty.get("ZS")
- + "</font>个信息类停用申请待审任务,请到<a href-name=\"信息类停启\" href-url=\"/tinfoclass/tinfoclass_tqlist\"> <font color=\"green\">数据目录管理->目录规划->信息类管理->信息类停启</font></a> 功能模块进行操作。");
- 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<TshareApply> tshareApplyList = tshareApplyRepository.findAll(new Specification<TshareApply>() {
- @Override
- public Predicate toPredicate(Root<TshareApply> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
- List<Predicate> pl = new ArrayList<Predicate>();
- pl.add(cb.isNull(root.get("isrevoke")));
- pl.add(cb.equal(root.<String>get("state"), "2"));
- pl.add(cb.equal(root.<String>get("actualize"), "2"));
- return cb.and(pl.toArray(new Predicate[0]));
- }
- });
- Map resultMapa = new HashMap<String, Object>();
- resultMapa.put("info", "您有<font color=\"red\">" + tshareApplyList.size()
- + "</font>个共享申请任务已到期,共享任务需停止,请到<a href-name=\"共享备案\" href-url=\"/tshareApply/tshareApply_balist\"> <font color=\"green\">数据共享管理-> 共享备案</font></a> 功能模块进行操作。");
- resultMapa.put("message", tshareApplyList.size() + "个共享任务需要停止");
- resultMapa.put("count", tshareApplyList.size());
- if (tshareApplyList.size() > 0) {
- infolist.add(resultMapa);
- }
- // 撤销未停用
- tshareApplyList = tshareApplyRepository.findAll(new Specification<TshareApply>() {
- @Override
- public Predicate toPredicate(Root<TshareApply> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
- List<Predicate> pl = new ArrayList<Predicate>();
- pl.add(cb.isNotNull(root.get("isrevoke")));
- pl.add(cb.equal(root.<String>get("state"), "2"));
- pl.add(cb.equal(root.<String>get("actualize"), "2"));
- return cb.and(pl.toArray(new Predicate[0]));
- }
- });
- resultMapa = new HashMap<String, Object>();
- resultMapa.put("info", "您有<font color=\"red\">" + tshareApplyList.size()
- + "</font>个共享申请任务撤销,共享任务需停止,请到<a href-name=\"共享备案\" href-url=\"/tshareApply/tshareApply_balist\"> <font color=\"green\">数据共享管理-> 共享备案</font></a> 功能模块进行操作。");
- resultMapa.put("message", tshareApplyList.size() + "个共享任务需要停止");
- resultMapa.put("count", tshareApplyList.size());
- if (tshareApplyList.size() > 0) {
- infolist.add(resultMapa);
- }
- }
- List<Map<String, Object>> 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<String, Object>();
- resultMapa.put("info", "您有<font color=\"red\">" + ty.get("ZS")
- + "</font>个信息类挂接实施任务,请到<a href-name=\"挂接实施\" href-url=\"/tinfoclass/tinfoclass_hitchImplement\"> <font color=\"green\">数据目录管理->目录规划->信息类管理->挂接实施</font></a> 功能模块进行操作。");
- 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<String> paramList = new ArrayList<String>();
- 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<String, Object>();
- resultMapa.put("info", "您申请的服务接口,现有<font color=\"red\">" + mapa.get("ZS")
- + "</font>个服务正在变更中,需要进行知悉反馈,请到<a href-name=\"服务调用申请\" href-url=\"/reginfo/applylist\"> <font color=\"green\">服务目录管理->服务申请->服务调用申请</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMape.put("info", "您申请的目录信息,现有<font color=\"red\">" + mape.get("ZS")
- + "</font>个正在变更中,需要进行知悉反馈,请到<a href-name=\"数据共享申请\" href-url=\"/tshareApply/tshareApply_list\"> <font color=\"green\">数据共享管理->共享申请->数据共享申请</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMap.put("info", "您有<font color=\"red\">" + map.get("ZS")
- + "</font>个代码集部门审核任务,请到<a href-name=\"代码集审核\" href-url=\"/tcodeSet/tcodeSet_shlist\"> <font color=\"green\">数据目录->目录规范->代码集注册->代码集审核</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMap1.put("info", "您有<font color=\"red\">" + map1.get("ZS")
- + "</font>个数据元审核任务,请到 <a href-name=\"数据元审核\" href-url=\"/DatametaController/datametaaudio_list?description=2,5\"><font color=\"green\">数据目录->目录规范->数据元管理->数据元审核</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapzg.put("info", "您有<font color=\"red\">" + mapgj.get("ZS")
- + "</font>个信息类挂接审核任务,请到<a href-name=\"挂接待审\" href-url=\"/tinfohitchclass/tinfoclass_yslist2\"> <font color=\"green\">数据目录->目录规划->信息类管理->挂接待审</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapzg.put("info", "您有<font color=\"red\">" + mapfwgj.get("ZS")
- + "</font>个服务挂接审核任务,请到<a href-name=\"服务挂接审核\" href-url=\"/reginfo/gjchecklist\"> <font color=\"green\">服务目录管理->服务挂接审核</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapzg.put("info", "您有<font color=\"red\">" + mapzg.get("ZS")
- + "</font>个代码集主管部门审核任务,请到<a href-name=\"代码集审核\" href-url=\"/tcodeSet/tcodeSet_shlist\"> <font color=\"green\">数据目录->目录规范->代码集注册->代码集审核</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMap1.put("info", "您有<font color=\"red\">" + map1.get("ZS")
- + "</font>个数据元审核任务,请到 <a href-name=\"数据元审核\" href-url=\"/DatametaController/datametaaudio_list?description=2,5\"><font color=\"green\">数据目录->目录规范->数据元管理->数据元审核</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMap1.put("info", "您有<font color=\"red\">" + map1.get("ZS")
- + "</font>个数据元审核任务,请到 <a href-name=\"数据元审核\" href-url=\"/DatametaController/datametaaudio_list?description=2,5\"><font color=\"green\">数据目录->目录规范->数据元管理->数据元审核</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMap2.put("info", "您有<font color=\"red\">" + map2.get("ZS")
- + "</font>个信息类注册、变更审核任务,请到<a href-name=\"我的待审\" href-url=\"/tinfoclass/tinfoclass_zcshlist\"> <font color=\"green\">数据目录->目录规划->信息类管理->我的待审</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapfwzc.put("info", "您有<font color=\"red\">" + mapfwzc.get("ZS")
- + "</font>服务注册待审任务,请到<a href-name=\"服务注册审核\" href-url=\"/reginfo/fwchecklist\"> <font color=\"green\">服务管理->服务审核->服务注册审核</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMapfwsq.put("info", "您有<font color=\"red\">" + mapfwsq.get("ZS")
- + "</font>服务申请待审任务,请到<a href-name=\"服务申请审核\" href-url=\"/reginfo/applychecklist\"> <font color=\"green\">服务管理->服务审核->服务申请审核</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMap3.put("info", "您有<font color=\"red\">" + map3.get("ZS")
- + "</font>信息类待挂接,请到<a href-name=\"待挂接列表\" href-url=\"/tinfohitchclass/tinfoclass_yslist0\"> <font color=\"green\">数据目录->目录规划->信息类管理->待挂接列表</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMap4.put("info", "您有<font color=\"red\">" + map4.get("ZS")
- + "</font>个变更任务,请到<a href-name=\"我的变更任务\" href-url=\"/tchangeApply/tchangeApply_tasklist\"> <font color=\"green\">数据目录->目录规划->信息类管理->我的变更任务</font></a> 功能模块进行操作。");
- 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<String, Object>();
- resultMap7.put("info", "您有<font color=\"red\">" + map7.get("ZS")
- + "</font>个资源共享申请待审任务,请到<a href-name=\"资源共享待审\" href-url=\"/tshareApply/tshareApply_shlist\"> <font color=\"green\">共享管理->共享审核->资源共享待审</font></a> 功能模块进行操作。");
- 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<Map<String, Object>> 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<Dept> deptlist = new ArrayList<Dept>();
- Dept pdept = new Dept();
- for (Map<String, Object> 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;
- }
- }
|