123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- package com.sinosoft.em.baobiao.xianlutingyun.dao;
- import java.sql.SQLException;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- import net.sf.json.JSONArray;
- import com.sinosoft.am.org.jdbcUtil.ORGTemplate;
- public class GetSendPeopleDao {
- public ORGTemplate temp = null;
- public BaoBiaoDao dao = null;
- public ReportPlanDao plan = null;
- public GetSendPeopleDao(){
- temp = new ORGTemplate();
- dao = new BaoBiaoDao();
- plan = new ReportPlanDao();
- }
-
- public String getSendPeople(String roleId,String corpId,String wtData){
- String role = "";
- /*String compId = "";*/
- String sql ="";
- List<Map<String,String>> resultList = new ArrayList<Map<String,String>>();
- if("R002105430205".equals(roleId)){
- StringBuilder sb = new StringBuilder();
- StringBuilder s = new StringBuilder();
- String[] typeArr = wtData.split(",");
- for(int i=0;i<typeArr.length;i++){
- s.append("?,");
- }
- s = s.deleteCharAt(s.lastIndexOf(","));
- String getRole = "SELECT DISTINCT ROLE_ID FROM BM_MAPFORREPORT WHERE REPORT_TYPE IN ("+s.toString()+")";
- try {
- List<String> li = temp.getResultList(getRole, wtData+"_needUsein");
- for(int k=0;k<li.size();k++){
- sb.append("?,");
- role += li.get(k)+",";
- }
- sb = sb.deleteCharAt(sb.lastIndexOf(","));
- role = role.substring(0,role.lastIndexOf(","));
- sql = "SELECT DISTINCT A.REAL_NAME,A.MOBILE FROM SYS_USER_INFO A,SYS_DEPARTMENT B,SYS_USER_ROLE_REL C,SYS_ROLE D WHERE A.DEPT_ID = B.DEPT_ID AND "
- + " A.USER_ID = C.USER_ID AND C.ROLE_ID = D.ROLE_ID AND B.CORP_ID = ? AND D.ROLE_ID IN ("+sb.toString()+") AND A.MOBILE IS NOT NULL AND C.IS_DEL = '0'";
- resultList = temp.getSerachResult(sql, corpId,role+"_needUsein");
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }else{
- //String compId = reportDept.split(":")[1].split(";")[1];
- int len = wtData.split(",").length;
- StringBuilder sb = new StringBuilder();
- for(int i=0;i<len;i++){
- sb.append("?,");
- }
- sb = sb.deleteCharAt(sb.lastIndexOf(","));
- sql = "SELECT DISTINCT A.REAL_NAME,A.MOBILE FROM SYS_USER_INFO A,SYS_DEPARTMENT B,SYS_USER_ROLE_REL C,SYS_ROLE D WHERE A.DEPT_ID = B.DEPT_ID AND "
- + "A.USER_ID = C.USER_ID AND C.ROLE_ID = D.ROLE_ID AND B.CORP_ID IN ("+sb.toString()+") AND D.ROLE_ID = ? AND A.MOBILE IS NOT NULL AND C.IS_DEL = '0'";
- try {
- resultList = temp.getSerachResult(sql, wtData+"_needUsein",roleId);
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
-
-
- System.out.println(JSONArray.fromObject(resultList).toString()+"========");
- return JSONArray.fromObject(resultList).toString();
- }
- }
|