Sfoglia il codice sorgente

点赞功能完成

FANGLH 8 anni fa
parent
commit
4d479c9aef

+ 1 - 1
WeiChat/src/main/res/layout/new_message_header.xml

@@ -396,7 +396,7 @@
         android:layout_width="match_parent"
         android:layout_height="@dimen/line"
         android:background="@color/item_line"
-        android:visibility="gone"/>
+        android:visibility="visible"/>
 
     <RelativeLayout
         android:id="@+id/uustep_rl"

+ 2 - 3
app_core/common/src/main/res/layout/new_message_header.xml

@@ -397,9 +397,8 @@
     <View
         android:layout_width="match_parent"
         android:layout_height="@dimen/line"
-        android:layout_marginLeft="10dp"
-        android:layout_marginRight="10dp"
-        android:background="@color/transparent" />
+        android:background="@color/item_line"
+        android:visibility="visible"/>
 
     <RelativeLayout
         android:id="@+id/uustep_rl"

+ 2 - 1
app_core/common/src/main/res/layout/person_setting_activity.xml

@@ -86,6 +86,7 @@
 
 
                 <TextView
+                    android:id="@+id/user_department_tv"
                     style="@style/form_relative_left_text"
                     android:text="科室"
                     android:layout_marginLeft="0dp"
@@ -93,7 +94,7 @@
                     android:textSize="15sp"/>
 
                 <com.andreabaccega.widget.FormEditText xmlns:editTextFormExample="http://schemas.android.com/apk/res-auto"
-                    android:id="@+id/user_department_tv"
+                    android:id="@+id/user_department_et"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:textColor="@color/dark_dark_grey"

+ 14 - 1
app_modular/appme/src/main/java/com/uas/appme/pedometer/adapter/UUAttentionAdapter.java

@@ -82,11 +82,24 @@ public class UUAttentionAdapter extends BaseAdapter{
             if (MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAttrank().get(position).getAs_userid())
                     && Integer.valueOf(model.getAttrank().get(position).getAs_prise()) > 0)
                 viewHolder.prise_im.setImageResource(R.drawable.praised);
+            }
+
+        //点赞后的红色图标显示
+        if (!ListUtils.isEmpty(model.getPricelist())){
+            for (int i = 0; i < model.getPricelist().size(); i++) {
+                if (model.getPricelist().get(i).getAp_userid().equals(model.getAttrank().get(position).getAs_userid())){
+                    viewHolder.prise_im.setImageResource(R.drawable.praised);
+                    break;//个人的点赞列表id中已经存在当前position的userid 则不点赞
+                }else if (i==model.getPricelist().size()-1){
+                    viewHolder.prise_im.setImageResource(R.drawable.praise);
+                }
+            }
         }
+
         viewHolder.prise_im.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                StepUtils.doStepPriseHttp(model,2,position);
+                    StepUtils.doStepPriseHttp(model,2,position);
             }
         });
         return convertView;

+ 11 - 0
app_modular/appme/src/main/java/com/uas/appme/pedometer/adapter/UURankingAdapter.java

