|
|
@@ -1,6 +1,7 @@
|
|
|
package com.uas.appme.settings.activity;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
+import android.content.Intent;
|
|
|
import android.graphics.Bitmap;
|
|
|
import android.graphics.BitmapFactory;
|
|
|
import android.os.Bundle;
|
|
|
@@ -19,12 +20,14 @@ import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.PopupWindow;
|
|
|
+import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.common.LogUtil;
|
|
|
+import com.common.data.DateFormatUtil;
|
|
|
import com.common.data.JSONUtil;
|
|
|
import com.common.data.ListUtils;
|
|
|
import com.common.data.StringUtil;
|
|
|
@@ -34,6 +37,7 @@ import com.core.api.wxapi.ApiUtils;
|
|
|
import com.core.base.BaseActivity;
|
|
|
import com.core.net.http.ViewUtil;
|
|
|
import com.core.utils.CommonUtil;
|
|
|
+import com.core.utils.time.wheel.DatePicker;
|
|
|
import com.core.widget.EmptyLayout;
|
|
|
import com.core.widget.MyListView;
|
|
|
import com.lidroid.xutils.HttpUtils;
|
|
|
@@ -55,6 +59,7 @@ import java.io.ByteArrayOutputStream;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
|
|
|
/**
|
|
|
* Created by FANGlh on 2017/11/10.
|
|
|
@@ -78,6 +83,12 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
private String emcode;
|
|
|
private EditText msg_et;
|
|
|
private ImageView received_im;
|
|
|
+ private String password;
|
|
|
+ private String vecode;
|
|
|
+ private String phone;
|
|
|
+ private TextView wageDateTv;
|
|
|
+ private LinearLayout noWageLl;
|
|
|
+ private Boolean haveData = false;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -112,6 +123,8 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
myAdapter.setModeList(kvModeList);
|
|
|
myAdapter.notifyDataSetChanged();
|
|
|
LogUtil.prinlnLongMsg("fanglh",JSON.toJSONString(kvModeList));
|
|
|
+ if (ListUtils.isEmpty(kvModeList))
|
|
|
+ showEnty();
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
@@ -124,23 +137,24 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ if (!haveData)
|
|
|
+ mBtnSignature.setVisibility(View.VISIBLE);
|
|
|
+ else
|
|
|
+ mBtnSignature.setVisibility(View.GONE);
|
|
|
+}
|
|
|
|
|
|
private void showEnty() {
|
|
|
- received_im.setVisibility(View.GONE);
|
|
|
- mEmptyLayout.showEmpty();
|
|
|
+ haveData = false;
|
|
|
+ noWageLl.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
|
|
|
- private EmptyLayout mEmptyLayout;
|
|
|
private void initView() {
|
|
|
// emcode = MyApplication.getInstance().getLoginUserId();
|
|
|
emcode = "U0747";
|
|
|
master = CommonUtil.getSharedPreferences(ct, "erp_master");
|
|
|
- checkYear = getIntent().getStringExtra("checkYear");
|
|
|
- checkMonth = getIntent().getStringExtra("checkMonth");
|
|
|
- String title = checkYear + "年" + checkMonth + "月"+"工资";
|
|
|
- if (!StringUtil.isEmpty(checkYear) && !StringUtil.isEmpty(checkMonth))
|
|
|
- getSupportActionBar().setTitle(title);
|
|
|
+ getSupportActionBar().setTitle("工资查询");
|
|
|
|
|
|
mWagesLv = (MyListView) findViewById(R.id.wages_lv);
|
|
|
mBtnSignature = (Button) findViewById(R.id.btn_signature); mBtnSignature.setOnClickListener(this);
|
|
|
@@ -150,16 +164,26 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
//设置适配器
|
|
|
mWagesLv.setAdapter(myAdapter);
|
|
|
|
|
|
- mEmptyLayout = new EmptyLayout(this, mWagesLv);
|
|
|
- mEmptyLayout.setShowEmptyButton(false);
|
|
|
- mEmptyLayout.setShowErrorButton(false);
|
|
|
- mEmptyLayout.setShowLoadingButton(false);
|
|
|
received_im = (ImageView) findViewById(R.id.received_im);
|
|
|
-// findViewById(R.id.h_sign_tv).setOnClickListener(this);
|
|
|
+ wageDateTv = (TextView) findViewById(R.id.wage_date_tv);
|
|
|
+ wageDateTv.setOnClickListener(this);
|
|
|
+ noWageLl = (LinearLayout) findViewById(R.id.wage_nodata_ll);
|
|
|
+
|
|
|
|
|
|
- String result = getIntent().getStringExtra("WageDatas");
|
|
|
+// findViewById(R.id.h_sign_tv).setOnClickListener(this);
|
|
|
+ Intent hh = getIntent();
|
|
|
+ String result = hh.getStringExtra("WageDatas");
|
|
|
+ checkYear = hh.getStringExtra("checkYear");
|
|
|
+ checkMonth = hh.getStringExtra("checkMonth");
|
|
|
+ String title = checkYear + "年" + checkMonth + "月"+"工资";
|
|
|
+ if (!StringUtil.isEmpty(checkYear) && !StringUtil.isEmpty(checkMonth))
|
|
|
+ wageDateTv.setText(title);
|
|
|
showDatas(result);
|
|
|
|
|
|
+ password = hh.getStringExtra("password");
|
|
|
+ vecode = hh.getStringExtra("vecode");
|
|
|
+ phone = hh.getStringExtra("phone");
|
|
|
+
|
|
|
}
|
|
|
// @Override
|
|
|
// protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
@@ -214,9 +238,55 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
doErrorMsgHandle();
|
|
|
}else if (v.getId() == R.id.cancel1_tv){
|
|
|
popupWindow.dismiss();
|
|
|
+ }else if (v.getId() == R.id.wage_date_tv){
|
|
|
+ DatePicker picker = new DatePicker(this, DatePicker.YEAR_MONTH);
|
|
|
+ picker.setRange(2016, CommonUtil.getNumByString(DateFormatUtil.long2Str(System.currentTimeMillis(), "yyyy")));
|
|
|
+ picker.setSelectedItem(
|
|
|
+ Calendar.getInstance().get(Calendar.YEAR),
|
|
|
+ Calendar.getInstance().get(Calendar.MONTH) + 1);
|
|
|
+ picker.setOnDatePickListener(new DatePicker.OnYearMonthPickListener() {
|
|
|
+ @Override
|
|
|
+ public void onDatePicked(String year, String month) {
|
|
|
+ String myearmonth = year + "年" + month+"月";
|
|
|
+ checkYear = year;
|
|
|
+ checkMonth = month;
|
|
|
+ wageDateTv.setText(myearmonth+"工资");
|
|
|
+ searchWage();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ picker.show();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void searchWage() {
|
|
|
+ // HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
|
|
|
+ HttpClient httpClient = new HttpClient.Builder("http://192.168.253.58:8080/ERP/").isDebug(true).build(true);
|
|
|
+ httpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("mobile/salary/getEmSalary.action")
|
|
|
+ .add("emcode", emcode)
|
|
|
+ .add("password",password)
|
|
|
+ .add("phone",phone)
|
|
|
+ .add("vecode",vecode)
|
|
|
+ .add("date",checkYear+"-"+checkMonth)
|
|
|
+ .add("master",master)
|
|
|
+ .method(Method.POST)
|
|
|
+ .build(),new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ LogUtil.prinlnLongMsg("getEmSalary", o.toString()+"");
|
|
|
+ if (!JSONUtil.validate(o.toString()) || o == null) return;
|
|
|
+ if (o.toString().contains("success") && JSON.parseObject(o.toString()).getBoolean("success")){
|
|
|
+ showDatas(o.toString());
|
|
|
+ }else if (o.toString().contains("reason")){
|
|
|
+ ToastMessage(JSON.parseObject(o.toString()).getString("reason"));
|
|
|
+ }else if (o.toString().contains("exceptionInfo")){
|
|
|
+ ToastMessage(JSON.parseObject(o.toString()).getString("exceptionInfo"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
private void doErrorMsgHandle() {
|
|
|
// HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
|
|
|
HttpClient httpClient = new HttpClient.Builder("http://192.168.253.58:8080/ERP/").isDebug(true).build(true);
|
|
|
@@ -266,6 +336,8 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
Log.i("doNewSubmit",JSON.parseObject(responseInfo.result).toJSONString());
|
|
|
if (JSONUtil.validate(responseInfo.result) && JSON.parseObject(responseInfo.result).getBoolean("success")) {
|
|
|
Toast.makeText(ct,"工资条签名提交成功",Toast.LENGTH_LONG).show();
|
|
|
+ received_im.setVisibility(View.VISIBLE);
|
|
|
+ mBtnSignature.setText("已收签");
|
|
|
closePopupWindow();
|
|
|
}
|
|
|
progressDialog.dismiss();
|
|
|
@@ -385,46 +457,27 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
contentView.findViewById(R.id.cancel1_tv).setOnClickListener(this);
|
|
|
contentView.findViewById(R.id.sure_tv).setOnClickListener(this);
|
|
|
|
|
|
- DisplayMetrics dm = getResources().getDisplayMetrics();
|
|
|
- int w_screen = dm.widthPixels;
|
|
|
- int h_screen = dm.heightPixels;
|
|
|
- w_screen = DisplayUtil.dip2px(this, 300);
|
|
|
- h_screen = DisplayUtil.dip2px(this, 300);
|
|
|
-
|
|
|
- popupWindow = new PopupWindow(contentView, w_screen, h_screen, true);
|
|
|
- popupWindow.setTouchable(true);
|
|
|
- popupWindow.setOutsideTouchable(false);
|
|
|
- // 如果不设置PopupWindow的背景,无论是点击外部区域还是Back键都无法dismiss弹框
|
|
|
- popupWindow.setBackgroundDrawable(getResources().getDrawable(com.uas.appworks.R.drawable.pop_round_bg));
|
|
|
- // 设置好参数之后再show
|
|
|
- popupWindow.showAtLocation(contentView, Gravity.CENTER, 0, 0);
|
|
|
- setbg(0.4f);
|
|
|
- }
|
|
|
- private void setbg(float alpha) {
|
|
|
- setBackgroundAlpha(this, alpha);
|
|
|
- if (popupWindow == null) return;
|
|
|
+// DisplayMetrics dm = getResources().getDisplayMetrics();
|
|
|
+// int w_screen = dm.widthPixels;
|
|
|
+// int h_screen = dm.heightPixels;
|
|
|
+// w_screen = DisplayUtil.dip2px(this, 300);
|
|
|
+// h_screen = DisplayUtil.dip2px(this, 250);
|
|
|
+//
|
|
|
+// popupWindow = new PopupWindow(contentView, w_screen, h_screen, true);
|
|
|
+ popupWindow = new PopupWindow(contentView,
|
|
|
+ LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
+ LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
+ popupWindow.setAnimationStyle(R.style.MenuAnimationFade);
|
|
|
+ popupWindow.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.bg_popuwin));
|
|
|
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
@Override
|
|
|
public void onDismiss() {
|
|
|
- setBackgroundAlpha(WagesDetailsActivity.this, 1f);
|
|
|
+ closePopupWindow();
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
- /**
|
|
|
- * 设置页面的透明度
|
|
|
- * 兼容华为手机(在个别华为手机上 设置透明度会不成功)
|
|
|
- *
|
|
|
- * @param bgAlpha 透明度 1表示不透明
|
|
|
- */
|
|
|
- public void setBackgroundAlpha(Activity activity, float bgAlpha) {
|
|
|
- WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
|
|
|
- lp.alpha = bgAlpha;
|
|
|
- if (bgAlpha == 1) {
|
|
|
- activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//不移除该Flag的话,在有视频的页面上的视频会出现黑屏的bug
|
|
|
- } else {
|
|
|
- activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//此行代码主要是解决在华为手机上半透明效果无效的bug
|
|
|
- }
|
|
|
- activity.getWindow().setAttributes(lp);
|
|
|
+ popupWindow.showAtLocation(getWindow().getDecorView().
|
|
|
+ findViewById(android.R.id.content), Gravity.BOTTOM, 0, 0);
|
|
|
+ DisplayUtil.backgroundAlpha(this, 0.4f);
|
|
|
}
|
|
|
|
|
|
}
|