|
@@ -3,24 +3,35 @@ package com.uas.appme.other.activity;
|
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.Bitmap;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
|
|
+import android.widget.TextView;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baidu.aip.excep.utils.Base64Util;
|
|
import com.baidu.aip.excep.utils.Base64Util;
|
|
|
|
|
+import com.common.LogUtil;
|
|
|
import com.common.data.JSONUtil;
|
|
import com.common.data.JSONUtil;
|
|
|
import com.common.data.ListUtils;
|
|
import com.common.data.ListUtils;
|
|
|
import com.core.base.BaseActivity;
|
|
import com.core.base.BaseActivity;
|
|
|
import com.core.utils.CommonUtil;
|
|
import com.core.utils.CommonUtil;
|
|
|
|
|
+import com.me.imageloader.ImageLoaderUtil;
|
|
|
import com.modular.apputils.listener.OnSmartHttpListener;
|
|
import com.modular.apputils.listener.OnSmartHttpListener;
|
|
|
import com.modular.apputils.network.Parameter;
|
|
import com.modular.apputils.network.Parameter;
|
|
|
import com.modular.apputils.network.Tags;
|
|
import com.modular.apputils.network.Tags;
|
|
|
|
|
+import com.modular.apputils.utils.ImageViewUtils;
|
|
|
|
|
+import com.modular.apputils.utils.TestStr;
|
|
|
import com.modular.apputils.utils.UUHttpHelper;
|
|
import com.modular.apputils.utils.UUHttpHelper;
|
|
|
import com.uas.appme.R;
|
|
import com.uas.appme.R;
|
|
|
|
|
|
|
|
|
|
+import de.hdodenhof.circleimageview.CircleImageView;
|
|
|
|
|
+
|
|
|
public class WorkCardActivity extends BaseActivity {
|
|
public class WorkCardActivity extends BaseActivity {
|
|
|
private ImageView logoIv;
|
|
private ImageView logoIv;
|
|
|
- private ImageView headIv;
|
|
|
|
|
|
|
+ private TextView companyNameTv;
|
|
|
|
|
+ private TextView nameTv;
|
|
|
|
|
+ private TextView emCodeTv;
|
|
|
|
|
+ private TextView positionTv;
|
|
|
|
|
+ private CircleImageView headIv;
|
|
|
|
|
|
|
|
private UUHttpHelper mUUHttpHelper;
|
|
private UUHttpHelper mUUHttpHelper;
|
|
|
|
|
|
|
@@ -34,19 +45,25 @@ public class WorkCardActivity extends BaseActivity {
|
|
|
private void initView() {
|
|
private void initView() {
|
|
|
mUUHttpHelper = new UUHttpHelper(CommonUtil.getAppBaseUrl(ct));
|
|
mUUHttpHelper = new UUHttpHelper(CommonUtil.getAppBaseUrl(ct));
|
|
|
logoIv = (ImageView) findViewById(R.id.logoIv);
|
|
logoIv = (ImageView) findViewById(R.id.logoIv);
|
|
|
- headIv = (ImageView) findViewById(R.id.headIv);
|
|
|
|
|
|
|
+ companyNameTv = (TextView) findViewById(R.id.companyNameTv);
|
|
|
|
|
+ nameTv = (TextView) findViewById(R.id.nameTv);
|
|
|
|
|
+ emCodeTv = (TextView) findViewById(R.id.emCodeTv);
|
|
|
|
|
+ positionTv = (TextView) findViewById(R.id.positionTv);
|
|
|
|
|
+ headIv = (CircleImageView) findViewById(R.id.headIv);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
loadData();
|
|
loadData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void loadData() {
|
|
private void loadData() {
|
|
|
mUUHttpHelper.requestCompanyHttp(new Parameter.Builder()
|
|
mUUHttpHelper.requestCompanyHttp(new Parameter.Builder()
|
|
|
- .url("mobile/oa/getLabourCardInfor.action")
|
|
|
|
|
- .addParams("emcode",CommonUtil.getEmcode())
|
|
|
|
|
|
|
+ .url("mobile/oa/getLabourCardInfor.action")
|
|
|
|
|
+ .addParams("emcode", CommonUtil.getEmcode())
|
|
|
, new OnSmartHttpListener() {
|
|
, new OnSmartHttpListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onSuccess(int what, String message, Tags tag) throws Exception {
|
|
public void onSuccess(int what, String message, Tags tag) throws Exception {
|
|
|
- JSONObject object= JSON.parseObject(message);
|
|
|
|
|
- JSONArray mLabourCardInfors= JSONUtil.getJSONArray(object,"LabourCardInfor");
|
|
|
|
|
|
|
+ JSONObject object = JSON.parseObject(message);
|
|
|
|
|
+ JSONArray mLabourCardInfors = JSONUtil.getJSONArray(object, "LabourCardInfor");
|
|
|
if (!ListUtils.isEmpty(mLabourCardInfors)) {
|
|
if (!ListUtils.isEmpty(mLabourCardInfors)) {
|
|
|
handlerData(mLabourCardInfors.getJSONObject(0));
|
|
handlerData(mLabourCardInfors.getJSONObject(0));
|
|
|
}
|
|
}
|
|
@@ -57,18 +74,36 @@ public class WorkCardActivity extends BaseActivity {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ //TODO 测试数据
|
|
|
|
|
+ JSONObject object = JSON.parseObject(TestStr.LABOUR_CARD_INFOR);
|
|
|
|
|
+ JSONArray mLabourCardInfors = JSONUtil.getJSONArray(object, "LabourCardInfor");
|
|
|
|
|
+ if (!ListUtils.isEmpty(mLabourCardInfors)) {
|
|
|
|
|
+ handlerData(mLabourCardInfors.getJSONObject(0));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void handlerData( JSONObject mLabourCardInfor ){
|
|
|
|
|
- String em_photourl=JSONUtil.getText(mLabourCardInfor,"EM_PHOTOURL");
|
|
|
|
|
- String em_name=JSONUtil.getText(mLabourCardInfor,"EM_NAME");
|
|
|
|
|
- String em_code=JSONUtil.getText(mLabourCardInfor,"EM_CODE");
|
|
|
|
|
- String em_sex=JSONUtil.getText(mLabourCardInfor,"EM_SEX");
|
|
|
|
|
- String em_mobile=JSONUtil.getText(mLabourCardInfor,"EM_MOBILE");
|
|
|
|
|
- String em_position=JSONUtil.getText(mLabourCardInfor,"EM_POSITION");
|
|
|
|
|
- String en_logo=JSONUtil.getText(mLabourCardInfor,"EN_LOGO");
|
|
|
|
|
|
|
+
|
|
|
|
|
+ private void handlerData(JSONObject mLabourCardInfor) {
|
|
|
|
|
+ String em_cop = JSONUtil.getText(mLabourCardInfor, "EM_COP");
|
|
|
|
|
+ String em_photourl = JSONUtil.getText(mLabourCardInfor, "EM_PHOTOURL");
|
|
|
|
|
+ String em_name = JSONUtil.getText(mLabourCardInfor, "EM_NAME");
|
|
|
|
|
+ String em_code = JSONUtil.getText(mLabourCardInfor, "EM_CODE");
|
|
|
|
|
+ String em_sex = JSONUtil.getText(mLabourCardInfor, "EM_SEX");
|
|
|
|
|
+ String em_mobile = JSONUtil.getText(mLabourCardInfor, "EM_MOBILE");
|
|
|
|
|
+ String em_position = JSONUtil.getText(mLabourCardInfor, "EM_DEPART");
|
|
|
|
|
+ String en_logo = JSONUtil.getText(mLabourCardInfor, "EN_LOGO");
|
|
|
|
|
+
|
|
|
|
|
+ companyNameTv.setText(em_cop);
|
|
|
|
|
+ nameTv.setText(em_name);
|
|
|
|
|
+ emCodeTv.setText("ID " + em_code);
|
|
|
|
|
+ positionTv.setText(em_position);
|
|
|
|
|
+ positionTv.setText(em_position);
|
|
|
|
|
+ String headUrl = ImageViewUtils.getErpImageUrl(em_photourl);
|
|
|
|
|
+ LogUtil.i("gong","headUrl="+headUrl);
|
|
|
|
|
+ ImageLoaderUtil.getInstance().loadImage(headUrl, headIv);
|
|
|
Bitmap logoMap = Base64Util.base64ToBitmap(en_logo);
|
|
Bitmap logoMap = Base64Util.base64ToBitmap(en_logo);
|
|
|
- if (logoMap!=null){
|
|
|
|
|
|
|
+ if (logoMap != null) {
|
|
|
logoIv.setImageBitmap(logoMap);
|
|
logoIv.setImageBitmap(logoMap);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|