FANGLH 8 years ago
parent
commit
19bd8d930b

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

@@ -11,8 +11,9 @@ import com.core.utils.CommonUtil;
 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/"; //发布正式ip
+//    public static String BASE_BOOKING_SETTING_URL= "http://113.105.74.140:8092/"; //发布正式ip
 //    public static String BASE_BOOKING_SETTING_URL= "http://192.168.253.136:8092/";   //测试LQM本地ip
+    public static String BASE_BOOKING_SETTING_URL=  "http://113.105.74.135:8092/"; //测试ip
     public static String BASE_COMPANYID =  CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu");
 //    public static String BASE_COMPANYID = "201";
 

+ 342 - 71
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BSettingLocationActivity.java

@@ -1,8 +1,12 @@
 package com.uas.appme.settings.activity;
 
+import android.Manifest;
 import android.app.Activity;
+import android.app.AlertDialog;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
+import android.net.Uri;
 import android.os.Bundle;
 import android.util.DisplayMetrics;
 import android.view.Gravity;
@@ -15,35 +19,52 @@ import android.view.WindowManager;
 import android.widget.BaseAdapter;
 import android.widget.Button;
 import android.widget.EditText;
+import android.widget.ImageView;
 import android.widget.PopupWindow;
 import android.widget.RelativeLayout;
 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.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.system.DisplayUtil;
+import com.common.system.PermissionUtil;
+import com.common.ui.CameraUtil;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
+import com.core.net.http.ViewUtil;
 import com.core.utils.CommonUtil;
+import com.core.utils.ToastUtil;
 import com.core.widget.MyListView;
+import com.lidroid.xutils.HttpUtils;
+import com.lidroid.xutils.exception.HttpException;
+import com.lidroid.xutils.http.ResponseInfo;
+import com.lidroid.xutils.http.callback.RequestCallBack;
+import com.lidroid.xutils.http.client.HttpRequest;
 import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.Result2Listener;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
+import com.nostra13.universalimageloader.core.ImageLoader;
 import com.uas.appme.R;
 import com.uas.appme.settings.Constant.Constant;
 import com.uas.appme.settings.model.BSetLocationBean;
+import com.umeng.socialize.utils.Log;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Created by FANGlh on 2017/10/12.
@@ -62,6 +83,11 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
     private String st_id;
     private String updateData;
     private Button deleteBtn;
+    private ArrayList<String> mPhotoList;
+    private int image_position; // 点击点击照片添加/更换 记住的position
+    private Uri mNewPhotoUri;// 拍照和图库 获得图片的URI
+    private static final int REQUEST_CODE_CAPTURE_PHOTO = 1;// 拍照
+    private static final int REQUEST_CODE_PICK_PHOTO = 2;// 图库
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -69,27 +95,16 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
         setContentView(R.layout.service_bcom_setting_activity);
         initView();
         initData();
+        String[] permissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE};
+        for (String permission : permissions) {
+            if (PermissionUtil.lacksPermissions(ct, permission)) {
+                PermissionUtil.requestPermission(this, PermissionUtil.DEFAULT_REQUEST, permission);
+            }
+        }
     }
 
     private void initData() {
 
-    }
-
-    private void initView() {
-        mList = new ArrayList<>();
-        mComList = (MyListView) findViewById(R.id.com_list);
-        add_new_rl = (RelativeLayout) findViewById(R.id.add_new_rl);
-        add_new_rl.setOnClickListener(this);
-        myAdapter = new BSetLocationAdapter(this);
-        myAdapter.setModelList(mList);
-        mComList.setAdapter(myAdapter);
-        save_bt = (Button) findViewById(R.id.save_bt);
-        save_bt.setOnClickListener(this);
-
-        deleteBtn = (Button)findViewById(R.id.deleteBtn);
-        deleteBtn.setOnClickListener(this);
-
-
         //接收商家类型
         sc_industry = getIntent().getStringExtra("sc_industry");
         sc_industrycode = getIntent().getStringExtra("sc_industrycode");
@@ -116,11 +131,31 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
             model.setSt_companyid(CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"));
             model.setSt_siid(StringUtil.isEmpty(sc_industrycode) ? "0" : sc_industrycode);
             model.setSt_name("");
+            model.setSt_servicetime("");
+            model.setSt_imageurl("");
 //            model.setSt_id("0");
             mList.add(model);
             myAdapter.notifyDataSetChanged();
         }
     }
