d
This commit is contained in:
@@ -35,6 +35,10 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
|
||||||
|
!--声明SD卡读写权限-->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".BaseApplication"
|
android:name=".BaseApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.database.SQLException;
|
|||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
import com.fenghoo.seven.db.DbRecordBeanData;
|
import com.fenghoo.seven.db.DbRecordBeanData;
|
||||||
|
import com.fenghoo.seven.main.kehu.Bean.addCustomerBean;
|
||||||
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
|
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
|
||||||
import com.j256.ormlite.dao.Dao;
|
import com.j256.ormlite.dao.Dao;
|
||||||
import com.j256.ormlite.support.ConnectionSource;
|
import com.j256.ormlite.support.ConnectionSource;
|
||||||
@@ -62,6 +63,7 @@ public class DataBaseHelper extends OrmLiteSqliteOpenHelper {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
TableUtils.createTable(connectionSource, DbRecordBeanData.class);
|
TableUtils.createTable(connectionSource, DbRecordBeanData.class);
|
||||||
|
TableUtils.createTable(connectionSource, addCustomerBean.class);
|
||||||
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
120
app/src/main/java/com/fenghoo/seven/db/dao/addCustomerDao.java
Normal file
120
app/src/main/java/com/fenghoo/seven/db/dao/addCustomerDao.java
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
package com.fenghoo.seven.db.dao;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.SQLException;
|
||||||
|
|
||||||
|
import com.fenghoo.seven.db.DbRecordBeanData;
|
||||||
|
import com.fenghoo.seven.main.kehu.Bean.addCustomerBean;
|
||||||
|
import com.j256.ormlite.dao.Dao;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class addCustomerDao {
|
||||||
|
private static Dao<addCustomerBean, Integer> userAccountDao;
|
||||||
|
|
||||||
|
public addCustomerDao(Context mContext) {
|
||||||
|
DataBaseHelper dataBaseHelper = DataBaseHelper.getInstance(mContext);
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
userAccountDao = dataBaseHelper.getDao(addCustomerBean.class);
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public long addInsert(addCustomerBean userData) {
|
||||||
|
int id = 0;
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
id = userAccountDao.create(userData);
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<addCustomerBean> queryByCustom(String columnName, String columnValue) {
|
||||||
|
List<addCustomerBean> ormTables = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
ormTables = userAccountDao.queryBuilder().where().eq(columnName, columnValue).query();
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ormTables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<addCustomerBean> queryByCustomtwo(String columnName, String columnValue) {
|
||||||
|
List<addCustomerBean> ormTables = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
// ormTables = userAccountDao.queryBuilder().where().eq(columnName, columnValue).query();
|
||||||
|
ormTables= userAccountDao.queryBuilder().where().like("phone", "%"+columnValue+"%").or().like("name","%"+columnValue+"%").query();
|
||||||
|
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ormTables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateData(addCustomerBean userData) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
int result = userAccountDao.update(userData);
|
||||||
|
if (result != -1) {
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<addCustomerBean> queryInByCustom(String columnName, String columnValues){
|
||||||
|
List<addCustomerBean> ormTables = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
List<String> strings = Arrays.asList(columnValues.split(","));
|
||||||
|
|
||||||
|
ormTables = userAccountDao.queryBuilder().where().in(columnName,strings ).query();
|
||||||
|
}catch (java.sql.SQLException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return ormTables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<addCustomerBean> queryAll() {
|
||||||
|
ArrayList<addCustomerBean> userAccountList = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
userAccountList = (ArrayList<addCustomerBean>) userAccountDao.queryForAll();
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return userAccountList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long delete(List<addCustomerBean> DATA){
|
||||||
|
int id = 0;
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
id = userAccountDao.delete(DATA);
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,27 +1,32 @@
|
|||||||
package com.fenghoo.seven.main.find;
|
package com.fenghoo.seven.main.find;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import com.fenghoo.seven.R;
|
import com.fenghoo.seven.R;
|
||||||
import com.fenghoo.seven.base.BaseActivity;
|
import com.fenghoo.seven.base.BaseActivity;
|
||||||
|
import com.fenghoo.seven.db.dao.addCustomerDao;
|
||||||
import com.fenghoo.seven.dialog.BaseTipsDialog;
|
import com.fenghoo.seven.dialog.BaseTipsDialog;
|
||||||
import com.fenghoo.seven.main.find.entity.SixEvent;
|
|
||||||
import com.fenghoo.seven.main.find.entity.privateListBean;
|
import com.fenghoo.seven.main.find.entity.privateListBean;
|
||||||
import com.fenghoo.seven.main.kehu.Bean.IndustryBeantwo;
|
import com.fenghoo.seven.main.kehu.Bean.addCustomerBean;
|
||||||
|
import com.fenghoo.seven.utils.AbStrUtil;
|
||||||
import com.fenghoo.seven.widget.TitleBar;
|
import com.fenghoo.seven.widget.TitleBar;
|
||||||
|
|
||||||
import de.greenrobot.event.EventBus;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会话
|
* 会话
|
||||||
*/
|
*/
|
||||||
public class ConversationActivity extends BaseActivity {
|
public class ConversationActivity extends BaseActivity {
|
||||||
private TitleBar mTitleBar;
|
private TitleBar mTitleBar;
|
||||||
private String issuccess="1";
|
private String issuccess = "1";
|
||||||
private privateListBean.ResultBean.DataBean dataBean;
|
private privateListBean.ResultBean.DataBean dataBean;
|
||||||
|
private addCustomerDao addCustomerdao;
|
||||||
|
private addCustomerBean addCustomerBean;
|
||||||
|
private ArrayList<addCustomerBean> addCustomerBeans;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -29,8 +34,8 @@ public class ConversationActivity extends BaseActivity {
|
|||||||
setContentView(R.layout.activity_conversation);
|
setContentView(R.layout.activity_conversation);
|
||||||
mTitleBar = findViewById(R.id.title_bar);
|
mTitleBar = findViewById(R.id.title_bar);
|
||||||
initNormalBack();
|
initNormalBack();
|
||||||
EventBus.getDefault().register(this);
|
addCustomerdao = new addCustomerDao(this);
|
||||||
// String private_id = getIntent().getStringExtra("private_id");
|
// String private_id = getIntent().getStringExtra("private_id");
|
||||||
dataBean = (privateListBean.ResultBean.DataBean) getIntent().getSerializableExtra("dataBean");
|
dataBean = (privateListBean.ResultBean.DataBean) getIntent().getSerializableExtra("dataBean");
|
||||||
String private_id = dataBean.getPrivate_id();
|
String private_id = dataBean.getPrivate_id();
|
||||||
String dy_uid = dataBean.getDy_uid();
|
String dy_uid = dataBean.getDy_uid();
|
||||||
@@ -38,14 +43,7 @@ public class ConversationActivity extends BaseActivity {
|
|||||||
String nick_img = dataBean.getNick_img();
|
String nick_img = dataBean.getNick_img();
|
||||||
|
|
||||||
mTitleBar.setTitle(nick_name);
|
mTitleBar.setTitle(nick_name);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.container,new QuestionsFragment(private_id,dy_uid,nick_img)).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.container, new QuestionsFragment(private_id, dy_uid, nick_img)).commit();
|
||||||
}
|
|
||||||
|
|
||||||
public void onEvent(SixEvent event) {
|
|
||||||
if (null != event ) {
|
|
||||||
issuccess = event.getIssuccess();
|
|
||||||
Log.e("添加客户成功了==",issuccess);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,30 +56,79 @@ public class ConversationActivity extends BaseActivity {
|
|||||||
iv_back.setOnClickListener(new View.OnClickListener() {
|
iv_back.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(!issuccess.equals("0")) {
|
goback();
|
||||||
//弹出对话框
|
|
||||||
new BaseTipsDialog().showDownloadDialog(ConversationActivity.this, "您没有完成添加客户<br />返回将不保存您添加的信息<br />确定返回吗?", "确定", new BaseTipsDialog.ClickListener() {
|
|
||||||
@Override
|
|
||||||
public void confirm() {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void cancle() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @description 返回的方法
|
||||||
|
* @param
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private void goback() {
|
||||||
|
//从数据库里取
|
||||||
|
addCustomerBeans = addCustomerdao.queryAll();
|
||||||
|
if (addCustomerBeans.size() > 0) {
|
||||||
|
addCustomerBean = addCustomerBeans.get(0);
|
||||||
|
}else {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!AbStrUtil.isEmpty(addCustomerBean.getName())) {
|
||||||
|
//弹出对话框
|
||||||
|
alert();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!AbStrUtil.isEmpty(addCustomerBean.getPhone())) {
|
||||||
|
alert();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!AbStrUtil.isEmpty(addCustomerBean.getWechat())) {
|
||||||
|
alert();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!AbStrUtil.isEmpty(addCustomerBean.getAddress())) {
|
||||||
|
alert();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!AbStrUtil.isEmpty(addCustomerBean.getStyle_id())) {
|
||||||
|
alert();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!AbStrUtil.isEmpty(addCustomerBean.getBudget())) {
|
||||||
|
alert();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void alert() {
|
||||||
|
new BaseTipsDialog().showDownloadDialog(ConversationActivity.this, "您没有完成添加客户<br />返回将不保存您添加的信息<br />确定返回吗?", "确定", new BaseTipsDialog.ClickListener() {
|
||||||
|
@Override
|
||||||
|
public void confirm() {
|
||||||
|
addCustomerdao.delete(addCustomerBeans);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancle() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
goback();
|
||||||
|
}
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
EventBus.getDefault().unregister(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,16 @@ public class addCustomerBean {
|
|||||||
@DatabaseField(columnName = "name")
|
@DatabaseField(columnName = "name")
|
||||||
private String name="";
|
private String name="";
|
||||||
|
|
||||||
|
public String getStyle_name() {
|
||||||
|
return style_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStyle_name(String style_name) {
|
||||||
|
this.style_name = style_name;
|
||||||
|
}
|
||||||
|
@DatabaseField(columnName = "style_name")
|
||||||
|
private String style_name;
|
||||||
|
|
||||||
public String getUid() {
|
public String getUid() {
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package com.fenghoo.seven.main.kehu.activity;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import com.fenghoo.seven.R;
|
import com.fenghoo.seven.R;
|
||||||
import com.fenghoo.seven.base.BaseActivity;
|
import com.fenghoo.seven.base.BaseActivity;
|
||||||
|
import com.fenghoo.seven.db.dao.addCustomerDao;
|
||||||
import com.fenghoo.seven.main.kehu.fragment.AddCusFragment;
|
import com.fenghoo.seven.main.kehu.fragment.AddCusFragment;
|
||||||
import com.fenghoo.seven.utils.StatusBarUtil;
|
import com.fenghoo.seven.utils.StatusBarUtil;
|
||||||
import com.fenghoo.seven.widget.TitleBar;
|
import com.fenghoo.seven.widget.TitleBar;
|
||||||
@@ -25,7 +27,9 @@ public class AddCustDialogActivity extends BaseActivity {
|
|||||||
private String search="";
|
private String search="";
|
||||||
private String pagetype="";
|
private String pagetype="";
|
||||||
private String dy_uid="";
|
private String dy_uid="";
|
||||||
|
private FragmentBackListener backListener;
|
||||||
|
private boolean isInterception = true;
|
||||||
|
private addCustomerDao addCustomerdao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -38,7 +42,8 @@ public class AddCustDialogActivity extends BaseActivity {
|
|||||||
search = getIntent().getStringExtra("search");
|
search = getIntent().getStringExtra("search");
|
||||||
pagetype = getIntent().getStringExtra("pagetype");
|
pagetype = getIntent().getStringExtra("pagetype");
|
||||||
dy_uid = getIntent().getStringExtra("dy_uid");
|
dy_uid = getIntent().getStringExtra("dy_uid");
|
||||||
addCusFragment = new AddCusFragment(customer_id,source,search,pagetype,dy_uid,null);
|
addCustomerdao = new addCustomerDao(this);
|
||||||
|
addCusFragment = new AddCusFragment(customer_id,source,search,pagetype,dy_uid,null, addCustomerdao);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.containerrr,addCusFragment).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.containerrr,addCusFragment).commit();
|
||||||
|
|
||||||
findViewById(R.id.btn_comit).setOnClickListener(new View.OnClickListener() {
|
findViewById(R.id.btn_comit).setOnClickListener(new View.OnClickListener() {
|
||||||
@@ -57,6 +62,7 @@ public class AddCustDialogActivity extends BaseActivity {
|
|||||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||||
lp.gravity = Gravity.TOP;//设置对话框置顶显示
|
lp.gravity = Gravity.TOP;//设置对话框置顶显示
|
||||||
win.setAttributes(lp);
|
win.setAttributes(lp);
|
||||||
|
setBackListener(addCusFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -66,4 +72,39 @@ public class AddCustDialogActivity extends BaseActivity {
|
|||||||
addCusFragment.Result(data);
|
addCusFragment.Result(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FragmentBackListener getBackListener() {
|
||||||
|
return backListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackListener(FragmentBackListener backListener) {
|
||||||
|
this.backListener = backListener;
|
||||||
|
}
|
||||||
|
public boolean isInterception() {
|
||||||
|
return isInterception;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterception(boolean isInterception) {
|
||||||
|
this.isInterception = isInterception;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
|
||||||
|
if (isInterception()) {
|
||||||
|
if (backListener != null) {
|
||||||
|
backListener.onbackForward();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface FragmentBackListener {
|
||||||
|
void onbackForward();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ public class AddCustomerActivity extends BaseActivity {
|
|||||||
CustomerListBean.ResultBean.DataBean dataBean = (CustomerListBean.ResultBean.DataBean) getIntent().getSerializableExtra("dataBean");
|
CustomerListBean.ResultBean.DataBean dataBean = (CustomerListBean.ResultBean.DataBean) getIntent().getSerializableExtra("dataBean");
|
||||||
customer_id = dataBean.getCustomer_id();
|
customer_id = dataBean.getCustomer_id();
|
||||||
source = dataBean.getSource();
|
source = dataBean.getSource();
|
||||||
addCusFragment = new AddCusFragment(this.customer_id, this.source, this.search,pagetype,"",dataBean);
|
addCusFragment = new AddCusFragment(this.customer_id, this.source, this.search,pagetype,"",dataBean,null);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.containerrr,addCusFragment).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.containerrr,addCusFragment).commit();
|
||||||
findViewById(R.id.btn_comit).setOnClickListener(new View.OnClickListener() {
|
findViewById(R.id.btn_comit).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.fenghoo.seven.main.kehu.activity;
|
package com.fenghoo.seven.main.kehu.activity;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
@@ -10,12 +9,11 @@ import android.widget.TextView;
|
|||||||
import com.fenghoo.seven.R;
|
import com.fenghoo.seven.R;
|
||||||
import com.fenghoo.seven.base.BaseActivity;
|
import com.fenghoo.seven.base.BaseActivity;
|
||||||
import com.fenghoo.seven.main.find.entity.ThreeEvent;
|
import com.fenghoo.seven.main.find.entity.ThreeEvent;
|
||||||
import com.fenghoo.seven.main.kehu.Bean.SecondEvent;
|
|
||||||
import com.fenghoo.seven.main.kehu.adapter.SearchAdapter;
|
import com.fenghoo.seven.main.kehu.adapter.SearchAdapter;
|
||||||
import com.fenghoo.seven.utils.BaseAdapter;
|
import com.fenghoo.seven.utils.BaseAdapter;
|
||||||
import com.fenghoo.seven.utils.LocatData;
|
import com.fenghoo.seven.utils.LocatData;
|
||||||
import com.fenghoo.seven.utils.ToastUtils;
|
|
||||||
import com.fenghoo.seven.widget.ListViewForScrollView;
|
import com.fenghoo.seven.widget.ListViewForScrollView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import de.greenrobot.event.EventBus;
|
import de.greenrobot.event.EventBus;
|
||||||
@@ -26,7 +24,6 @@ public class SearchActivity extends BaseActivity implements View.OnClickListener
|
|||||||
TextView tvEmpty;
|
TextView tvEmpty;
|
||||||
ListViewForScrollView lvItem;
|
ListViewForScrollView lvItem;
|
||||||
SearchAdapter mAdapter;
|
SearchAdapter mAdapter;
|
||||||
boolean isGoods = false;
|
|
||||||
private TextView mTvCancel;
|
private TextView mTvCancel;
|
||||||
private RelativeLayout bt_sousuo_ditu;
|
private RelativeLayout bt_sousuo_ditu;
|
||||||
private String pagetype;
|
private String pagetype;
|
||||||
@@ -102,11 +99,7 @@ public class SearchActivity extends BaseActivity implements View.OnClickListener
|
|||||||
etSearch.setHint("请输入客户姓名、电话");
|
etSearch.setHint("请输入客户姓名、电话");
|
||||||
break;
|
break;
|
||||||
case R.id.tvEmpty: //清空历史搜索记录
|
case R.id.tvEmpty: //清空历史搜索记录
|
||||||
if (isGoods) {
|
LocatData.Init().clearGood();
|
||||||
LocatData.Init().clearGood();
|
|
||||||
} else {
|
|
||||||
LocatData.Init().clearPost();
|
|
||||||
}
|
|
||||||
mAdapter.setList(new ArrayList<String>());
|
mAdapter.setList(new ArrayList<String>());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.fenghoo.seven.utils.JsonUtils;
|
|
||||||
import com.fenghoo.seven.R;
|
import com.fenghoo.seven.R;
|
||||||
import com.fenghoo.seven.base.BaseBean;
|
import com.fenghoo.seven.base.BaseBean;
|
||||||
|
import com.fenghoo.seven.db.dao.addCustomerDao;
|
||||||
import com.fenghoo.seven.main.find.entity.SixEvent;
|
import com.fenghoo.seven.main.find.entity.SixEvent;
|
||||||
import com.fenghoo.seven.main.find.entity.ThreeEvent;
|
import com.fenghoo.seven.main.find.entity.ThreeEvent;
|
||||||
import com.fenghoo.seven.main.kehu.Bean.CustomerListBean;
|
import com.fenghoo.seven.main.kehu.Bean.CustomerListBean;
|
||||||
@@ -25,6 +25,7 @@ import com.fenghoo.seven.main.kehu.Bean.FirstEvent;
|
|||||||
import com.fenghoo.seven.main.kehu.Bean.LabelBean;
|
import com.fenghoo.seven.main.kehu.Bean.LabelBean;
|
||||||
import com.fenghoo.seven.main.kehu.Bean.SecondEvent;
|
import com.fenghoo.seven.main.kehu.Bean.SecondEvent;
|
||||||
import com.fenghoo.seven.main.kehu.Bean.addCustomerBean;
|
import com.fenghoo.seven.main.kehu.Bean.addCustomerBean;
|
||||||
|
import com.fenghoo.seven.main.kehu.activity.AddCustDialogActivity;
|
||||||
import com.fenghoo.seven.main.kehu.activity.ShowAty;
|
import com.fenghoo.seven.main.kehu.activity.ShowAty;
|
||||||
import com.fenghoo.seven.main.kehu.adapter.AddCusAdapter;
|
import com.fenghoo.seven.main.kehu.adapter.AddCusAdapter;
|
||||||
import com.fenghoo.seven.okgonet.NetApi;
|
import com.fenghoo.seven.okgonet.NetApi;
|
||||||
@@ -33,6 +34,7 @@ import com.fenghoo.seven.utils.AbImageUtil;
|
|||||||
import com.fenghoo.seven.utils.AbStrUtil;
|
import com.fenghoo.seven.utils.AbStrUtil;
|
||||||
import com.fenghoo.seven.utils.GlideTools;
|
import com.fenghoo.seven.utils.GlideTools;
|
||||||
import com.fenghoo.seven.utils.ImageUtils;
|
import com.fenghoo.seven.utils.ImageUtils;
|
||||||
|
import com.fenghoo.seven.utils.JsonUtils;
|
||||||
import com.fenghoo.seven.utils.PhonenNumUtil;
|
import com.fenghoo.seven.utils.PhonenNumUtil;
|
||||||
import com.fenghoo.seven.utils.ToastUtils;
|
import com.fenghoo.seven.utils.ToastUtils;
|
||||||
import com.fenghoo.seven.utils.WidgetTools;
|
import com.fenghoo.seven.utils.WidgetTools;
|
||||||
@@ -62,7 +64,7 @@ import top.zibin.luban.OnCompressListener;
|
|||||||
/**
|
/**
|
||||||
* 添加客户
|
* 添加客户
|
||||||
*/
|
*/
|
||||||
public class AddCusFragment extends MobanFragment implements View.OnClickListener{
|
public class AddCusFragment extends MobanFragment implements View.OnClickListener, AddCustDialogActivity.FragmentBackListener {
|
||||||
|
|
||||||
private RecyclerView recy_10;
|
private RecyclerView recy_10;
|
||||||
private String selectType="1";
|
private String selectType="1";
|
||||||
@@ -86,8 +88,9 @@ public class AddCusFragment extends MobanFragment implements View.OnClickListene
|
|||||||
private String dy_uid;
|
private String dy_uid;
|
||||||
private ArrayList<LabelBean> label=new ArrayList<>();
|
private ArrayList<LabelBean> label=new ArrayList<>();
|
||||||
CustomerListBean.ResultBean.DataBean dataBean;
|
CustomerListBean.ResultBean.DataBean dataBean;
|
||||||
|
addCustomerDao addCustomerdao;
|
||||||
|
|
||||||
public AddCusFragment(String customer_id, String source, String search, String pagetype,String dy_uid, CustomerListBean.ResultBean.DataBean dataBean) {
|
public AddCusFragment(String customer_id, String source, String search, String pagetype,String dy_uid, CustomerListBean.ResultBean.DataBean dataBean,addCustomerDao addCustomerdao ) {
|
||||||
super();
|
super();
|
||||||
this.customer_id=customer_id;
|
this.customer_id=customer_id;
|
||||||
this.source=source;
|
this.source=source;
|
||||||
@@ -95,8 +98,10 @@ public class AddCusFragment extends MobanFragment implements View.OnClickListene
|
|||||||
this.pagetype=pagetype;//pagetype为""说明是信息完善,否则是添加客户
|
this.pagetype=pagetype;//pagetype为""说明是信息完善,否则是添加客户
|
||||||
this.dy_uid=dy_uid;
|
this.dy_uid=dy_uid;
|
||||||
this.dataBean=dataBean;
|
this.dataBean=dataBean;
|
||||||
|
this.addCustomerdao=addCustomerdao;
|
||||||
addCustomerBean = new addCustomerBean();
|
addCustomerBean = new addCustomerBean();
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @description 接收选择的风格id
|
* @description 接收选择的风格id
|
||||||
@@ -107,6 +112,7 @@ public class AddCusFragment extends MobanFragment implements View.OnClickListene
|
|||||||
if (null != event ) {
|
if (null != event ) {
|
||||||
String style_id = event.getMsg();
|
String style_id = event.getMsg();
|
||||||
addCustomerBean.setStyle_id(style_id);
|
addCustomerBean.setStyle_id(style_id);
|
||||||
|
addCustomerBean.setStyle_name(event.getStyle());
|
||||||
textView12.setText(event.getStyle());
|
textView12.setText(event.getStyle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,12 +159,44 @@ public class AddCusFragment extends MobanFragment implements View.OnClickListene
|
|||||||
if(pagetype.equals("0")||pagetype.equals("1")||pagetype.equals("2")||pagetype.equals("3")){
|
if(pagetype.equals("0")||pagetype.equals("1")||pagetype.equals("2")||pagetype.equals("3")){
|
||||||
//添加客户
|
//添加客户
|
||||||
label = addData("1","0","0");
|
label = addData("1","0","0");
|
||||||
|
if(pagetype.equals("3")){
|
||||||
|
//从数据库里取
|
||||||
|
ArrayList<com.fenghoo.seven.main.kehu.Bean.addCustomerBean> addCustomerBeans = addCustomerdao.queryAll();
|
||||||
|
if(addCustomerBeans.size()>0){
|
||||||
|
|
||||||
|
|
||||||
|
com.fenghoo.seven.main.kehu.Bean.addCustomerBean addCustomerBean = addCustomerBeans.get(0);
|
||||||
|
Log.e("数据的个数==", addCustomerBeans.size()+"");
|
||||||
|
WidgetTools.setTextsix(textView0, "", addCustomerBean.getName());
|
||||||
|
WidgetTools.setTextsix(textView4, "", addCustomerBean.getPhone());
|
||||||
|
WidgetTools.setTextsix(textView6, "", addCustomerBean.getWechat());
|
||||||
|
WidgetTools.setTextsix(textView8, "", addCustomerBean.getAddress());
|
||||||
|
GlideTools.init(mContext).displaypic(imageView, addCustomerBean.getHeadimg(), R.mipmap.icon_default_head);
|
||||||
|
this.addCustomerBean.setHeadimg(addCustomerBean.getHeadimg());
|
||||||
|
String decoration = addCustomerBean.getDecoration();
|
||||||
|
switch (decoration) {
|
||||||
|
case "1":
|
||||||
|
label = addData("1","0","0");
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
label = addData("0","1","0");
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
label = addData("0","0","1");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
WidgetTools.setTextsix(textView12, "", addCustomerBean.getStyle_name());
|
||||||
|
this.addCustomerBean.setStyle_id(addCustomerBean.getStyle_id());
|
||||||
|
WidgetTools.setTextsix(textView14, "", addCustomerBean.getBudget());
|
||||||
|
this.addCustomerBean.setBudget(addCustomerBean.getBudget());
|
||||||
|
}
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
//完善信息
|
//完善信息
|
||||||
WidgetTools.setTextfive(textView0, "", dataBean.getName());
|
WidgetTools.setTextsix(textView0, "", dataBean.getName());
|
||||||
WidgetTools.setTextfive(textView4, "", dataBean.getPhone());
|
WidgetTools.setTextsix(textView4, "", dataBean.getPhone());
|
||||||
WidgetTools.setTextfive(textView6, "", dataBean.getWechat());
|
WidgetTools.setTextsix(textView6, "", dataBean.getWechat());
|
||||||
WidgetTools.setTextfive(textView8, "", dataBean.getAddress());
|
WidgetTools.setTextsix(textView8, "", dataBean.getAddress());
|
||||||
GlideTools.init(mContext).displaypic(imageView, dataBean.getHeadimg(), R.mipmap.icon_default_head);
|
GlideTools.init(mContext).displaypic(imageView, dataBean.getHeadimg(), R.mipmap.icon_default_head);
|
||||||
addCustomerBean.setHeadimg(dataBean.getHeadimg());
|
addCustomerBean.setHeadimg(dataBean.getHeadimg());
|
||||||
String decoration = dataBean.getDecoration();
|
String decoration = dataBean.getDecoration();
|
||||||
@@ -166,7 +204,6 @@ public class AddCusFragment extends MobanFragment implements View.OnClickListene
|
|||||||
case "1":
|
case "1":
|
||||||
label = addData("1","0","0");
|
label = addData("1","0","0");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "2":
|
case "2":
|
||||||
label = addData("0","1","0");
|
label = addData("0","1","0");
|
||||||
break;
|
break;
|
||||||
@@ -174,9 +211,9 @@ public class AddCusFragment extends MobanFragment implements View.OnClickListene
|
|||||||
label = addData("0","0","1");
|
label = addData("0","0","1");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
WidgetTools.setTextfive(textView12, "", dataBean.getStyle_name());
|
WidgetTools.setTextsix(textView12, "", dataBean.getStyle_name());
|
||||||
addCustomerBean.setStyle_id(dataBean.getStyle_id());
|
addCustomerBean.setStyle_id(dataBean.getStyle_id());
|
||||||
WidgetTools.setTextfive(textView14, "", dataBean.getBudget());
|
WidgetTools.setTextsix(textView14, "", dataBean.getBudget());
|
||||||
addCustomerBean.setBudget(dataBean.getBudget());
|
addCustomerBean.setBudget(dataBean.getBudget());
|
||||||
}
|
}
|
||||||
setLabel(label);
|
setLabel(label);
|
||||||
@@ -214,6 +251,7 @@ public class AddCusFragment extends MobanFragment implements View.OnClickListene
|
|||||||
ToastUtils.showToast(mContext, "请输入正确的电话号码");
|
ToastUtils.showToast(mContext, "请输入正确的电话号码");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//网络请求提交数据
|
//网络请求提交数据
|
||||||
new NetApi().addCustomer(addCustomerBean.getUid(),addCustomerBean.getHeadimg(),addCustomerBean.getName(),addCustomerBean.getPhone(),addCustomerBean.getWechat(),addCustomerBean.getAddress(),addCustomerBean.getDecoration(),addCustomerBean.getStyle_id(),addCustomerBean.getBudget(),addCustomerBean.getSource(),addCustomerBean.getCustomer_id(),dy_uid).subscribe(new Observer<Response>() {
|
new NetApi().addCustomer(addCustomerBean.getUid(),addCustomerBean.getHeadimg(),addCustomerBean.getName(),addCustomerBean.getPhone(),addCustomerBean.getWechat(),addCustomerBean.getAddress(),addCustomerBean.getDecoration(),addCustomerBean.getStyle_id(),addCustomerBean.getBudget(),addCustomerBean.getSource(),addCustomerBean.getCustomer_id(),dy_uid).subscribe(new Observer<Response>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -223,8 +261,6 @@ public class AddCusFragment extends MobanFragment implements View.OnClickListene
|
|||||||
if(result.getSuccess()==0){
|
if(result.getSuccess()==0){
|
||||||
//通知客户列表刷新数据
|
//通知客户列表刷新数据
|
||||||
EventBus.getDefault().post(new ThreeEvent("0",search));
|
EventBus.getDefault().post(new ThreeEvent("0",search));
|
||||||
//通知会话页面添加客户是否成功
|
|
||||||
EventBus.getDefault().post(new SixEvent("0"));
|
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}else {
|
}else {
|
||||||
String msg = result.getMsg();
|
String msg = result.getMsg();
|
||||||
@@ -437,4 +473,30 @@ public class AddCusFragment extends MobanFragment implements View.OnClickListene
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
EventBus.getDefault().unregister(this);
|
EventBus.getDefault().unregister(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onbackForward() {
|
||||||
|
Log.e("系统返回键","sdf");
|
||||||
|
//存入数据
|
||||||
|
addCustomerBean.setId(0+"");
|
||||||
|
addCustomerBean.setName(textView0.getText().toString());
|
||||||
|
addCustomerBean.setPhone(textView4.getText().toString());
|
||||||
|
addCustomerBean.setWechat(textView6.getText().toString());
|
||||||
|
addCustomerBean.setAddress(textView8.getText().toString());
|
||||||
|
addCustomerBean.setSource(source);
|
||||||
|
addCustomerBean.setUid(ProfileSpUtils.getInstance().getUserProfie().getData().getUuid());
|
||||||
|
addCustomerBean.setCustomer_id(customer_id);
|
||||||
|
for(int i=0;i<label.size();i++){
|
||||||
|
LabelBean labelBean = label.get(i);
|
||||||
|
if(labelBean.getIf_sel_del().equals("1")){
|
||||||
|
addCustomerBean.setDecoration(labelBean.getDecorationid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (null != addCustomerdao.queryByCustom("Id", addCustomerBean.getId()) && addCustomerdao.queryByCustom("Id", addCustomerBean.getId()).size() > 0) {
|
||||||
|
addCustomerdao.updateData(addCustomerBean);
|
||||||
|
} else {
|
||||||
|
addCustomerdao.addInsert(addCustomerBean);
|
||||||
|
}
|
||||||
|
getActivity().finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,13 @@ public class WidgetTools {
|
|||||||
}
|
}
|
||||||
public static void setTextsix(TextView tv,String mctext, String text) {
|
public static void setTextsix(TextView tv,String mctext, String text) {
|
||||||
if ("null".equals(text) || "".equals(text)||null == text) {
|
if ("null".equals(text) || "".equals(text)||null == text) {
|
||||||
setText(tv, mctext+"00:00", mctext+"00:00");
|
setText(tv, mctext+"", mctext+"");
|
||||||
} else {
|
} else {
|
||||||
setText(tv,mctext+text, mctext+"00:00");
|
setText(tv,mctext+text, mctext+"");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Title: setText
|
* @Title: setText
|
||||||
* @Description: TODO 设置TextView的text
|
* @Description: TODO 设置TextView的text
|
||||||
|
|||||||
Reference in New Issue
Block a user