|
|
@@ -69,24 +69,25 @@ import java.util.Iterator;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
- * @desc:企业架构
|
|
|
- * @author:Arison on 2016/10/31
|
|
|
- */
|
|
|
+ * @desc:企业架构
|
|
|
+ * @author:Arison on 2016/10/31
|
|
|
+ */
|
|
|
public class CompanyContactsActivity extends BaseActivity {
|
|
|
|
|
|
private Context ct;
|
|
|
//关键变量
|
|
|
- public static ArrayList<String> tabTitle = new ArrayList<String>(); // 标题
|
|
|
+ public static ArrayList<String> tabTitle = new ArrayList<>(); // 标题
|
|
|
public static Map<String, Object> keystore = new LinkedHashMap<>(); // 标题
|
|
|
-
|
|
|
+
|
|
|
@ViewInject(R.id.lv_saff_list)
|
|
|
public CustomerListView listview;
|
|
|
@ViewInject(R.id.lv_left_list)
|
|
|
public CustomerListView mlistleft;
|
|
|
@ViewInject(R.id.edt_search)
|
|
|
public ClearEditText mEditText;
|
|
|
- String sessionId;
|
|
|
+
|
|
|
|
|
|
private LayoutInflater mInflater;
|
|
|
@ViewInject(R.id.ll_list)
|
|
|
@@ -108,7 +109,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
private DBManager manager;
|
|
|
private DetailItemAdapter adapter;// 左边
|
|
|
private DetailItemAdapter madapter;// 右边
|
|
|
-
|
|
|
+
|
|
|
private final int LOAD_SUCCESS_ALLDATA = 9;
|
|
|
private final int UPDATE_CHANGE_MASTER = 12;
|
|
|
private final int LOAD_SUCCESS_LEAFHRORG = 2;
|
|
|
@@ -116,7 +117,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
private final int LOAD_SUCCESS_LEAFHRORG_RIGHTANDLEFT = 6;
|
|
|
private final int LOAD_SUCCESS_EMPLOYEE = 4;
|
|
|
private final int LOAD_SUCCESS_EMPLOYEEINFO = 3;
|
|
|
-
|
|
|
+
|
|
|
private Handler mHandler = new Handler() {
|
|
|
public void handleMessage(android.os.Message msg) {
|
|
|
HrorgsEntity hEntity;
|
|
|
@@ -224,10 +225,9 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
// progressDialog.dismiss();
|
|
|
//reScrollView.onRefreshComplete();
|
|
|
break;
|
|
|
+ /** @注释:左边栏接收数据 */
|
|
|
case LOAD_SUCCESS_LEAFHRORG:
|
|
|
- /** @注释:左边栏接收数据 */
|
|
|
jsonString = msg.getData().getString("result");
|
|
|
- /// Log.i(TAG, "json:" + jsonString);
|
|
|
initNavigationHSV(tabTitle.size());
|
|
|
new Handler().postDelayed(new Runnable() {
|
|
|
|
|
|
@@ -289,7 +289,6 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
-
|
|
|
hscrollview.smoothScrollTo(5500, 0);
|
|
|
}
|
|
|
}, 10);
|
|
|
@@ -303,7 +302,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
|
|
|
madapter = new DetailItemAdapter(ct, hrorgs);
|
|
|
mlistleft.setAdapter(madapter);
|
|
|
-// ViewUtil.setListViewHeightBasedOnChildren(mlistleft);
|
|
|
+// ViewUtil.setListViewHeightBasedOnChildren(mlistleft);
|
|
|
hrorgs_parent = hrorgs;
|
|
|
if (adapter.getCount() == 0) {
|
|
|
// ViewUtil.ShowMessageTitle(ct, "暂时没有数据!");
|
|
|
@@ -399,7 +398,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -446,7 +445,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
private String next_or_name;//记录下级标题栏的or_id 解决顶部导航栏点击选择问题
|
|
|
|
|
|
public void initListener() {
|
|
|
-
|
|
|
+
|
|
|
rg_nav_content.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
|
@Override
|
|
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
|
@@ -580,7 +579,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
//TODO 下拉过程中,下拉的距离是否足够出发刷新
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
mEditText.addTextChangedListener(new TextWatcher() {
|
|
|
@Override
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
@@ -590,9 +589,9 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
@Override
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
if (!StringUtils.isEmpty(s.toString())) {
|
|
|
- searchData= searchEmployee(s.toString());
|
|
|
- if (!ListUtils.isEmpty(searchData)){
|
|
|
- popupWindow=null;
|
|
|
+ searchData = searchEmployee(s.toString());
|
|
|
+ if (!ListUtils.isEmpty(searchData)) {
|
|
|
+ popupWindow = null;
|
|
|
showPopupWindow(mEditText);
|
|
|
}
|
|
|
}
|
|
|
@@ -606,9 +605,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
private void EnterChatAction(DetailItemAdapter.ModelItem item) {
|
|
|
Friend friendOne = FriendDao.getInstance().getFriend(MyApplication.getInstance().mLoginUser.getUserId(),
|
|
|
@@ -847,31 +844,31 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
|
view = layoutInflater.inflate(R.layout.pop_crm_list, null);
|
|
|
ListView plist = (ListView) view.findViewById(R.id.mList);
|
|
|
- final MySimpleAdapter adapter = new MySimpleAdapter(
|
|
|
+ final MySimpleAdapter adapter = new MySimpleAdapter(
|
|
|
this,
|
|
|
searchData,
|
|
|
R.layout.item_pop_employee,
|
|
|
- new String[]{"item_name","item_sub"}, new int[]{R.id.name_tv,R.id.sub_tv});
|
|
|
+ new String[]{"item_name", "item_sub"}, new int[]{R.id.name_tv, R.id.sub_tv});
|
|
|
plist.setAdapter(adapter);
|
|
|
plist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
Map<String, Object> mMap = (Map<String, Object>) adapter.getItem(position);
|
|
|
- String name= mMap.get("item_name").toString();
|
|
|
- String sub= mMap.get("item_sub").toString();
|
|
|
- String depart= mMap.get("item_depart").toString();
|
|
|
- String pos= mMap.get("item_position").toString();
|
|
|
- String imId= mMap.get("item_imId").toString();
|
|
|
- final String phone= mMap.get("item_phone").toString();
|
|
|
-
|
|
|
-
|
|
|
+ String name = mMap.get("item_name").toString();
|
|
|
+ String sub = mMap.get("item_sub").toString();
|
|
|
+ String depart = mMap.get("item_depart").toString();
|
|
|
+ String pos = mMap.get("item_position").toString();
|
|
|
+ String imId = mMap.get("item_imId").toString();
|
|
|
+ final String phone = mMap.get("item_phone").toString();
|
|
|
+
|
|
|
+
|
|
|
Friend friend = new Friend();
|
|
|
friend.setNickName(name);
|
|
|
friend.setPhone(phone);
|
|
|
friend.setDepart(depart);
|
|
|
friend.setPosition(pos);
|
|
|
friend.setUserId(imId);
|
|
|
- Intent intent = new Intent(ct, BasicInfoActivity.class);
|
|
|
+ Intent intent = new Intent(ct, BasicInfoActivity.class);
|
|
|
intent.putExtra(AppConstant.EXTRA_NICK_CODE, friend.getPhone());
|
|
|
intent.putExtra(AppConstant.EXTRA_USER_ID, friend.getUserId());
|
|
|
intent.putExtra(AppConstant.EXTRA_NICK_NAME, friend.getNickName());
|
|
|
@@ -880,7 +877,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
closePoppupWindow();
|
|
|
}
|
|
|
});
|
|
|
- popupWindow = new PopupWindow(view, windowManager.getDefaultDisplay().getWidth() , windowManager.getDefaultDisplay().getHeight() / 3);
|
|
|
+ popupWindow = new PopupWindow(view, windowManager.getDefaultDisplay().getWidth(), windowManager.getDefaultDisplay().getHeight() / 3);
|
|
|
}
|
|
|
// 使其聚集
|
|
|
popupWindow.setFocusable(true);
|
|
|
@@ -897,7 +894,8 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
popupWindow.setBackgroundDrawable(new BitmapDrawable());
|
|
|
popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
|
popupWindow.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED);
|
|
|
- popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);;
|
|
|
+ popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
|
+ ;
|
|
|
// 显示的位置为:屏幕的宽度的一半-PopupWindow的高度的一半
|
|
|
popupWindow.showAsDropDown(parent, windowManager.getDefaultDisplay().getWidth(), 0);
|
|
|
}
|
|
|
@@ -911,37 +909,38 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
|
|
|
List<Map<String, Object>> searchData;
|
|
|
|
|
|
- public List<Map<String, Object>> searchEmployee(String key){
|
|
|
+ public List<Map<String, Object>> searchEmployee(String key) {
|
|
|
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
|
- Map<String, Object> map = new HashMap<String, Object>();
|
|
|
- String master=CommonUtil.getSharedPreferences(ct,"erp_master");
|
|
|
+ Map<String, Object> map = null;
|
|
|
+ String master = CommonUtil.getSharedPreferences(ct, "erp_master");
|
|
|
+ //select * from employees where em_name like '%优软移动终端部%' or em_position like '%优软移动终端部%' or em_defaultorname like '%优软移动终端部%'
|
|
|
|
|
|
List<EmployeesEntity> eList = manager.select_getEmployee(
|
|
|
- new String[]{"%"+key+"%", master},
|
|
|
- "em_name like ? and whichsys=?");
|
|
|
+ new String[]{"%" + key + "%", master, "%" + key + "%", "%" + key + "%"},
|
|
|
+ "em_name like ? and whichsys=? or em_position like ? or em_defaultorname like ?");
|
|
|
LogUtil.prinlnLongMsg(TAG, JSON.toJSONString(eList));
|
|
|
- if(!ListUtils.isEmpty(eList)){
|
|
|
- for (int i=0;i<eList.size(); i++){
|
|
|
- map = new HashMap<String, Object>();
|
|
|
- map.put("item_name", eList.get(i).getEM_NAME());
|
|
|
- map.put("item_sub",eList.get(i).getEM_DEPART()+">"+eList.get(i).getEM_POSITION());
|
|
|
- map.put("item_depart",eList.get(i).getEM_DEPART());
|
|
|
- map.put("item_position",eList.get(i).getEM_POSITION());
|
|
|
- map.put("item_imId",eList.get(i).getEm_IMID());
|
|
|
- map.put("item_phone",eList.get(i).getEM_MOBILE());
|
|
|
- list.add(map);
|
|
|
- }
|
|
|
- }
|
|
|
- return list;
|
|
|
+ if (!ListUtils.isEmpty(eList)) {
|
|
|
+ for (int i = 0; i < eList.size(); i++) {
|
|
|
+ map = new HashMap<String, Object>();
|
|
|
+ map.put("item_name", eList.get(i).getEM_NAME());
|
|
|
+ map.put("item_sub", eList.get(i).getEM_DEPART() + ">" + eList.get(i).getEM_POSITION());
|
|
|
+ map.put("item_depart", eList.get(i).getEM_DEPART());
|
|
|
+ map.put("item_position", eList.get(i).getEM_POSITION());
|
|
|
+ map.put("item_imId", eList.get(i).getEm_IMID());
|
|
|
+ map.put("item_phone", eList.get(i).getEM_MOBILE());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
public static final int LIST_LEFT_MODE = 0;
|
|
|
public static final int LIST_TOP_MODE = 2;
|
|
|
public static final int LIST_RIGHT_MODE = 1;
|
|
|
|
|
|
/**
|
|
|
- * @注释:右边listView适配器
|
|
|
+ * @注释:右边列表
|
|
|
*/
|
|
|
public class DetailItemAdapter extends BaseAdapter {
|
|
|
private Context ct;
|
|
|
@@ -952,12 +951,12 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
private int selectOrId;
|
|
|
private int typeMode = LIST_RIGHT_MODE;
|
|
|
|
|
|
-
|
|
|
+/*
|
|
|
public DetailItemAdapter(Context ct, List<Hrorgs.HrorgItem> items) {
|
|
|
this.ct = ct;
|
|
|
this.inflater = LayoutInflater.from(ct);
|
|
|
this.lists = items;
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
public DetailItemAdapter(Context ct, Hrorgs object) {
|
|
|
this.ct = ct;
|
|
|
@@ -1042,7 +1041,12 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
// 三种情况
|
|
|
if (lists != null && employees != null) {
|
|
|
if (position < lists.size()) {
|
|
|
- item.tv_name.setText(lists.get(position).getOr_name());
|
|
|
+ int count= lists.get(position).getOr_emcount();
|
|
|
+ if (count==0){
|
|
|
+ item.tv_name.setText(lists.get(position).getOr_name());
|
|
|
+ }else{
|
|
|
+ item.tv_name.setText(lists.get(position).getOr_name()+"("+lists.get(position).getOr_emcount()+")");
|
|
|
+ }
|
|
|
item.or_id = lists.get(position).getOr_id();
|
|
|
item.isleaf = lists.get(position).getOr_isleaf();
|
|
|
item.tv_type.setText("部门");
|
|
|
@@ -1058,9 +1062,21 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
item.tv_type.setVisibility(View.INVISIBLE);
|
|
|
item.add_friend.setVisibility(View.GONE);
|
|
|
item.phone.setVisibility(View.GONE);
|
|
|
+ item.iv_enter.setImageResource(R.drawable.phone);
|
|
|
+ item.iv_enter.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ CommonUtil.phoneAction(ct,employees.get(position - lists.size()).getEm_mobile());
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
} else if (lists != null) {
|
|
|
- item.tv_name.setText(lists.get(position).getOr_name());
|
|
|
+ int count= lists.get(position).getOr_emcount();
|
|
|
+ if (count==0){
|
|
|
+ item.tv_name.setText(lists.get(position).getOr_name());
|
|
|
+ }else{
|
|
|
+ item.tv_name.setText(lists.get(position).getOr_name()+"("+lists.get(position).getOr_emcount()+")");
|
|
|
+ }
|
|
|
item.or_id = lists.get(position).getOr_id();
|
|
|
item.isleaf = lists.get(position).getOr_isleaf();
|
|
|
item.tv_type.setText("部门");
|
|
|
@@ -1076,6 +1092,13 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
item.tv_type.setText("联系人");
|
|
|
item.imid = employees.get(position).getEm_imid();
|
|
|
item.tv_type.setVisibility(View.INVISIBLE);
|
|
|
+ item.iv_enter.setImageResource(R.drawable.phone);
|
|
|
+ item.iv_enter.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ CommonUtil.phoneAction(ct, employees.get(position - lists.size()).getEm_mobile());
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
item.iv_falg.setVisibility(View.GONE);
|
|
|
if (typeMode == LIST_LEFT_MODE) {
|
|
|
@@ -1088,7 +1111,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
} else {
|
|
|
if (typeMode == LIST_TOP_MODE) {
|
|
|
if (item.or_id == selectOrId) {
|
|
|
- Log.i(TAG, "or_id相等。。。。");
|
|
|
+// Log.i(TAG, "or_id相等。。。。");
|
|
|
// convertView.setBackgroundResource(R.drawable.tongcheng_all_bg01);
|
|
|
convertView.setBackgroundColor(Color.parseColor("#f3f3f3"));
|
|
|
} else {
|
|
|
@@ -1115,8 +1138,10 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ /**
|
|
|
+ * @desc:查询列表
|
|
|
+ * @author:Arison on 2016/11/7
|
|
|
+ */
|
|
|
private class MySimpleAdapter extends SimpleAdapter {
|
|
|
|
|
|
/**
|
|
|
@@ -1138,21 +1163,21 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public View getView(final int position, View convertView, ViewGroup parent) {
|
|
|
- convertView=super.getView(position, convertView, parent);
|
|
|
- ImageView phone_img= (ImageView) convertView.findViewById(R.id.phone_img);
|
|
|
- ImageView header_img= (ImageView) convertView.findViewById(R.id.header_img);
|
|
|
- final Map<String, Object> mMap = (Map<String, Object>)getItem(position);
|
|
|
+ public View getView(final int position, View convertView, ViewGroup parent) {
|
|
|
+ convertView = super.getView(position, convertView, parent);
|
|
|
+ ImageView phone_img = (ImageView) convertView.findViewById(R.id.phone_img);
|
|
|
+ ImageView header_img = (ImageView) convertView.findViewById(R.id.header_img);
|
|
|
+ final Map<String, Object> mMap = (Map<String, Object>) getItem(position);
|
|
|
phone_img.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
-
|
|
|
- CommonUtil.phoneAction(mContext,mMap.get("item_phone").toString());
|
|
|
+
|
|
|
+ CommonUtil.phoneAction(mContext, mMap.get("item_phone").toString());
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- AvatarHelper.getInstance().displayAvatar(mMap.get("item_imId").toString(),header_img,true);
|
|
|
+ AvatarHelper.getInstance().displayAvatar(mMap.get("item_imId").toString(), header_img, true);
|
|
|
return convertView;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+}
|