+
+    private void initView() {
+        mList = new ArrayList<>();
+        mComList = (MyListView) findViewById(R.id.com_list);
+        add_new_rl = (RelativeLayout) findViewById(R.id.add_new_rl);
+        add_new_rl.setOnClickListener(this);
+        myAdapter = new BSetLocationAdapter(this);
+        myAdapter.setModelList(mList);
+        mComList.setAdapter(myAdapter);
+        save_bt = (Button) findViewById(R.id.save_bt);
+        save_bt.setOnClickListener(this);
+
+        deleteBtn = (Button)findViewById(R.id.deleteBtn);
+        deleteBtn.setOnClickListener(this);
+
+        mPhotoList = new ArrayList<>();
+        myAdapter.setPhotoList(mPhotoList);
+    }
     @Override
     public boolean onPrepareOptionsMenu(Menu menu) {
         menu.clear();
@@ -150,15 +185,22 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
     @Override
     public void onClick(View v) {
         if (v.getId() == R.id.add_new_rl){
+            LogUtil.prinlnLongMsg("mPhotoList",JSON.toJSONString(mPhotoList));
             if (StringUtil.isEmpty(mList.get(mList.size()-1).getSt_name())){
                 ToastMessage("请输入名称");
                 return;
             }
+            if (mPhotoList.size() < mList.size()){
+                ToastMessage("请添加照片");
+                return;
+            }
             BSetLocationBean model = new BSetLocationBean();
             model.setSt_companyname(CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_commpany"));
             model.setSt_companyid(CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"));
             model.setSt_siid(StringUtil.isEmpty(sc_industrycode) ? "0" : sc_industrycode);
             model.setSt_name("");
+            model.setSt_servicetime("");
+            model.setSt_imageurl("");
 //            model.setSt_id("0");
             mList.add(model);
             myAdapter.notifyDataSetChanged();
@@ -172,7 +214,7 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
                 if (update && !StringUtil.isEmpty(st_id))
                     doUpdate();
                 else
-                    doSave(mList);
+                    doSaveJudge(mList);
             }
 
         }else if (v.getId() == R.id.deleteBtn){
@@ -258,53 +300,156 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
 
     }
 
-    private void doSave(List<BSetLocationBean> mList) {
+    private void doSaveJudge(List<BSetLocationBean> mList) {
+        if (mPhotoList.size() < mList.size()){
+            ToastMessage("请添加照片");
+            return;
+        }
         for (int i = 0; i < mList.size(); i++) {
             if (StringUtil.isEmpty(mList.get(i).getSt_name())){
                 ToastMessage("请输入名称");
                 break;
             }else if (i==mList.size()-1){
-                progressDialog.show();save_bt.setEnabled(false);
-                HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
-                httpClient.Api().send(new HttpClient.Builder()
-                        .url("user/appBatchPlace")
-                        .add("map",JSON.toJSONString(mList))
-                        .add("token",MyApplication.getInstance().mAccessToken)
-                        .connectTimeout(10000)
-                        .method(Method.POST)
-                        .build(),new ResultSubscriber<>(new Result2Listener<Object>() {
-                    @Override
-                    public void onResponse(Object o) {
-                        if (!JSONUtil.validate(o.toString()) || o == null) {
-                            progressDialog.dismiss();save_bt.setEnabled(true);
-                            return;
-                        }
-                        LogUtil.prinlnLongMsg("appBatchPlace", o.toString()+"");
-                        if (o.toString().contains("result") && JSON.parseObject(o.toString()).getBooleanValue("result")) {
-                            Toast.makeText(ct,getString(R.string.common_save_success),Toast.LENGTH_LONG).show();
-                            startActivity(new Intent(ct,BSetComRestListActivity.class)
-                                    .putExtra("sc_industry",sc_industry)
-                                    .putExtra("sc_industrycode",sc_industrycode)
-                                    .putExtra("type","place"));
-                            finish();
-                        }
-                        progressDialog.dismiss();save_bt.setEnabled(true);
+                doJudegeCNow_p();//开始上传第一张图片
+            }
+        }
+
+
+    }
+    private int now_p = 0;
+    private void sendPictureRequest(String path) {
+        if (StringUtil.isEmpty(path)) return;
+        File waterBitmapToFile=  new File(path);
+        if (!waterBitmapToFile.isFile()){
+            return;
+        }else {
+            com.lidroid.xutils.http.RequestParams params = new com.lidroid.xutils.http.RequestParams();
+            params.addQueryStringParameter("master", CommonUtil.getSharedPreferences(ct, "erp_master"));
+            params.addHeader("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
+            params.addBodyParameter("userid", MyApplication.getInstance().mLoginUser.getUserId());
+            params.addBodyParameter("file1", waterBitmapToFile);
+            String url = "http://113.105.74.140:8080/upload/UploadServlet";
+            final HttpUtils http = new HttpUtils();
+            http.send(HttpRequest.HttpMethod.POST, url, params, new RequestCallBack<String>() {
+                @Override
+                public void onStart() {
+                    progressDialog.show();
+                    ViewUtil.ToastMessage(ct, getString(com.uas.appworks.R.string.sending_picture)+"...");
+                }
+                @Override
+                public void onLoading(long total, long current, boolean isUploading) {
+                    if (isUploading) {
+                    } else {
                     }
+                }
 
-                    @Override
-                    public void onFailure(Object t) {
-                        progressDialog.dismiss();save_bt.setEnabled(true);
+                @Override
+                public void onSuccess(ResponseInfo<String> responseInfo) {
+                    if (JSONUtil.validate(responseInfo.result) && JSON.parseObject(responseInfo.result).getBoolean("success")) {
+                        LogUtil.prinlnLongMsg("UploadServlet", responseInfo.result + "");
+                        try {
+                            JSONObject object = JSON.parseObject(responseInfo.result);
+                            JSONObject dataobject = object.getJSONObject("data");
+                            if (dataobject == null) {
+                                doJudegeCNow_p();
+                                return;
+                            }
+                            JSONArray imagearray = dataobject.getJSONArray("images");
+                            if (ListUtils.isEmpty(imagearray)) {
+                                doJudegeCNow_p();
+                                return;
+                            }
+                            String oUrl = imagearray.getJSONObject(0).getString("oUrl");
+                            if (!StringUtil.isEmpty(oUrl))
+                                mList.get(now_p).setSt_imageurl(oUrl);
+                            else
+                                mList.get(now_p).setSt_imageurl("");
+
+                            LogUtil.prinlnLongMsg("mList",JSON.toJSONString(mList));
+                            doJudegeCNow_p();
+
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
                     }
-                }));
-            }
+                }
+
+                @Override
+                public void onFailure(HttpException error, String msg) {
+                    doJudegeCNow_p();
+                    ViewUtil.ToastMessage(ct, getString(com.uas.appworks.R.string.common_save_failed) + msg);
+                    progressDialog.dismiss();
+                }
+            });
         }
+    }
 
+    //判断当前上传了几张照片,进行是否上传数据操作
+    private void doJudegeCNow_p() {
+        if (now_p == mList.size())
+            doSaveDatasList();
+        else
+            sendPictureRequest(mPhotoList.get(now_p));
 
+        now_p++;
+    }
+
+    private int getID(String chche) {
+        if (StringUtil.isEmpty(chche)) return 0;
+        Pattern p = Pattern.compile("(\\d+)");
+        Matcher m = p.matcher(chche);
+        if (m.find()) {
+            return Integer.parseInt(m.group(0));
+        }
+        return -1;
+    }
+    private void doSaveDatasList() {
+        progressDialog.show();save_bt.setEnabled(false);
+        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        httpClient.Api().send(new HttpClient.Builder()
+                .url("user/appBatchPlace")
+                .add("map",JSON.toJSONString(mList))
+                .add("token",MyApplication.getInstance().mAccessToken)
+                .connectTimeout(10000)
+                .method(Method.POST)
+                .build(),new ResultSubscriber<>(new Result2Listener<Object>() {
+            @Override
+            public void onResponse(Object o) {
+                if (!JSONUtil.validate(o.toString()) || o == null) {
+                    progressDialog.dismiss();save_bt.setEnabled(true);
+                    return;
+                }
+                LogUtil.prinlnLongMsg("appBatchPlace", o.toString()+"");
+                if (o.toString().contains("result") && JSON.parseObject(o.toString()).getBooleanValue("result")) {
+                    Toast.makeText(ct,getString(R.string.common_save_success),Toast.LENGTH_LONG).show();
+                    startActivity(new Intent(ct,BSetComRestListActivity.class)
+                            .putExtra("sc_industry",sc_industry)
+                            .putExtra("sc_industrycode",sc_industrycode)
+                            .putExtra("type","place"));
+                    finish();
+                }
+                progressDialog.dismiss();save_bt.setEnabled(true);
+            }
+
+            @Override
+            public void onFailure(Object t) {
+                progressDialog.dismiss();save_bt.setEnabled(true);
+            }
+        }));
     }
 
     private class BSetLocationAdapter extends BaseAdapter{
         private Context mContext;
         private List<BSetLocationBean> modelList;
+        private ArrayList<String> photoList;
+
+        public ArrayList<String> getPhotoList() {
+            return photoList;
+        }
+
+        public void setPhotoList(ArrayList<String> photoList) {
+            this.photoList = photoList;
+        }
 
         public List<BSetLocationBean> getModelList() {
             return modelList;
@@ -339,58 +484,177 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
                 viewHolder = new ViewHolder();
                 convertView =  View.inflate(mContext, R.layout.com_location_input_item,null);
                 viewHolder.name_tv = (FormEditText) convertView.findViewById(R.id.name_tv);
-                viewHolder.industry_tv = (TextView) convertView.findViewById(R.id.industry_tv);
+                viewHolder.image_im = (ImageView) convertView.findViewById(R.id.image_im);
+                viewHolder.sTime_rl = (RelativeLayout) convertView.findViewById(R.id.service_time_rl);
+                viewHolder.sTime_et = (FormEditText)convertView.findViewById(R.id.service_time_et);
                 convertView.setTag(viewHolder);
                 viewHolder.name_tv.setFocusable(false);
                 viewHolder.name_tv.setKeyListener(null);
+                viewHolder.sTime_et.setFocusable(false);
+                viewHolder.sTime_et.setKeyListener(null);
+                if("会所".equals(sc_industry) || !CommonUtil.isReleaseVersion())
+                    viewHolder.sTime_rl.setVisibility(View.VISIBLE);
+                else
+                    viewHolder.sTime_et.setVisibility(View.VISIBLE);
             }else {
                 viewHolder = (ViewHolder) convertView.getTag();
             }
             viewHolder.name_tv.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {
-                    doInputName(position);
+                    doInputName(1,position);
                 }
             });
-
-            /*viewHolder.name_tv.addTextChangedListener(new TextWatcher() {
+            viewHolder.sTime_et.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    doInputName(2,position);
+                }
+            });
+      /*     viewHolder.name_tv.addTextChangedListener(new TextWatcher() {
                 @Override
                 public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
                 @Override
                 public void onTextChanged(CharSequence s, int start, int before, int count) {}
                 @Override
                 public void afterTextChanged(Editable s) {
-//                    String strChche =  s.toString().replace(" ", "");//去除空格
-//                    strChche = strChche.replace(" ", " ");//去除空格
-                    if(StringUtil.isEmpty(s.toString())) return;
-                    mList.get(position).setSt_name(s.toString());
+                    String strChche =  s.toString().replace(" ", "");//去除空格
+                    strChche = strChche.replace(" ", " ");//去除空格
+                    if(StringUtil.isEmpty(strChche.toString())) return;
+                    mList.get(position).setSt_name(strChche.toString());
                     myAdapter.notifyDataSetChanged();
                 }
+            });*/
+
+            viewHolder.image_im.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    image_position = position;  //点击的图片位置
+                    if (PermissionUtil.lacksPermissions(ct, Manifest.permission.CAMERA)) {
+                        PermissionUtil.requestPermission(BSettingLocationActivity.this,PermissionUtil.DEFAULT_REQUEST,Manifest.permission.CAMERA);
+                        ToastUtil.showToast(ct,R.string.not_camera_permission);
+                    } else {
+                        showSelectPictureDialog();//添加
+                    }
+                }
             });
-*/
-            if (!ListUtils.isEmpty(modelList)){
+            //显示名称
+            if (!ListUtils.isEmpty(modelList) && !StringUtil.isEmpty(modelList.get(position).getSt_name()))
                 viewHolder.name_tv.setText(modelList.get(position).getSt_name()+"");
-            }
+            else
+                viewHolder.name_tv.setText(null);
+
+            //显示照片
+            if (!ListUtils.isEmpty(photoList) && position < photoList.size() &&
+                    !StringUtil.isEmpty(photoList.get(position)))
+                ImageLoader.getInstance().displayImage(Uri.fromFile(new File(photoList.get(position))).toString(), viewHolder.image_im);
+            else
+                viewHolder.image_im.setImageResource(R.drawable.add_picture); //设置为默认头像不然会被复用
+
+
+            //显示服务时间/分钟
+            if (!ListUtils.isEmpty(modelList) && !StringUtil.isEmpty(modelList.get(position).getSt_servicetime()))
+                viewHolder.sTime_et.setText(modelList.get(position).getSt_servicetime());
+            else
+                viewHolder.sTime_et.setText(null);
+
             return convertView;
         }
         class ViewHolder{
             FormEditText name_tv;
-            TextView industry_tv;
+            ImageView image_im;
+            RelativeLayout sTime_rl;
+            FormEditText sTime_et;
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (requestCode == REQUEST_CODE_CAPTURE_PHOTO) {// 拍照返回
+            if (resultCode == Activity.RESULT_OK) {
+                if (mNewPhotoUri != null) {
+                    String path = mNewPhotoUri.getPath();
+                    addPhotoList(path);
+                } else {
+                    ToastUtil.showToast(this, com.uas.appworks.R.string.c_take_picture_failed);
+                }
+            }
+        }else if (requestCode == REQUEST_CODE_PICK_PHOTO) {// 传统单选方式,选择一张图片,然后立即调用裁减
+            if (resultCode == Activity.RESULT_OK){
+                if (data != null && data.getData() != null){
+                    String path= CameraUtil.getImagePathFromUri(this, data.getData());
+                    addPhotoList(path);
+                }
+            }
+        }
+    }
+
+    private void addPhotoList(String path) {
+        if (image_position > mPhotoList.size() -1){
+            mPhotoList.add(path);
+        }else if (image_position <= mPhotoList.size() -1){
+            mPhotoList.set(image_position,path); //替换
         }
+        myAdapter.notifyDataSetChanged();
+        Log.i("files0x01",path);
     }
+
+    private void showSelectPictureDialog() {
+        String[] items = new String[]{getString(com.uas.appworks.R.string.c_take_picture), getString(com.uas.appworks.R.string.c_photo_album)};
+        AlertDialog.Builder builder = new AlertDialog.Builder(this).setSingleChoiceItems(items, 0,
+                new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+                        if (which == 0) {
+                            try {
+                                takePhoto();
+                            } catch (Exception e) {
+                                String message=e.getMessage();
+                                if (!StringUtil.isEmpty(message)&&message.contains("Permission")){
+                                    ToastUtil.showToast(ct,R.string.not_system_permission);
+                                }
+                            }
+                        } else {
+                            CameraUtil.pickImageSimple(BSettingLocationActivity.this, REQUEST_CODE_PICK_PHOTO);  //传统单选方式
+                        }
+                        dialog.dismiss();
+                    }
+                });
+        builder.show();
+    }
+
+    private void takePhoto() {
+        try {
+            mNewPhotoUri = CameraUtil.getOutputMediaFileUri(this, MyApplication.getInstance().getLoginUserId(), CameraUtil.MEDIA_TYPE_IMAGE);
+            CameraUtil.captureImage(this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
     private PopupWindow popupWindow = null;
-    private void doInputName(final int position) {
+    private void doInputName(final int type, final int position) {
         // 一个自定义的布局,作为显示的内容
         View contentView = LayoutInflater.from(ct).inflate(
                 R.layout.item_edit_location_pop, null);
 
         // 设置按钮的点击事件
         final EditText editname_et = (EditText) contentView.findViewById(R.id.editname_et);
-        TextView cancel_tv = (TextView) contentView.findViewById(R.id.cancel_tv);
-        TextView sure_tv = (TextView) contentView.findViewById(R.id.sure_tv);
-
+        final EditText editname_et2 = (EditText) contentView.findViewById(R.id.editname_et2);
+        TextView title_tv = (TextView) contentView.findViewById(R.id.title_tv);
         editname_et.setText(mList.get(position).getSt_name()+"");
+        editname_et2.setText(mList.get(position).getSt_servicetime()+"");
         DisplayMetrics dm = getResources().getDisplayMetrics();
+        if (type==1) {
+            editname_et.setVisibility(View.VISIBLE);
+            editname_et2.setVisibility(View.GONE);
+            title_tv.setText("请输入服务/场地/房间名称");
+        } else if(type==2) {
+            editname_et.setVisibility(View.GONE);
+            editname_et2.setVisibility(View.VISIBLE);
+            title_tv.setText("请输入服务时间/分钟");
+        }
         int w_screen = dm.widthPixels;
         int h_screen = dm.heightPixels;
         w_screen = DisplayUtil.dip2px(this, 300);
@@ -405,13 +669,20 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
         contentView.findViewById(R.id.sure_tv).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                if (StringUtil.isEmpty(editname_et.getText().toString())){
-                    ToastMessage("请输入服务/场地/房间名称");
-                    return;
-                }else {
-                    mList.get(position).setSt_name(editname_et.getText().toString());
-                    myAdapter.notifyDataSetChanged();
+                if (type==1){
+                    if (StringUtil.isEmpty(editname_et.getText().toString())){
+                        ToastMessage("请输入服务/场地/房间名称");
+                        return;
+                    }else {
+                        mList.get(position).setSt_name(editname_et.getText().toString());
+                        myAdapter.notifyDataSetChanged();
+                    }
+                }else if (type==2){
+                        mList.get(position).setSt_servicetime(
+                                StringUtil.isEmpty(editname_et2.getText().toString()) ? "" :editname_et2.getText().toString());
+                        myAdapter.notifyDataSetChanged();
                 }
+
                 popupWindow.dismiss();
             }
         });

+ 4 - 0
app_modular/appme/src/main/java/com/uas/appme/settings/activity/PersonSettingActivity.java

@@ -358,6 +358,10 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
     }
 
     private void saveJudge() {
+        if (StringUtil.isEmpty(photoselect)) {
+            ToastMessage("请添加头像照片");
+            return;
+        }
         File file=  new File(photoselect);
         if (StringUtil.isEmpty(result)){
             if (!file.exists()) {// 录入时的,且图片文件不存在

+ 3 - 5
app_modular/appme/src/main/java/com/uas/appme/settings/activity/SettingActivity.java

@@ -298,12 +298,10 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
                             businessmen_setting_rl.setVisibility(View.VISIBLE);
                             if (o.toString().contains("url"))
                                 business_iamge = JSON.parseObject(o.toString()).getString("url");
-                        }
-//                        else if (!CommonUtil.isReleaseVersion()) {
-//                            businessmen_setting_rl.setVisibility(View.VISIBLE);
-//                        }
-                        else{
+                        }else if (!CommonUtil.isReleaseVersion()) {
                             businessmen_setting_rl.setVisibility(View.VISIBLE);
+                        }else{
+                            businessmen_setting_rl.setVisibility(View.GONE);
                         }
                     }
                 } catch (Exception e) {

+ 18 - 0
app_modular/appme/src/main/java/com/uas/appme/settings/model/BSetLocationBean.java

@@ -11,6 +11,24 @@ public class BSetLocationBean {
     private String st_companyid;
     private String st_companyname;
     private String st_id;
+    private String st_servicetime;
+    private String st_imageurl;
+
+    public String getSt_imageurl() {
+        return st_imageurl;
+    }
+
+    public void setSt_imageurl(String st_imageurl) {
+        this.st_imageurl = st_imageurl;
+    }
+
+    public String getSt_servicetime() {
+        return st_servicetime;
+    }
+
+    public void setSt_servicetime(String st_servicetime) {
+        this.st_servicetime = st_servicetime;
+    }
 
     public String getSt_id() {
         return st_id;

+ 59 - 21
app_modular/appme/src/main/res/layout/com_location_input_item.xml

@@ -3,8 +3,6 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     xmlns:whatever="http://schemas.android.com/tools"
-    android:layout_marginLeft="25dp"
-    android:layout_marginRight="25dp"
     android:orientation="vertical">
     <TextView
         android:layout_width="wrap_content"
@@ -20,7 +18,8 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:background="@drawable/rl_circular_bg">
+        android:background="@drawable/rl_circular_bg"
+        android:layout_marginBottom="10dp">
 
         <RelativeLayout
             android:id="@id/name_rl"
@@ -72,48 +71,87 @@
         <View
             android:id="@+id/line"
             android:layout_width="match_parent"
-            android:layout_height="2px"
+            android:layout_height="1px"
             android:background="@color/item_line"
             android:layout_below="@+id/position_tv"
-            android:layout_marginLeft="20dp"
-            android:layout_marginRight="20dp"
-            android:visibility="gone"
+            android:visibility="visible"
             />
         <RelativeLayout
+            style="@style/IMTbleLine2"
+            android:minHeight="150dp"
+            android:layout_height="150dp"
+            android:background="@color/white"
+            android:layout_marginTop="10dp">
+            <TextView
+                android:id="@+id/image_tv"
+                style="@style/form_relative_left_text"
+                android:text="照片"
+                android:layout_marginLeft="0dp"
+                android:textColor="@color/text_main"
+                android:textSize="15sp"
+                android:layout_centerVertical="false"
+                />
+            <TextView
+                android:id="@+id/image_tv_"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="点击照片添加/更换"
+                android:textSize="14sp"
+                android:layout_centerHorizontal="true"
+                android:layout_marginBottom="10dp"/>
+            <ImageView
+                android:id="@+id/image_im"
+                android:layout_below="@+id/image_tv_"
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:src="@drawable/add_picture"
+                android:layout_centerInParent="true"/>
+        </RelativeLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:background="@color/item_line"
+            android:layout_below="@+id/position_tv"
+            android:visibility="visible"
+            />
+        <RelativeLayout
+            android:id="@+id/service_time_rl"
             style="@style/IMTbleLine2"
             android:layout_height="50dp"
             android:background="@color/white"
-            android:visibility="gone"
             >
 
             <TextView
-                android:id="@+id/of_add_set_range_text2"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="行业"
+                android:layout_centerVertical="true"
+                android:text="服务时间/分钟"
                 android:textSize="14sp"
-                android:layout_alignParentTop="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentStart="true"
-                android:layout_marginTop="16dp" />
+                />
 
-            <TextView
-                android:id="@+id/industry_tv"
+            <com.andreabaccega.widget.FormEditText
+                android:id="@+id/service_time_et"
                 style="@style/IMTbleLine_TextValue"
                 android:textColor="@color/dark_dark_grey"
                 android:padding="10dp"
-                android:layout_alignBaseline="@+id/of_add_set_range_text2"
-                android:layout_alignBottom="@+id/of_add_set_range_text2"
-                android:layout_toRightOf="@+id/of_add_set_range_text2"
-                android:layout_toEndOf="@+id/of_add_set_range_text2" />
+                android:hint="@string/common_input1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:background="@null"
+                android:textSize="15sp"
+                android:gravity="center_vertical|right"
+                android:inputType="number"
+                />
             <ImageView
-                android:id="@+id/of_add_set_range_img2"
                 android:layout_width="@dimen/next_width"
                 android:layout_height="@dimen/next_height"
                 android:layout_alignParentRight="true"
                 android:layout_centerVertical="true"
                 android:background="@drawable/oa_next"
                 android:contentDescription="@string/app_name"
+                android:visibility="gone"
                 />
         </RelativeLayout>
     </LinearLayout>

+ 2 - 3
app_modular/appme/src/main/res/layout/com_location_item.xml

@@ -2,8 +2,6 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_marginLeft="25dp"
-    android:layout_marginRight="25dp"
     android:orientation="vertical"
     >
     <TextView
@@ -20,7 +18,8 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:background="@drawable/rl_circular_bg">
+        android:background="@drawable/rl_circular_bg"
+        android:layout_marginBottom="10dp">
 
         <RelativeLayout
             android:id="@id/name_rl"

+ 14 - 1
app_modular/appme/src/main/res/layout/item_edit_location_pop.xml

@@ -42,7 +42,20 @@
             android:hint="@string/common_input"
             android:textColor="@color/text_main"
             android:textSize="@dimen/text_main"
-            android:gravity="center_horizontal"/>
+            android:gravity="center_horizontal"
+            />
+        <EditText
+            android:id="@+id/editname_et2"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@null"
+            android:ellipsize="end"
+            android:maxLines="1"
+            android:hint="@string/common_input2"
+            android:textColor="@color/text_main"
+            android:textSize="@dimen/text_main"
+            android:gravity="center_horizontal"
+            android:inputType="number"/>
     </LinearLayout>
 
 

+ 6 - 2
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/ExpenseReimbursementActivity.java

@@ -1940,8 +1940,12 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
     }
 
     private void takePhoto() {
-        mNewPhotoUri = CameraUtil.getOutputMediaFileUri(this,MyApplication.getInstance().getLoginUserId(), CameraUtil.MEDIA_TYPE_IMAGE);
-        CameraUtil.captureImage(this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
+        try {
+            mNewPhotoUri = CameraUtil.getOutputMediaFileUri(this, MyApplication.getInstance().getLoginUserId(), CameraUtil.MEDIA_TYPE_IMAGE);
+            CameraUtil.captureImage(this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
     private int Max_Size = 9;
     private void selectPhoto() {