@@ -77,6 +77,17 @@ public class UURankingAdapter extends BaseAdapter{
             viewHolder.prise_im.setImageResource(R.drawable.praised);
         else
             viewHolder.prise_im.setImageResource(R.drawable.praise);
+        //点赞后的红色图标显示
+        if (!ListUtils.isEmpty(model.getPricelist())){
+            for (int i = 0; i < model.getPricelist().size(); i++) {
+                if (model.getPricelist().get(i).getAp_userid().equals(model.getToalrank().get(position).getAs_userid())){
+                    viewHolder.prise_im.setImageResource(R.drawable.praised);
+                    break;//个人的点赞列表id中已经存在当前position的userid 则不点赞
+                }else if (i==model.getPricelist().size()-1){
+                    viewHolder.prise_im.setImageResource(R.drawable.praise);
+                }
+            }
+        }
         viewHolder.prise_im.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {

+ 24 - 0
app_modular/appme/src/main/java/com/uas/appme/pedometer/bean/StepsRankingBean.java

@@ -12,6 +12,15 @@ public class StepsRankingBean {
 
     private List<AttrankBean> attrank;
     private List<ToalrankBean> toalrank;
+    private List<Pricelist> pricelist;
+
+    public List<Pricelist> getPricelist() {
+        return pricelist;
+    }
+
+    public void setPricelist(List<Pricelist> pricelist) {
+        this.pricelist = pricelist;
+    }
 
     public List<AttrankBean> getAttrank() {
         return attrank;
@@ -180,4 +189,19 @@ public class StepsRankingBean {
             this.rank = rank;
         }
     }
+
+    public static class Pricelist{
+        /**
+         * "ap_userid": "109805"
+         */
+        private String ap_userid;
+
+        public String getAp_userid() {
+            return ap_userid;
+        }
+
+        public void setAp_userid(String ap_userid) {
+            this.ap_userid = ap_userid;
+        }
+    }
 }

+ 15 - 0
app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/StepUtils.java

@@ -173,6 +173,7 @@ public class StepUtils {
      * @param position
      */
     public static void doStepPriseHttp(StepsRankingBean model, int type, int position) {
+        Boolean doPrise = true;
         String userid = null;
         switch (type){
             case 2:
@@ -182,6 +183,20 @@ public class StepUtils {
                 userid = model.getToalrank().get(position).getAs_userid();
                 break;
         }
+        if (!ListUtils.isEmpty(model.getPricelist())){
+            for (int i = 0; i < model.getPricelist().size(); i++) {
+                if (model.getPricelist().get(i).getAp_userid().equals(userid)){
+                    doPrise = false;
+                    break;//个人的点赞列表id中已经存在当前position的userid 则不点赞
+                }else if (i==model.getPricelist().size()-1)
+                    doPrise = true;
+            }
+        }else{
+            doPrise = true;
+        }
+
+        Log.i("doPrise",doPrise.toString());
+        if (!doPrise) return;
         if (StringUtil.isEmpty(userid) || MyApplication.getInstance().mLoginUser.getUserId().equals(userid)) return;  //不可以赞自己
         //点赞操作
         HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);

+ 5 - 2
app_modular/appme/src/main/java/com/uas/appme/settings/Constant/Constant.java

@@ -1,5 +1,8 @@
 package com.uas.appme.settings.Constant;
 
+import com.core.app.MyApplication;
+import com.core.utils.CommonUtil;
+
 /**
  * Created by FANGlh on 2017/8/30.
  * function:
@@ -9,6 +12,6 @@ public class Constant {
     public static String BAIDU_PUSH = "BAIDUPUSH";
     public static String UU_STEP = "UUSTEP";
     public static String BASE_BOOKING_SETTING_URL= "http://113.105.74.140:8092/";
-//    public static String BASE_COMPANYID =  CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu");
-    public static String BASE_COMPANYID = "201";
+    public static String BASE_COMPANYID =  CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu");
+//    public static String BASE_COMPANYID = "201";
 }

+ 63 - 17
app_modular/appme/src/main/java/com/uas/appme/settings/activity/PersonSettingActivity.java

@@ -7,12 +7,14 @@ import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
 import android.widget.RelativeLayout;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import com.alibaba.fastjson.JSON;
 import com.andreabaccega.widget.FormEditText;
 import com.common.LogUtil;
 import com.common.data.JSONUtil;
+import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.common.hmac.Md5Util;
 import com.core.app.MyApplication;
@@ -26,10 +28,12 @@ import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.R;
 import com.uas.appme.settings.Constant.Constant;
+import com.uas.appme.settings.model.BSettingPlaceBean;
 import com.uas.appme.settings.model.PersonSetingBean;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -41,7 +45,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
     private FormEditText mUserNameTv;
     private FormEditText mUserSexTv;
     private RelativeLayout mRySetStartTime;
-    private FormEditText mUserDepartmentTv;
+    private FormEditText mUserDepartmentEv;
     private FormEditText mUserJobTv;
     private FormEditText mUserTelTv;
     private FormEditText mUserEmailTv;
@@ -49,6 +53,8 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
     private String sm_id;
     private int sm_sex = -1;
     private RelativeLayout mDepartmentRl;
+    private TextView user_department_tv;
+    private List<String> departmentModel_list;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -65,19 +71,20 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
         mUserNameTv = (FormEditText) findViewById(R.id.user_name_tv);
         mUserSexTv = (FormEditText) findViewById(R.id.user_sex_tv);
         mRySetStartTime = (RelativeLayout) findViewById(R.id.ry_set_startTime);
-        mUserDepartmentTv = (FormEditText) findViewById(R.id.user_department_tv);
+        mUserDepartmentEv = (FormEditText) findViewById(R.id.user_department_et);
         mUserJobTv = (FormEditText) findViewById(R.id.user_job_tv);
         mUserTelTv = (FormEditText) findViewById(R.id.user_tel_tv);
         mUserEmailTv = (FormEditText) findViewById(R.id.user_email_tv);
         mBtnSave = (Button) findViewById(R.id.btn_save);
         mDepartmentRl = (RelativeLayout) findViewById(R.id.user_department_rl);
+        user_department_tv = (TextView) findViewById(R.id.user_department_tv);
 
         mUserSexTv.setKeyListener(null);
         mUserSexTv.setFocusable(false);
         mUserSexTv.setOnClickListener(this);
-        mUserDepartmentTv.setKeyListener(null);
-        mUserDepartmentTv.setFocusable(false);
-        mUserDepartmentTv.setOnClickListener(this);
+        mUserDepartmentEv.setKeyListener(null);
+        mUserDepartmentEv.setFocusable(false);
+        mUserDepartmentEv.setOnClickListener(this);
 
         mBtnSave.setOnClickListener(this);
 
@@ -94,10 +101,33 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
       String  sc_industry = getIntent().getStringExtra("sc_industry");
       String sc_industrycode = getIntent().getStringExtra("sc_industrycode");
 
-      if ("医疗".equals(sc_industry))
-          mDepartmentRl.setVisibility(View.VISIBLE);
-      else
-          mDepartmentRl.setVisibility(View.GONE);
+      if (!"医疗".equals(sc_industry))
+          user_department_tv.setText("部门");
+
+        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        httpClient.Api().send(new HttpClient.Builder()
+                .url("user/appPlaceList")
+                .add("companyid",Constant.BASE_COMPANYID)
+                .add("token",MyApplication.getInstance().mAccessToken)
+                .method(Method.POST)
+                .build(),new ResultSubscriber<>(new ResultListener<Object>() {
+            @Override
+            public void onResponse(Object o) {
+                if (!JSONUtil.validate(o.toString()) || o == null) return;
+                LogUtil.prinlnLongMsg("appPlaceList", o.toString()+"");
+                    try {
+                        BSettingPlaceBean departmentModel = new BSettingPlaceBean();
+                        departmentModel = JSON.parseObject(o.toString(),BSettingPlaceBean.class);
+                        if (departmentModel == null || ListUtils.isEmpty(departmentModel.getResult())) return;
+                        departmentModel_list = new ArrayList<>();
+                        for (int i=0;i<departmentModel.getResult().size();i++)
+                            departmentModel_list.add(departmentModel.getResult().get(i).getSt_name());
+
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+            }
+        }));
 
     }
 
@@ -106,7 +136,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
         try {
             model = JSON.parseObject(result,PersonSetingBean.class);
             mUserNameTv.setText(model.getResult().get(position).getSm_username());
-            mUserDepartmentTv.setText(model.getResult().get(position).getSm_stname());
+            mUserDepartmentEv.setText(model.getResult().get(position).getSm_stname());
             mUserJobTv.setText(model.getResult().get(position).getSm_level());
             mUserTelTv.setText(model.getResult().get(position).getSm_telephone());
             mUserEmailTv.setText(model.getResult().get(position).getSm_email());
@@ -123,24 +153,38 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
     public void onClick(View v) {
         if (v.getId() == R.id.user_sex_tv){
             showSelectSexDialog();
-        }else if (v.getId() == R.id.user_department_tv){
-            String[] department = {"内科","外科","儿科","传染病科","妇产科","男科","精神心理科","皮肤性病科","中医科","肿瘤科","骨科","康复医学科","麻醉医学科","营养科","五官科","医学影像科","其他科室"};
+        }else if (v.getId() == R.id.user_department_et){
+//            String[] department = {"内科","外科","儿科","传染病科","妇产科","男科","精神心理科","皮肤性病科","中医科","肿瘤科","骨科","康复医学科","麻醉医学科","营养科","五官科","医学影像科","其他科室"};
             int requestCode = 0x01;
-            doSelectDepartment(department, requestCode);
+            if (ListUtils.isEmpty(departmentModel_list)) {
+                ToastMessage("暂未获取到部门/科室");
+                return;
+            }else {
+                doSelectDepartment(departmentModel_list, requestCode);
+            }
         }else if (v.getId() == R.id.btn_save){
             saveJudge();
         }
     }
 
-    private void doSelectDepartment(String[] department, int requestCode) {
+    private void doSelectDepartment(List<String> department, int requestCode) {
         ArrayList<SelectBean> beans = new ArrayList<>();
         SelectBean bean = null;
-        for (String e : department) {
+       /* for (String e : department) {
             bean = new SelectBean();
             bean.setName(e);
             bean.setClick(false);
             beans.add(bean);
+        }*/
+        LogUtil.prinlnLongMsg("department",JSON.toJSONString(department));
+
+        for (int i = 0; i < department.size(); i++) {
+            bean = new SelectBean();
+            bean.setName(department.get(i));
+            bean.setClick(false);
+            beans.add(bean);
         }
+        LogUtil.prinlnLongMsg("department beans",JSON.toJSONString(beans));
         Intent intent = new Intent(ct, SelectActivity.class);
         intent.putExtra("type", 2);
         intent.putParcelableArrayListExtra("data", beans);
@@ -157,7 +201,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
             if (b == null) return;
             String department = StringUtil.isEmpty(b.getName()) ? "" : b.getName();
             if (requestCode == 0x01) {
-                mUserDepartmentTv.setText(department);
+                mUserDepartmentEv.setText(department);
             }
         }
     }
@@ -186,10 +230,12 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
         params.put("sm_userid",MyApplication.getInstance().mLoginUser.getUserId());
         params.put("sm_username",mUserNameTv.getText().toString());
         params.put("sm_companyid",Constant.BASE_COMPANYID);
-        params.put("sm_stname",mUserDepartmentTv.getText().toString());
+        params.put("sm_stname",mUserDepartmentEv.getText().toString());
         params.put("sm_companyname", CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_commpany"));
         params.put("sm_level",mUserJobTv.getText().toString());
         params.put("sm_telephone",mUserTelTv.getText().toString());
+        params.put("sm_sex",sm_sex);
+        params.put("sm_email",mUserEmailTv.getText().toString());
 
         HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()

+ 1 - 0
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/ExpenseReimbursementActivity.java

@@ -736,6 +736,7 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
                 //            String imName = String.valueOf(bean.getEM_NAME());
                 deparmentname = String.valueOf(bean.getEM_DEPART());
                 //            String imPosition = String.valueOf(bean.getEM_POSITION());
+                LogUtil.prinlnLongMsg("deparmentname",deparmentname);
             }
         } catch (Exception e) {
             e.printStackTrace();