OneZero第二周第三次站立会议(2016.3.30)
Posted 山木枝&夏
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OneZero第二周第三次站立会议(2016.3.30)相关的知识,希望对你有一定的参考价值。
会议时间:2016年3月30日 13:00~13:20
会议成员:冉华,张敏,王巍,夏一鸣。
会议目的:汇报前一天工作,全体成员评论,确定会后修改内容或分配下一步任务。
会议内容:
1.前端,完成功能点为“将获取信息转化为中端所需格式”,“发送获取的信息给中端”。以下是代码部分
1 package com.onezero.account; 2 3 import java.text.ParseException; 4 import java.text.SimpleDateFormat; 5 import java.util.Date; 6 7 import com.onezero.account.controller.Account; 8 import com.onezero.account.controller.AccountManager; 9 import com.onezero.account.controller.AccountManagerImpl; 10 11 import android.app.Activity; 12 import android.os.Bundle; 13 import android.util.Log; 14 import android.view.Menu; 15 import android.view.MenuItem; 16 import android.view.View; 17 import android.widget.Button; 18 import android.widget.EditText; 19 import android.widget.TextView; 20 import android.widget.Toast; 21 22 public class add extends Activity { 23 24 @Override 25 protected void onCreate(Bundle savedInstanceState) { 26 super.onCreate(savedInstanceState); 27 setContentView(R.layout.add_main); 28 // 显示当前时间 29 SimpleDateFormat formatter = new SimpleDateFormat( 30 "yyyy年MM月dd日 HH:mm:ss"); 31 Date curDate = new Date(System.currentTimeMillis());// 获取当前时间 32 String str = formatter.format(curDate); 33 34 TextView mTime = (TextView) findViewById(R.id.mytime); 35 mTime.setText(str); 36 37 // 实现事件类型选择,点击并改变显示。 38 final TextView accounttype = (TextView) findViewById(R.id.accounttype); 39 // 一般 40 Button button1 = (Button) findViewById(R.id.button1); 41 button1.setOnClickListener(new Button.OnClickListener() { 42 public void onClick(View v) { 43 Button button1 = (Button) findViewById(R.id.button1); 44 accounttype.setText(button1.getText()); 45 46 } 47 }); 48 // 餐饮 49 Button button2 = (Button) findViewById(R.id.button2); 50 button2.setOnClickListener(new Button.OnClickListener() { 51 public void onClick(View v) { 52 Button button2 = (Button) findViewById(R.id.button2); 53 accounttype.setText(button2.getText()); 54 55 } 56 }); 57 58 // 购物 59 Button button3 = (Button) findViewById(R.id.button3); 60 button3.setOnClickListener(new Button.OnClickListener() { 61 public void onClick(View v) { 62 Button button3 = (Button) findViewById(R.id.button3); 63 accounttype.setText(button3.getText()); 64 65 } 66 }); 67 // 交通 68 Button button4 = (Button) findViewById(R.id.button4); 69 button4.setOnClickListener(new Button.OnClickListener() { 70 public void onClick(View v) { 71 Button button4 = (Button) findViewById(R.id.button4); 72 accounttype.setText(button4.getText()); 73 74 } 75 }); 76 // 娱乐 77 Button button5 = (Button) findViewById(R.id.button5); 78 button5.setOnClickListener(new Button.OnClickListener() { 79 public void onClick(View v) { 80 Button button5 = (Button) findViewById(R.id.button5); 81 accounttype.setText(button5.getText()); 82 83 } 84 }); 85 86 // 医疗 87 Button button6 = (Button) findViewById(R.id.button6); 88 button6.setOnClickListener(new Button.OnClickListener() { 89 public void onClick(View v) { 90 Button button6 = (Button) findViewById(R.id.button6); 91 accounttype.setText(button6.getText()); 92 93 } 94 }); 95 96 Button button7 = (Button) findViewById(R.id.button7); 97 button7.setOnClickListener(new Button.OnClickListener() { 98 public void onClick(View v) { 99 OK(); 100 101 } 102 }); 103 104 } 105 106 public boolean onCreateOptionsMenu(Menu menu) { 107 // Inflate the menu; this adds items to the action bar if it is present. 108 getMenuInflater().inflate(R.menu.add, menu); 109 return true; 110 } 111 112 @Override 113 public boolean onOptionsItemSelected(MenuItem item) { 114 // Handle action bar item clicks here. The action bar will 115 // automatically handle clicks on the Home/Up button, so long 116 // as you specify a parent activity in AndroidManifest.xml. 117 118 // 获取“录入”的返回键,并执行返回。 119 int id = item.getItemId(); 120 if (id == R.id.action_add_back) { 121 122 onBackPressed(); 123 } 124 125 return super.onOptionsItemSelected(item); 126 } 127 128 // OK按钮 129 public void OK() { 130 131 TextView mytime = (TextView) findViewById(R.id.mytime); 132 String text1 = mytime.getText().toString(); 133 134 TextView accounttype = (TextView) findViewById(R.id.accounttype); 135 String text2 = accounttype.getText().toString(); 136 137 EditText editText1 = (EditText) findViewById(R.id.editText1); 138 String text3 = editText1.getText().toString(); 139 140 EditText editText2 = (EditText) findViewById(R.id.editText2); 141 String text4 = editText2.getText().toString(); 142 143 144 if (text3.equals("")) { 145 146 Log.e("$%^", "toast"); 147 Toast toast = Toast.makeText(add.this, "请输入金额。", 148 Toast.LENGTH_SHORT); 149 toast.show(); 150 } 151 152 else if(text3.equals(".")||text3.substring(0, 1).equals("0")){ 153 154 Toast toast = Toast.makeText(add.this, "输入有误,请重新输入。", 155 Toast.LENGTH_SHORT); 156 toast.show(); 157 158 159 160 } 161 162 else{ 163 164 AccountManager accountManager = new AccountManagerImpl(); 165 Account account = new Account(); 166 account.setAccountId(1); 167 168 try { 169 account.setAccountDate(new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss").parse(text1)); 170 } catch (ParseException e) { 171 // TODO Auto-generated catch block 172 e.printStackTrace(); 173 } 174 175 account.setAccountType(text2); 176 account.setAccountSum(text3); 177 accountManager.addAcount(account); 178 179 onBackPressed(); 180 } 181 182 183 184 185 } 186 187 }
2.中端,完成功能点为“接收前端发送的数据”,“发送数据给后端”,“提供查询接口”。以下是代码部分
1 package com.onezero.account; 2 3 import java.text.ParseException; 4 import java.text.SimpleDateFormat; 5 import java.util.Date; 6 7 import com.onezero.account.controller.Account; 8 import com.onezero.account.controller.AccountManager; 9 import com.onezero.account.controller.AccountManagerImpl; 10 11 import android.app.Activity; 12 import android.os.Bundle; 13 import android.util.Log; 14 import android.view.Menu; 15 import android.view.MenuItem; 16 import android.view.View; 17 import android.widget.Button; 18 import android.widget.EditText; 19 import android.widget.TextView; 20 import android.widget.Toast; 21 22 public class add extends Activity { 23 24 @Override 25 protected void onCreate(Bundle savedInstanceState) { 26 super.onCreate(savedInstanceState); 27 setContentView(R.layout.add_main); 28 // 显示当前时间 29 SimpleDateFormat formatter = new SimpleDateFormat( 30 "yyyy年MM月dd日 HH:mm:ss"); 31 Date curDate = new Date(System.currentTimeMillis());// 获取当前时间 32 String str = formatter.format(curDate); 33 34 TextView mTime = (TextView) findViewById(R.id.mytime); 35 mTime.setText(str); 36 37 // 实现事件类型选择,点击并改变显示。 38 final TextView accounttype = (TextView) findViewById(R.id.accounttype); 39 // 一般 40 Button button1 = (Button) findViewById(R.id.button1); 41 button1.setOnClickListener(new Button.OnClickListener() { 42 public void onClick(View v) { 43 Button button1 = (Button) findViewById(R.id.button1); 44 accounttype.setText(button1.getText()); 45 46 } 47 }); 48 // 餐饮 49 Button button2 = (Button) findViewById(R.id.button2); 50 button2.setOnClickListener(new Button.OnClickListener() { 51 public void onClick(View v) { 52 Button button2 = (Button) findViewById(R.id.button2); 53 accounttype.setText(button2.getText()); 54 55 } 56 }); 57 58 // 购物 59 Button button3 = (Button) findViewById(R.id.button3); 60 button3.setOnClickListener(new Button.OnClickListener() { 61 public void onClick(View v) { 62 Button button3 = (Button) findViewById(R.id.button3); 63 accounttype.setText(button3.getText()); 64 65 } 66 }); 67 // 交通 68 Button button4 = (Button) findViewById(R.id.button4); 69 button4.setOnClickListener(new Button.OnClickListener() { 70 public void onClick(View v) { 71 Button button4 = (Button) findViewById(R.id.button4); 72 accounttype.setText(button4.getText()); 73 74 } 75 }); 76 // 娱乐 77 Button button5 = (Button) findViewById(R.id.button5); 78 button5.setOnClickListener(new Button.OnClickListener() { 79 public void onClick(View v) { 80 Button button5 = (Button) findViewById(R.id.button5); 81 accounttype.setText(button5.getText()); 82 83 } 84 }); 85 86 // 医疗 87 Button button6 = (Button) findViewById(R.id.button6); 88 button6.setOnClickListener(new Button.OnClickListener() { 89 public void onClick(View v) { 90 Button button6 = (Button) findViewById(R.id.button6); 91 accounttype.setText(button6.getText()); 92 93 } 94 }); 95 96 Button button7 = (Button) findViewById(R.id.button7); 97 button7.setOnClickListener(new Button.OnClickListener() { 98 public void onClick(View v) { 99 OK(); 100 101 } 102 }); 103 104 } 105 106 public boolean onCreateOptionsMenu(Menu menu) { 107 // Inflate the menu; this adds items to the action bar if it is present. 108 getMenuInflater().inflate(R.menu.add, menu); 109 return true; 110 } 111 112 @Override 113 public boolean onOptionsItemSelected(MenuItem item) { 114 // Handle action bar item clicks here. The action bar will 115 // automatically handle clicks on the Home/Up button, so long 116 // as you specify a parent activity in AndroidManifest.xml. 117 118 // 获取“录入”的返回键,并执行返回。 119 int id = item.getItemId(); 120 if (id == R.id.action_add_back) { 121 122 onBackPressed(); 123 } 124 125 return super.onOptionsItemSelected(item); 126 } 127 128 // OK按钮 129 public void OK() { 130 131 TextView mytime = (TextView) findViewById(R.id.mytime); 132 String text1 = mytime.getText().toString(); 133 134 TextView accounttype = (TextView) findViewById(R.id.accounttype); 135 String text2 = accounttype.getText().toString(); 136 137 EditText editText1 = (EditText) findViewById(R.id.editText1); 138 String text3 = editText1.getText().toString(); 139 140 EditText editText2 = (EditText) findViewById(R.id.editText2); 141 String text4 = editText2.getText().toString(); 142 143 144 if (text3.equals("")) { 145 146 Log.e("$%^", "toast"); 147 Toast toast = Toast.makeText(add.this, "请输入金额。", 148 Toast.LENGTH_SHORT); 149 toast.show(); 150 } 151 152 else if(text3.equals(".")||text3.substring(0, 1).equals("0")){ 153 154 Toast toast = Toast.makeText(add.this, "输入有误,请重新输入。", 155 Toast.LENGTH_SHORT); 156 toast.show(); 157 158 159 160 } 161 162 else{ 163 164 AccountManager accountManager = new AccountManagerImpl(); 165 Account account = new Account(); 166 account.setAccountId(1); 167 168 try { 169 account.setAccountDate(new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss").parse(text1)); 170 } catch (ParseException e) { 171 // TODO Auto-generated catch block 172 e.printStackTrace(); 173 } 174 175 account.setAccountType(text2); 176 account.setAccountSum(text3); 177 accountManager.addAcount(account); 178 179 onBackPressed(); 180 } 181 182 183 184 185 } 186 187 }
1 package com.onezero.account.controller; 2 3 import java.util.List; 4 5 public interface AccountManager { 6 7 /** 8 * 添加账本信息 9 * 10 * @param account 帐本信息 11 * @return true 添加成功 false:添加失败 12 * 13 *TODO: 需要确认添加失败是否抛出异常,给用户友好提示 14 */ 15 boolean addAcount(Account account); 16 17 /** 18 * 查询全部账本信息,返回信息按时间降序排序 19 * 20 * @return 全部账本信息 21 */ 22 List<Account> queryAcount(); 23 }
1 package com.onezero.account.controller; 2 3 import java.util.Date; 4 import java.util.List; 5 import java.util.ArrayList; 6 public class AccountManagerImpl implements AccountManager{ 7 8 /** 9 * 添加账本信息 10 * 11 * @param account 帐本信息 12 * @return true 添加成功 false:添加失败 13 * 14 *TODO: 需要确认添加失败是否抛出异常,给用户友好提示 15 */ 16 public boolean addAcount(Account account){ 17 // TODO:调用数据库层 18 return true; 19 } 20 21 /** 22 * 查询全部账本信息,返回信息按时间降序排序 23 * 24 * @return 全部账本信息 25 */ 26 public List<Account> queryAcount(){ 27 List<Account> accountList = new ArrayList<Account>(); 28 29 // TODO: 调用数据库层 (暂时写假的) 30 Account account = new Account(); 31 account.setAccountId(1); 32 account.setAccountDate(new Date()); 33 account.setAccountType("transportation"); 34 account.setAccountSum("50"); 35 36 accountList.add(account); 37 return accountList; 38 } 39 }
3.后端,完成功能点为“将获取的数据插入数据库”。
会议体会:昨天布置的任务大家都顺利完成,继续努力。以下是本周的燃尽图,我对昨天的燃尽图进行了修改。
以上是OneZero第二周第三次站立会议。
以上是关于OneZero第二周第三次站立会议(2016.3.30)的主要内容,如果未能解决你的问题,请参考以下文章